Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-3913 SonarQube - Instantiating wrappers - from 'new Wrapper(arg)' to 'Wrapper.valueOf(arg)' #4033

Merged
merged 2 commits into from Jun 11, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1762,7 +1762,7 @@ private TableElement getTableElement(SchemaElement schema,

// Type numeric=2
fakeKeyCol.setType(2);
fakeKeyCol.setPrecision(new Integer(MINIMUM_PRECISION));
fakeKeyCol.setPrecision(Integer.valueOf(MINIMUM_PRECISION));
tkey.setPrimaryKey(true);
tkey.addColumn(fakeKeyCol);
retVal.addColumn(fakeKeyCol);
@@ -573,7 +573,7 @@ public static boolean isTime (int jdbcType) {
}

private static boolean checkType(int jdbcType, Map jdbcTypes) {
return jdbcTypes.containsKey(new Integer(jdbcType));
return jdbcTypes.containsKey(Integer.valueOf(jdbcType));
}

/** Returns a collection of compatible jdbc types.
@@ -636,16 +636,16 @@ public static boolean hasLength(int jdbcType) {

private static String getAttribute(int jdbcType) {
if (isNumeric(jdbcType)) {
return (String)numericMap.get(new Integer(jdbcType));
return (String)numericMap.get(Integer.valueOf(jdbcType));
}
else if (isCharacter(jdbcType)) {
return (String)characterMap.get(new Integer(jdbcType));
return (String)characterMap.get(Integer.valueOf(jdbcType));
}
else if (isBlob(jdbcType)) {
return (String)blobMap.get(new Integer(jdbcType));
return (String)blobMap.get(Integer.valueOf(jdbcType));
}
else if (isTime(jdbcType)) {
return (String)timeMap.get(new Integer(jdbcType));
return (String)timeMap.get(Integer.valueOf(jdbcType));
}
return NONE_ATTRIBUTE;
}
@@ -58,7 +58,7 @@
}

final InsnTarget getTarget(int offset) {
Integer off = new Integer(offset);
Integer off = Integer.valueOf(offset);
InsnTarget targ = (InsnTarget)targets.get(off);
if (targ == null) {
targ = new InsnTarget(offset);
@@ -68,7 +68,7 @@ final InsnTarget getTarget(int offset) {
}

final InsnTarget findTarget(int offset) {
Integer off = new Integer(offset);
Integer off = Integer.valueOf(offset);
return (InsnTarget)targets.get(off);
}

@@ -166,7 +166,7 @@ public ConstString addString (String s) {
*/
public ConstInteger addInteger (int i) {
hashConstants();
Integer io = new Integer(i);
Integer io = Integer.valueOf(i);
ConstInteger ci = (ConstInteger) intTable.get(io);
if (ci == null) {
ci = new ConstInteger(i);
@@ -180,7 +180,7 @@ public ConstInteger addInteger (int i) {
*/
public ConstFloat addFloat (float f) {
hashConstants();
Float fo = new Float(f);
Float fo = Float.valueOf(f);
ConstFloat cf = (ConstFloat) floatTable.get(fo);
if (cf == null) {
cf = new ConstFloat(f);
@@ -194,7 +194,7 @@ public ConstFloat addFloat (float f) {
*/
public ConstLong addLong (long l) {
hashConstants();
Long lo = new Long(l);
Long lo = Long.valueOf(l);
ConstLong cl = (ConstLong) longTable.get(lo);
if (cl == null) {
cl = new ConstLong(l);
@@ -209,7 +209,7 @@ public ConstLong addLong (long l) {
*/
public ConstDouble addDouble (double d) {
hashConstants();
Double dobj = new Double(d);
Double dobj = Double.valueOf(d);
ConstDouble cd = (ConstDouble) doubleTable.get(dobj);
if (cd == null) {
cd = new ConstDouble(d);
@@ -2247,7 +2247,7 @@ private int tmpReg2(int idx) {
while (tmpDoubleRegisters.size() <= idx) {
final CodeAttribute codeAttr = method.codeAttribute();
final int reg = codeAttr.localsUsed();
tmpDoubleRegisters.addElement(new Integer(reg));
tmpDoubleRegisters.addElement(Integer.valueOf(reg));
codeAttr.setLocalsUsed(reg+2);
}

@@ -2268,7 +2268,7 @@ private int tmpReg(int idx) {
while (tmpRegisters.size() <= idx) {
final CodeAttribute codeAttr = method.codeAttribute();
final int reg = codeAttr.localsUsed();
tmpRegisters.addElement(new Integer(reg));
tmpRegisters.addElement(Integer.valueOf(reg));
codeAttr.setLocalsUsed(reg+1);
}
return ((Integer)tmpRegisters.elementAt(idx)).intValue();
@@ -119,7 +119,7 @@ static protected final String getI18N(String key,
int arg1,
String arg2) {
return I18NHelper.getMessage(MESSAGES, key,
new Object[]{new Integer(arg1), arg2});
new Object[]{arg1, arg2});
}

/**
@@ -749,7 +749,7 @@ public String getSQLTypeName(int jdbcType) {

// The name is in sqlInfo if it was loaded from one of our
// vendor-specific properties files.
Object o = sqlInfo.get(new Integer(jdbcType));
Object o = sqlInfo.get(Integer.valueOf(jdbcType));
if (null != o) {
rc = (String) o;
} else {
@@ -977,7 +977,7 @@ public static String getOverrideForType(
*/
public static String getJdbcTypeName(int type) throws
IllegalArgumentException {
String rc = (String) jdbcTypeNames.get(new Integer(type));
String rc = (String) jdbcTypeNames.get(Integer.valueOf(type));
if (null == rc) {
throw new IllegalArgumentException();
}
@@ -189,7 +189,7 @@ public int getObjectIdentityType ()
public void setObjectIdentityType (int type) throws ModelException
{
Integer old = new Integer(getObjectIdentityType());
Integer newType = new Integer(type);
Integer newType = Integer.valueOf(type);

try
{
@@ -109,7 +109,7 @@ public PersistenceFieldElementImpl (String name)
public void setPersistenceType (int type) throws ModelException
{
Integer old = new Integer(getPersistenceType());
Integer newType = new Integer(type);
Integer newType = Integer.valueOf(type);

try
{
@@ -143,7 +143,7 @@ public RelationshipElementImpl (String name)
public void setUpdateAction (int action) throws ModelException
{
Integer old = new Integer(getUpdateAction());
Integer newAction = new Integer(action);
Integer newAction = Integer.valueOf(action);

try
{
@@ -180,7 +180,7 @@ public void setUpdateAction (int action) throws ModelException
public void setDeleteAction (int action) throws ModelException
{
Integer old = new Integer(getDeleteAction());
Integer newAction = new Integer(action);
Integer newAction = Integer.valueOf(action);

try
{
@@ -235,7 +235,7 @@ public void setPrefetch (boolean flag) throws ModelException
public void setLowerBound (int lowerBound) throws ModelException
{
Integer old = new Integer(getLowerBound());
Integer newBound = new Integer(lowerBound);
Integer newBound = Integer.valueOf(lowerBound);

try
{
@@ -264,7 +264,7 @@ public void setLowerBound (int lowerBound) throws ModelException
public void setUpperBound (int upperBound) throws ModelException
{
Integer old = new Integer(getUpperBound());
Integer newBound = new Integer(upperBound);
Integer newBound = Integer.valueOf(upperBound);

try
{
@@ -298,7 +298,7 @@ public void setModified (boolean flag)
public void setConsistencyLevel (int level) throws ModelException
{
Integer old = new Integer(getConsistencyLevel());
Integer newLevel = new Integer(level);
Integer newLevel = Integer.valueOf(level);

try
{
@@ -234,7 +234,7 @@ public void setVersion (boolean flag) throws ModelException
public void setFetchGroup (int group) throws ModelException
{
Integer old = new Integer(getFetchGroup());
Integer newGroup = new Integer(group);
Integer newGroup = Integer.valueOf(group);

try
{
@@ -100,7 +100,7 @@ public void process() {

if (logger.isLoggable(logger.FINE)) {
logger.fine("ejb.CMPProcessor.createanddroptables", //NOI18N
new Object[] {new Boolean(createTables), new Boolean(userDropTables)});
new Object[] {createTables, userDropTables});
}

if (!createTables && !userDropTables) {
@@ -77,13 +77,13 @@ public static void error(int line, int col, String text)
EJBQLException ex = null;
if (line > 1) {
// include line and column info
Object args[] = {new Integer(line), new Integer(col), text};
Object args[] = {line, col, text};
ex = new EJBQLException(I18NHelper.getMessage(
msgs, "EXC_PositionInfoMsgLineColumn", args)); //NOI18N
}
else if (col > 0) {
// include column info
Object args[] = {new Integer(col), text};
Object args[] = {col, text};
ex = new EJBQLException(I18NHelper.getMessage(
msgs, "EXC_PositionInfoMsgColumn", args)); //NOI18N
}
@@ -133,13 +133,13 @@ public static void unsupported(int line, int col, String text)
if (line > 1)
{
// include line and column info
Object args[] = {new Integer(line), new Integer(col), text};
Object args[] = {line, col, text};
ex = new UnsupportedOperationException(I18NHelper.getMessage(
msgs, "EXC_PositionInfoMsgLineColumn", args)); //NOI18N
}
else if (col > 0) {
// include column info
Object args[] = {new Integer(col), text};
Object args[] = {col, text};
ex = new UnsupportedOperationException(I18NHelper.getMessage(
msgs, "EXC_PositionInfoMsgColumn", args)); //NOI18N
}
@@ -4398,7 +4398,7 @@ public boolean needsUpdateInVersionConsistencyCache() {

public boolean setBooleanField(int fieldNumber, boolean value) {
assertNotPK(fieldNumber);
prepareSetField(fieldNumber, new Boolean(value));
prepareSetField(fieldNumber, Boolean.valueOf(value));
return value;
}

@@ -4409,7 +4409,7 @@ public boolean setBooleanField(int fieldNumber, boolean value) {

public byte setByteField(int fieldNumber, byte value) {
assertNotPK(fieldNumber);
prepareSetField(fieldNumber, new Byte(value));
prepareSetField(fieldNumber, Byte.valueOf(value));
return value;
}

@@ -4420,7 +4420,7 @@ public byte setByteField(int fieldNumber, byte value) {

public short setShortField(int fieldNumber, short value) {
assertNotPK(fieldNumber);
prepareSetField(fieldNumber, new Short(value));
prepareSetField(fieldNumber, Short.valueOf(value));
return value;
}

@@ -4431,7 +4431,7 @@ public short setShortField(int fieldNumber, short value) {

public int setIntField(int fieldNumber, int value) {
assertNotPK(fieldNumber);
prepareSetField(fieldNumber, new Integer(value));
prepareSetField(fieldNumber, Integer.valueOf(value));
return value;
}

@@ -4442,7 +4442,7 @@ public int setIntField(int fieldNumber, int value) {

public long setLongField(int fieldNumber, long value) {
assertNotPK(fieldNumber);
prepareSetField(fieldNumber, new Long(value));
prepareSetField(fieldNumber, Long.valueOf(value));
return value;
}

@@ -4453,7 +4453,7 @@ public long setLongField(int fieldNumber, long value) {

public char setCharField(int fieldNumber, char value) {
assertNotPK(fieldNumber);
prepareSetField(fieldNumber, new Character(value));
prepareSetField(fieldNumber, Character.valueOf(value));
return value;
}

@@ -4464,7 +4464,7 @@ public char setCharArrayField(int fieldNumber, char value) {

public float setFloatField(int fieldNumber, float value) {
assertNotPK(fieldNumber);
prepareSetField(fieldNumber, new Float(value));
prepareSetField(fieldNumber, Float.valueOf(value));
return value;
}

@@ -4475,7 +4475,7 @@ public float setFloatField(int fieldNumber, float value) {

public double setDoubleField(int fieldNumber, double value) {
assertNotPK(fieldNumber);
prepareSetField(fieldNumber, new Double(value));
prepareSetField(fieldNumber, Double.valueOf(value));
return value;
}

@@ -238,7 +238,7 @@ private void executeUpdate(PersistenceManager pm,

if (debug) {
logger.fine("sqlstore.sqlstoremanager.executeupdate.exit", // NOI18N
new Integer(affectedRows));
Integer.valueOf(affectedRows));
}
}

@@ -368,7 +368,7 @@ public void bindFixedCharColumn(int index, String strVal, int length)
ps.setString(index, padSpaceChar(strVal, length) );
if (logger.isLoggable(Logger.FINE) ) {
logger.log(Logger.FINE, "sqlstore.database.oracle.fixedcharpadded",
strVal, new Integer(length) );
strVal, Integer.valueOf(length) );
}
}

@@ -1363,7 +1363,7 @@ public synchronized Connection getConnection() {

if (debug) {
Object[] items = new Object[] {_connection, Boolean.valueOf(optimistic),
new Integer(_connectionReferenceCount) , persistenceManager};
Integer.valueOf(_connectionReferenceCount) , persistenceManager};
logger.finest("sqlstore.transactionimpl.getconnection",items); // NOI18N
}

@@ -1420,7 +1420,7 @@ public synchronized void releaseConnection() {
if (debug) {
Object[] items = new Object[] {Boolean.valueOf(optimistic),
Boolean.valueOf(startedCommit),
new Integer(_connectionReferenceCount) , persistenceManager};
Integer.valueOf(_connectionReferenceCount) , persistenceManager};
logger.finest("sqlstore.transactionimpl.releaseconnection",items); // NOI18N
}

@@ -327,7 +327,7 @@ public Object convertValue(Object value, StateManager sm) {
if (absoluteID < 0) {
// Hidden field nothing to convert
if (debug)
logger.finest("sqlstore.model.fielddesc.convertvalue.hidden",new Integer(absoluteID)); // NOI18N
logger.finest("sqlstore.model.fielddesc.convertvalue.hidden",Integer.valueOf(absoluteID)); // NOI18N
return value;
}

@@ -92,7 +92,7 @@ public boolean isPrimitiveMappedToNullableColumn() {
ColumnElement c = (ColumnElement) iter.next();
rc = c.isNullable();
}
primitiveMappedToNullableColumn = new Boolean(rc);
primitiveMappedToNullableColumn = Boolean.valueOf(rc);
}

return primitiveMappedToNullableColumn.booleanValue();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.