From 6b5bc746d6c0f8650e6fa33aec924f57ca33cb69 Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 13:28:36 -0700 Subject: [PATCH 01/15] =?UTF-8?q?Replace=20the=20synchronized=20class=20"S?= =?UTF-8?q?tringBuffer"=20by=20an=20unsynchronized=20one=20such=20as=20"St?= =?UTF-8?q?ringBuilder".=C2=A0=20Remove=20uselsess=20assignment=20to=20loc?= =?UTF-8?q?al=20variable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/microsoft/sqlserver/jdbc/dtv.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java b/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java index 7c18c3fb8..c4d86a603 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java @@ -3540,7 +3540,7 @@ Object denormalizedValue(byte[] decryptedValue, (null == baseTypeInfo.getCharset()) ? con.getDatabaseCollation().getCharset() : baseTypeInfo.getCharset()); if ((SSType.CHAR == baseSSType) || (SSType.NCHAR == baseSSType)) { // Right pad the string for CHAR types. - StringBuffer sb = new StringBuffer(strVal); + StringBuilder sb = new StringBuilder(strVal); int padLength = baseTypeInfo.getPrecision() - strVal.length(); for (int i = 0; i < padLength; i++) { sb.append(' '); @@ -3738,13 +3738,14 @@ Object getValue(DTV dtv, TDSReader tdsReader) throws SQLServerException { SQLServerConnection con = tdsReader.getConnection(); Object convertedValue = null; - byte[] decryptedValue = null; + byte[] decryptedValue; boolean encrypted = false; SSType baseSSType = typeInfo.getSSType(); // If column encryption is not enabled on connection or on statement, cryptoMeta will be null. if (null != cryptoMetadata) { - assert (SSType.VARBINARY == typeInfo.getSSType()) || (SSType.VARBINARYMAX == typeInfo.getSSType()); + SSType typeInfoSSType = typeInfo.getSSType(); + assert (SSType.VARBINARY == typeInfoSSType) || (SSType.VARBINARYMAX == typeInfoSSType); baseSSType = cryptoMetadata.baseTypeInfo.getSSType(); encrypted = true; @@ -3765,8 +3766,6 @@ Object getValue(DTV dtv, // or valueMark should be null and isNull should be set to true(NBCROW case) assert ((valueMark != null) || (valueMark == null && isNull)); - boolean isAdaptive = false; - if (null != streamGetterArgs) { if (!streamGetterArgs.streamType.convertsFrom(typeInfo)) DataTypes.throwConversionError(typeInfo.getSSType().toString(), streamGetterArgs.streamType.toString()); From 66dd6d0e58a4a1b822e88f5399372f40bcb30311 Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 14:58:09 -0700 Subject: [PATCH 02/15] reverted back the assert side effect fix --- src/main/java/com/microsoft/sqlserver/jdbc/dtv.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java b/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java index c4d86a603..86d14b3ee 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java @@ -3744,8 +3744,7 @@ Object getValue(DTV dtv, // If column encryption is not enabled on connection or on statement, cryptoMeta will be null. if (null != cryptoMetadata) { - SSType typeInfoSSType = typeInfo.getSSType(); - assert (SSType.VARBINARY == typeInfoSSType) || (SSType.VARBINARYMAX == typeInfoSSType); + assert (SSType.VARBINARY == typeInfo.getSSType()) || (SSType.VARBINARYMAX == typeInfo.getSSType()) ; baseSSType = cryptoMetadata.baseTypeInfo.getSSType(); encrypted = true; From 89b9ca238b0002048f82c03418e17310dffa65de Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 15:13:53 -0700 Subject: [PATCH 03/15] remove duplicate block of code. --- src/main/java/com/microsoft/sqlserver/jdbc/Util.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java index bac845335..251bd6bac 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java @@ -886,13 +886,12 @@ else if (("" + value).contains("E")) { case TIME: case DATETIMEOFFSET: return ((null == scale) ? TDS.MAX_FRACTIONAL_SECONDS_SCALE : scale); - case READER: - return ((null == value) ? 0 : DataTypes.NTEXT_MAX_CHARS); - + case CLOB: return ((null == value) ? 0 : (DataTypes.NTEXT_MAX_CHARS * 2)); case NCLOB: + case READER: return ((null == value) ? 0 : DataTypes.NTEXT_MAX_CHARS); } return 0; From 47bbf229f6407755e053aee56a1e765233742111 Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 15:15:46 -0700 Subject: [PATCH 04/15] remove useless assignment to local variable --- src/main/java/com/microsoft/sqlserver/jdbc/Util.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java index 251bd6bac..75abb0107 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java @@ -844,7 +844,7 @@ else if (JDBCType.BINARY == jdbcType || JDBCType.VARBINARY == jdbcType) { return ((null == value) ? 0 : ((byte[]) value).length); case BIGDECIMAL: - int length = -1; + int length; if (null == precision) { if (null == value) { From b84ad274e5aa9088ca600fe5bab41dd80950fdeb Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 15:20:13 -0700 Subject: [PATCH 05/15] remove duplicate case block --- src/main/java/com/microsoft/sqlserver/jdbc/Util.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java index 75abb0107..d100bf65e 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java @@ -741,7 +741,6 @@ static boolean shouldHonorAEForRead(SQLServerStatementColumnEncryptionSetting st case Disabled: return false; case Enabled: - return true; case ResultSetOnly: return true; default: @@ -761,11 +760,10 @@ static boolean shouldHonorAEForParameters(SQLServerStatementColumnEncryptionSett // Command leve setting trumps all switch (stmtColumnEncryptionSetting) { case Disabled: + case ResultSetOnly: return false; case Enabled: return true; - case ResultSetOnly: - return false; default: // Check connection level setting! assert SQLServerStatementColumnEncryptionSetting.UseConnectionSetting == stmtColumnEncryptionSetting : "Unexpected value for command level override"; From 479adbc8be77e02698f2714696cb253418b7e8ed Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 15:24:00 -0700 Subject: [PATCH 06/15] move string literal on the left side of string comparison --- src/main/java/com/microsoft/sqlserver/jdbc/Util.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java index d100bf65e..563a1b959 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java @@ -723,7 +723,7 @@ static final String readGUID(byte[] inputGUID) throws SQLServerException { static boolean IsActivityTraceOn() { LogManager lm = LogManager.getLogManager(); String activityTrace = lm.getProperty(ActivityIdTraceProperty); - if (null != activityTrace && activityTrace.equalsIgnoreCase("on")) + if ("on".equalsIgnoreCase(activityTrace)) return true; else return false; From 4086bff4d3743e8afdfe469155572e12e47f42a6 Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 15:33:45 -0700 Subject: [PATCH 07/15] remove useless assignment to local variable + use stringBuilder instead --- .../com/microsoft/sqlserver/jdbc/Util.java | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java index 563a1b959..e06e0f429 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java @@ -243,12 +243,13 @@ static BigDecimal readBigDecimal(byte valueBytes[], String result = ""; String name = ""; String value = ""; - + StringBuilder builder; + if (!tmpUrl.startsWith(sPrefix)) return null; tmpUrl = tmpUrl.substring(sPrefix.length()); - int i = 0; + int i; // Simple finite state machine. // always look at one char at a time @@ -273,7 +274,10 @@ static BigDecimal readBigDecimal(byte valueBytes[], state = inName; } else { - result = result + ch; + builder = new StringBuilder(); + builder.append(result); + builder.append(ch); + result = builder.toString(); state = inServerName; } break; @@ -299,7 +303,10 @@ else if (ch == ':') state = inInstanceName; } else { - result = result + ch; + builder = new StringBuilder(); + builder.append(result); + builder.append(ch); + result = builder.toString(); // same state } break; @@ -316,7 +323,10 @@ else if (ch == ':') state = inName; } else { - result = result + ch; + builder = new StringBuilder(); + builder.append(result); + builder.append(ch); + result = builder.toString(); // same state } break; @@ -337,7 +347,10 @@ else if (ch == ':') state = inPort; } else { - result = result + ch; + builder = new StringBuilder(); + builder.append(result); + builder.append(ch); + result = builder.toString(); // same state } break; @@ -361,7 +374,10 @@ else if (ch == ':') // same state } else { - name = name + ch; + builder = new StringBuilder(); + builder.append(name); + builder.append(ch); + name = builder.toString(); // same state } break; @@ -393,7 +409,10 @@ else if (ch == '{') { } } else { - value = value + ch; + builder = new StringBuilder(); + builder.append(value); + builder.append(ch); + value = builder.toString(); // same state } break; @@ -418,7 +437,10 @@ else if (ch == '{') { state = inEscapedValueEnd; } else { - value = value + ch; + builder = new StringBuilder(); + builder.append(value); + builder.append(ch); + value = builder.toString(); // same state } break; From 47779e5496e9b5f264fa1653b543043099565dd1 Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 15:53:46 -0700 Subject: [PATCH 08/15] remove useless assignment --- .../com/microsoft/sqlserver/jdbc/StringUtils.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/StringUtils.java b/src/main/java/com/microsoft/sqlserver/jdbc/StringUtils.java index f43ed1caa..241a5e2ca 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/StringUtils.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/StringUtils.java @@ -54,16 +54,14 @@ public static boolean isNumeric(final String str) { * @return {@link Boolean} if provided String is Integer or not. */ public static boolean isInteger(final String str) { - boolean isInteger = false; - try { - int i = Integer.parseInt(str); - isInteger = true; - }catch(NumberFormatException e) { - //Nothing. this is not integer. + Integer.parseInt(str); + return true; } - - return isInteger; + catch (NumberFormatException e) { + // Nothing. this is not integer. + } + return false; } } From 7f38127b353726183c59a52784f7558f6b52afa5 Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 16:16:08 -0700 Subject: [PATCH 09/15] replace synchronized vector by unsynchronized replacement. --- .../com/microsoft/sqlserver/jdbc/SQLServerXAResource.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java index b2d194808..2c07ec395 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java @@ -14,6 +14,7 @@ import java.sql.Statement; import java.sql.Types; import java.text.MessageFormat; +import java.util.ArrayList; import java.util.Properties; import java.util.Vector; import java.util.concurrent.atomic.AtomicInteger; @@ -791,7 +792,7 @@ else if (-1 != version.indexOf('.')) { /* L0 */ public Xid[] recover(int flags) throws XAException { XAReturnValue r = DTC_XA_Interface(XA_RECOVER, null, flags | tightlyCoupled); int offset = 0; - Vector v = new Vector(); + ArrayList v = new ArrayList(); // If no XID's found, return zero length XID array (don't return null). // @@ -828,7 +829,7 @@ else if (-1 != version.indexOf('.')) { } XidImpl xids[] = new XidImpl[v.size()]; for (int i = 0; i < v.size(); i++) { - xids[i] = v.elementAt(i); + xids[i] = v.get(i); if (xaLogger.isLoggable(Level.FINER)) xaLogger.finer(toString() + xids[i].toString()); } From 9af98fb4ee085f35b866cd50145d8cfab908ffac Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 17:12:35 -0700 Subject: [PATCH 10/15] remove duplicate block of code --- src/main/java/com/microsoft/sqlserver/jdbc/dtv.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java b/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java index 86d14b3ee..14f44c4cf 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java @@ -1523,10 +1523,7 @@ final void executeOp(DTVExecuteOp op) throws SQLServerException { case LONGVARCHAR: case CLOB: case GUID: - if (null != cryptoMeta) - op.execute(this, (byte[]) null); - else - op.execute(this, (byte[]) null); + op.execute(this, (byte[]) null); break; case TINYINT: From d4a75640a150abebf9c211becab847524a8237dd Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 17 May 2017 17:44:00 -0700 Subject: [PATCH 11/15] remove useless assignment, stringbuffer, moved string literal on the left side of comparison --- .../java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java | 4 ++-- .../microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java | 4 ++-- .../java/com/microsoft/sqlserver/jdbc/SimpleInputStream.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java index d49d72221..a49a8832d 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java @@ -2209,11 +2209,11 @@ public T unwrap(Class iface) throws SQLException { public final void setResponseBuffering(String value) throws SQLServerException { loggerExternal.entering(getClassNameLogging(), "setResponseBuffering", value); checkClosed(); - if (value.equalsIgnoreCase("full")) { + if ("full".equalsIgnoreCase(value)) { isResponseBufferingAdaptive = false; wasResponseBufferingSet = true; } - else if (value.equalsIgnoreCase("adaptive")) { + else if ("adaptive".equalsIgnoreCase(value)) { isResponseBufferingAdaptive = true; wasResponseBufferingSet = true; } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java index 36b40d6b0..9a44423bc 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java @@ -94,8 +94,8 @@ SQLServerSymmetricKey getKey(EncryptionKeyInfo keyInfo, String serverName = connection.getTrustedServerNameAE(); assert null != serverName : "serverName should not be null in getKey."; - StringBuffer keyLookupValuebuffer = new StringBuffer(serverName); - String keyLookupValue = null; + StringBuilder keyLookupValuebuffer = new StringBuilder(serverName); + String keyLookupValue; keyLookupValuebuffer.append(":"); keyLookupValuebuffer.append(DatatypeConverter.printBase64Binary((new String(keyInfo.encryptedKey, UTF_8)).getBytes())); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SimpleInputStream.java b/src/main/java/com/microsoft/sqlserver/jdbc/SimpleInputStream.java index fa319101f..917ebca00 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SimpleInputStream.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SimpleInputStream.java @@ -302,7 +302,7 @@ public int read(byte b[], if (isEOS()) return -1; - int readAmount = 0; + int readAmount; if (streamPos + maxBytes > payloadLength) { readAmount = payloadLength - streamPos; } From d9c8a46ce22b330d45770ae3f505dd118460985f Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Thu, 18 May 2017 11:47:47 -0700 Subject: [PATCH 12/15] use stringbuilder instead of stringbuffer --- .../java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java index a49a8832d..f58c98a47 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java @@ -2555,7 +2555,7 @@ String translate(String sql) throws SQLServerException { // Search for LIMIT escape syntax. Do further processing if present. matcher = limitSyntaxGeneric.matcher(sql); if (matcher.find()) { - StringBuffer sqlbuf = new StringBuffer(sql); + StringB sqlbuf = new StringBuffer(sql); translateLimit(sqlbuf, 0, '\0'); return sqlbuf.toString(); } From 0361a7c9fe4d595790dc70e049a526c3840dd097 Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Thu, 18 May 2017 13:36:15 -0700 Subject: [PATCH 13/15] formatting --- .../microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java | 2 +- src/main/java/com/microsoft/sqlserver/jdbc/dtv.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java index 11241d38b..b89f2c65b 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java @@ -329,7 +329,7 @@ private String escapeParse(StringTokenizer st, String fullName; nameFragment = firstToken; // skip spaces - while (nameFragment.equals(" ") && st.hasMoreTokens()) { + while (" ".equals(nameFragment) && st.hasMoreTokens()) { nameFragment = st.nextToken(); } fullName = nameFragment; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java b/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java index 14f44c4cf..113f58059 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/dtv.java @@ -3741,7 +3741,7 @@ Object getValue(DTV dtv, // If column encryption is not enabled on connection or on statement, cryptoMeta will be null. if (null != cryptoMetadata) { - assert (SSType.VARBINARY == typeInfo.getSSType()) || (SSType.VARBINARYMAX == typeInfo.getSSType()) ; + assert (SSType.VARBINARY == typeInfo.getSSType()) || (SSType.VARBINARYMAX == typeInfo.getSSType()); baseSSType = cryptoMetadata.baseTypeInfo.getSSType(); encrypted = true; From 6106de6e75e4194d5ffa5d96ddda09fa8ca08ba0 Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Thu, 18 May 2017 13:38:22 -0700 Subject: [PATCH 14/15] formatting typo --- .../java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java index f58c98a47..a49a8832d 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java @@ -2555,7 +2555,7 @@ String translate(String sql) throws SQLServerException { // Search for LIMIT escape syntax. Do further processing if present. matcher = limitSyntaxGeneric.matcher(sql); if (matcher.find()) { - StringB sqlbuf = new StringBuffer(sql); + StringBuffer sqlbuf = new StringBuffer(sql); translateLimit(sqlbuf, 0, '\0'); return sqlbuf.toString(); } From 137bbea0a9cdf998047c96f34b6a69b9577a7f1e Mon Sep 17 00:00:00 2001 From: v-afrafi Date: Wed, 24 May 2017 15:32:12 -0700 Subject: [PATCH 15/15] post review changes --- .../microsoft/sqlserver/jdbc/SQLServerXAResource.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java index 2c07ec395..60c710bcc 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java @@ -792,7 +792,7 @@ else if (-1 != version.indexOf('.')) { /* L0 */ public Xid[] recover(int flags) throws XAException { XAReturnValue r = DTC_XA_Interface(XA_RECOVER, null, flags | tightlyCoupled); int offset = 0; - ArrayList v = new ArrayList(); + ArrayList al = new ArrayList(); // If no XID's found, return zero length XID array (don't return null). // @@ -825,11 +825,11 @@ else if (-1 != version.indexOf('.')) { System.arraycopy(r.bData, offset, bid, 0, bid_len); offset += bid_len; XidImpl xid = new XidImpl(formatId, gid, bid); - v.add(xid); + al.add(xid); } - XidImpl xids[] = new XidImpl[v.size()]; - for (int i = 0; i < v.size(); i++) { - xids[i] = v.get(i); + XidImpl xids[] = new XidImpl[al.size()]; + for (int i = 0; i < al.size(); i++) { + xids[i] = al.get(i); if (xaLogger.isLoggable(Level.FINER)) xaLogger.finer(toString() + xids[i].toString()); }