Skip to content

Commit

Permalink
8274234: Remove unnecessary boxing via primitive wrapper valueOf(Stri…
Browse files Browse the repository at this point in the history
…ng) methods in java.sql.rowset

Reviewed-by: lancea, bpb
  • Loading branch information
turbanoff authored and Lance Andersen committed Sep 24, 2021
1 parent f36a2bb commit f214d6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ public byte getByte(int columnIndex) throws SQLException {
return (byte)0;
}
try {
return ((Byte.valueOf(value.toString())).byteValue());
return Byte.parseByte(value.toString());
} catch (NumberFormatException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.bytefail").toString(),
new Object[] {value.toString().trim(), columnIndex}));
Expand Down Expand Up @@ -1849,7 +1849,7 @@ public short getShort(int columnIndex) throws SQLException {
}

try {
return ((Short.valueOf(value.toString().trim())).shortValue());
return Short.parseShort(value.toString().trim());
} catch (NumberFormatException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.shortfail").toString(),
new Object[] {value.toString().trim(), columnIndex}));
Expand Down Expand Up @@ -1892,7 +1892,7 @@ public int getInt(int columnIndex) throws SQLException {
}

try {
return ((Integer.valueOf(value.toString().trim())).intValue());
return Integer.parseInt(value.toString().trim());
} catch (NumberFormatException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.intfail").toString(),
new Object[] {value.toString().trim(), columnIndex}));
Expand Down Expand Up @@ -1935,7 +1935,7 @@ public long getLong(int columnIndex) throws SQLException {
return (long)0;
}
try {
return ((Long.valueOf(value.toString().trim())).longValue());
return Long.parseLong(value.toString().trim());
} catch (NumberFormatException ex) {
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.longfail").toString(),
new Object[] {value.toString().trim(), columnIndex}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -982,8 +982,7 @@ private int getIntegerValue(String s) {
}

private boolean getBooleanValue(String s) {

return Boolean.valueOf(s).booleanValue();
return Boolean.parseBoolean(s);
}

private java.math.BigDecimal getBigDecimalValue(String s) {
Expand Down

1 comment on commit f214d6e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.