Skip to content
Permalink
Browse files
8274234: Remove unnecessary boxing via primitive wrapper valueOf(Stri…
…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 f214d6e8736a620c8e1b87c30587aa0977cccc4c
Showing 2 changed files with 6 additions and 7 deletions.
@@ -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}));
@@ -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}));
@@ -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}));
@@ -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}));
@@ -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
@@ -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) {

1 comment on commit f214d6e

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on f214d6e Sep 24, 2021

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.