You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2013/04/01 05:59:39 UTC

svn commit: r1463080 - in /db/derby/code/trunk/java/client/org/apache/derby: client/am/ client/net/ jdbc/

Author: dag
Date: Mon Apr  1 03:59:38 2013
New Revision: 1463080

URL: http://svn.apache.org/r1463080
Log:
DERBY-6125 Code clean up in client driver

Patch derby-6125-04-a. Patch details:

- removed unused var Configuration.traceFileSuffixIndex__,
  #enableConnectivityToTargetServer__, #jvmSupportsMicrosClock

- made #dncCompatibleJREVersions private, added "1.8" as a legal JRE,
  and added accessor getDncCompatibleJREVersions

- made NetConnection#msgutil final

- removed unused var targetExtnam_

- made #indoubtTransactions_ private and changed to genericized
  HashMap, I believe this is multi thread safe, being used within a XA
  connection. Added accessors #getIndoubtTransaction and
  #getIndoubtTransactionIds

- made some methods final (e.g. #completeConnect, #flowConnect,
  #flowSimpleConnect, #isConnectionNull)

- removed unused extnam

- reduced some variable's scopes to silence FindBugs.

- made #targetPublicKey_ private, changed accessor #getTargetPublicKey
  to copy the the mutable array's contents

- removed instances of useless code of this shape:
      :
      if (!isXAConnection_)
           return;
      if (isOpen()) { // <--- has no side effects
           return; // still open, return
      }
  } <---- we return here anyway...

- removed unused vars NetConnectionReply#srvdgnReceived, #srvdgn

- replaced StringBuffer with StringBuilder in
  NetConnectionReply#doMgrlvlrmSemantics

- removed unused var NetXAResource#numXid

- removed unused var ClientBaseDataSourceRoot#globaltraceFileSuffixIndex

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnection.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnectionReply.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAResource.java
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSourceRoot.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java?rev=1463080&r1=1463079&r2=1463080&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java Mon Apr  1 03:59:38 2013
@@ -32,8 +32,6 @@ import org.apache.derby.shared.common.re
 
 public class Configuration {
 
-
-    public static int traceFileSuffixIndex__ = 0;
     public static final String jreLevel;// = "1.3.0"; // default level if unable to read
     public static final int jreLevelMajor;// = 1;
     public static final int jreLevelMinor;// = 3;
@@ -41,9 +39,6 @@ public class Configuration {
     private Configuration() {
     }
 
-    public static boolean[] enableConnectivityToTargetServer__;
-    public static boolean jvmSupportsMicrosClock__ = false;
-
     // -------------------------- versioning -------------------------------------
 
     private static ProductVersionHolder dncProductVersionHolder__;
@@ -73,12 +68,17 @@ public class Configuration {
     // If we have to change the package version in the future then we can.
     public static final String dncPackageVersion = null;
 
-    // for Driver.jdbcCompliant()
+    // for ClientDriver.jdbcCompliant()
     public final static boolean jdbcCompliant = true;
 
-    // for Driver.getCompatibileJREVersions()
-    public final static String[] dncCompatibleJREVersions =
-            {"1.5", "1.6", "1.7"};
+    private final static String[] dncCompatibleJREVersions =
+            {"1.5", "1.6", "1.7", "1.8"};
+
+    public static String[] getDncCompatibleJREVersions() {
+        String[] cpy = new String[dncCompatibleJREVersions.length];
+        System.arraycopy(dncCompatibleJREVersions, 0, cpy, 0, cpy.length);
+        return cpy;
+    }
 
     //---------------------- database URL protocols ------------------------------
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java?rev=1463080&r1=1463079&r2=1463080&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java Mon Apr  1 03:59:38 2013
@@ -80,9 +80,10 @@ public abstract class Version {
             printWriter.println(header + "Driver: " + getDriverNameAndVersion());
 
             printWriter.print(header + "Compatible JRE versions: { ");
-            for (int i = 0; i < Configuration.dncCompatibleJREVersions.length; i++) {
-                printWriter.print(Configuration.dncCompatibleJREVersions[i]);
-                if (i != Configuration.dncCompatibleJREVersions.length - 1) {
+            String [] cv = Configuration.getDncCompatibleJREVersions();
+            for (int i = 0; i < cv.length; i++) {
+                printWriter.print(cv[i]);
+                if (i != cv.length - 1) {
                     printWriter.print(", ");
                 }
             }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java?rev=1463080&r1=1463079&r2=1463080&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java Mon Apr  1 03:59:38 2013
@@ -23,12 +23,14 @@ package org.apache.derby.client.net;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.sql.SQLException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import javax.transaction.xa.Xid;
 import org.apache.derby.client.am.CallableStatement;
 import org.apache.derby.client.am.DatabaseMetaData;
 import org.apache.derby.client.am.DisconnectException;
 import org.apache.derby.client.am.EncryptionManager;
 import org.apache.derby.client.am.PreparedStatement;
-import org.apache.derby.client.am.ProductLevel;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.shared.common.reference.MessageId;
@@ -38,6 +40,7 @@ import org.apache.derby.iapi.reference.A
 import org.apache.derby.jdbc.ClientBaseDataSourceRoot;
 import org.apache.derby.jdbc.ClientDriver;
 import org.apache.derby.client.ClientPooledConnection;
+import org.apache.derby.jdbc.ClientDataSourceInterface;
 
 import org.apache.derby.shared.common.reference.SQLState;
 import org.apache.derby.shared.common.sanity.SanityManager;
@@ -45,7 +48,7 @@ import org.apache.derby.shared.common.sa
 public class NetConnection extends org.apache.derby.client.am.Connection {
     
     // Use this to get internationalized strings...
-    protected static MessageUtil msgutil = SqlException.getMessageUtil();
+    protected static final MessageUtil msgutil = SqlException.getMessageUtil();
 
     protected NetAgent netAgent_;
     //contains a reference to the PooledConnection from which this created 
@@ -85,11 +88,6 @@ public class NetConnection extends org.a
     protected int targetRsyncmgr_ = NetConfiguration.MGRLVL_NA;
     protected int targetUnicodemgr_ = CcsidManager.UTF8_CCSID;
 
-    // this is the external name of the target server.
-    // it is set by the parseExcsatrd method but not really used for much at this
-    // time.  one possible use is for logging purposes and in the future it
-    // may be placed in the trace.
-    String targetExtnam_;
     String extnam_;
 
     // Server Class Name of the target server returned in excsatrd.
@@ -116,7 +114,7 @@ public class NetConnection extends org.a
 
     // Keys used for encryption.
     transient byte[] publicKey_;
-    transient byte[] targetPublicKey_;
+    private transient byte[] targetPublicKey_;
 
     // Seeds used for strong password substitute generation (USRSSBPWD)
     transient byte[] sourceSeed_;   // Client seed
@@ -170,10 +168,8 @@ public class NetConnection extends org.a
 
     protected byte[] cnntkn_ = null;
 
-    // resource manager Id for XA Connections.
-    private int rmId_ = 0;
     protected NetXAResource xares_ = null;
-    protected java.util.Hashtable indoubtTransactions_ = null;
+    private HashMap<Xid, NetIndoubtTransaction> indoubtTransactions_ = null;
     protected int currXACallInfoOffset_ = 0;
     private short seqNo_ = 1;
 
@@ -238,7 +234,7 @@ public class NetConnection extends org.a
         this.pooledConnection_ = null;
         this.closeStatementsOnClose = true;
         netAgent_ = (NetAgent) super.agent_;
-        initialize(password, dataSource, rmId, isXAConn);
+        initialize(password, dataSource, isXAConn);
     }
 
     public NetConnection(NetLogWriter netLogWriter,
@@ -259,13 +255,13 @@ public class NetConnection extends org.a
         productID_ = targetSrvrlslv_;
         super.completeConnect();
     }
-    
+
     // For JDBC 2 Connections
     /**
      * This constructor is called from the ClientPooledConnection object 
      * to enable the NetConnection to pass <code>this</code> on to the associated 
      * prepared statement object thus enabling the prepared statement object 
-     * to inturn  raise the statement events to the ClientPooledConnection object
+     * to in turn raise the statement events to the ClientPooledConnection object
      * @param netLogWriter NetLogWriter object associated with this connection
      * @param user         user id for this connection
      * @param password     password for this connection
@@ -289,21 +285,19 @@ public class NetConnection extends org.a
                          ClientPooledConnection cpc) throws SqlException {
         super(netLogWriter, user, password, isXAConn, dataSource);
         netAgent_ = (NetAgent) super.agent_;
-        initialize(password, dataSource, rmId, isXAConn);
+        initialize(password, dataSource, isXAConn);
         this.pooledConnection_=cpc;
         this.closeStatementsOnClose = !cpc.isStatementPoolingEnabled();
     }
 
     private void initialize(String password,
                             ClientBaseDataSourceRoot dataSource,
-                            int rmId,
                             boolean isXAConn) throws SqlException {
         securityMechanism_ = dataSource.getSecurityMechanism(password);
 
         setDeferredResetPassword(password);
         checkDatabaseName();
         dataSource_ = dataSource;
-        this.rmId_ = rmId;
         this.isXAConnection_ = isXAConn;
         flowConnect(password, securityMechanism_);
         // it's possible that the internal Driver.connect() calls returned null,
@@ -335,7 +329,6 @@ public class NetConnection extends org.a
         // do not reset managers on a connection reset.  this information shouldn't
         // change and can be used to check secmec support.
 
-        targetExtnam_ = null;
         targetSrvclsnm_ = null;
         targetSrvnam_ = null;
         targetSrvrlslv_ = null;
@@ -381,7 +374,7 @@ public class NetConnection extends org.a
         }
     }
 
-    public void completeConnect() throws SqlException {
+    public final void completeConnect() throws SqlException {
         super.completeConnect();
     }
 
@@ -390,7 +383,7 @@ public class NetConnection extends org.a
         super.completeReset(isDeferredReset, closeStatementsOnClose, xares_);
     }
 
-    public void flowConnect(String password,
+    public final void flowConnect(String password,
                             int securityMechanism) throws SqlException {
         netAgent_ = (NetAgent) super.agent_;
         constructExtnam();
@@ -472,7 +465,7 @@ public class NetConnection extends org.a
         }
     }
     
-    protected void flowSimpleConnect() throws SqlException {
+    protected final void flowSimpleConnect() throws SqlException {
         netAgent_ = (NetAgent) super.agent_;
         constructExtnam();
         // these calls need to be after newing up the agent
@@ -934,11 +927,9 @@ public class NetConnection extends org.a
 
     //-------------------parse callback methods--------------------------------
 
-    void setServerAttributeData(String extnam,
-                                String srvclsnm,
+    void setServerAttributeData(String srvclsnm,
                                 String srvnam,
                                 String srvrlslv) {
-        targetExtnam_ = extnam;          // any of these could be null
         targetSrvclsnm_ = srvclsnm;      // since then can be optionally returned from the
         targetSrvnam_ = srvnam;          // server
         targetSrvrlslv_ = srvrlslv;
@@ -1146,10 +1137,9 @@ public class NetConnection extends org.a
     // by the secmgr.
     private void checkSecmgrForSecmecSupport(int securityMechanism) throws SqlException {
         boolean secmecSupported = false;
-        int[] supportedSecmecs = null;
 
         // Point to a list (array) of supported security mechanisms.
-        supportedSecmecs = NetConfiguration.SECMGR_SECMECS;
+        int[] supportedSecmecs = NetConfiguration.SECMGR_SECMECS;
 
         // check to see if the security mechanism is on the supported list.
         for (int i = 0; (i < supportedSecmecs.length) && (!secmecSupported); i++) {
@@ -1240,13 +1230,6 @@ public class NetConnection extends org.a
     // starts with '0' thru '9', it will be mapped to 'G' thru 'P'.
     // Reason for mapping the IP address is in order to use the crrtkn as the LUWID when using SNA in a hop site.
     protected void constructCrrtkn() throws SqlException {
-        byte[] localAddressBytes = null;
-        long time = 0;
-        int num = 0;
-        int halfByte = 0;
-        int i = 0;
-        int j = 0;
-
         // allocate the crrtkn array.
         if (crrtkn_ == null) {
             crrtkn_ = new byte[19];
@@ -1254,16 +1237,16 @@ public class NetConnection extends org.a
             java.util.Arrays.fill(crrtkn_, (byte) 0);
         }
 
-        localAddressBytes = netAgent_.socket_.getLocalAddress().getAddress();
+        byte [] localAddressBytes = netAgent_.socket_.getLocalAddress().getAddress();
 
         // IP addresses are returned in a 4 byte array.
         // Obtain the character representation of each half byte.
-        for (i = 0, j = 0; i < 4; i++, j += 2) {
+        for (int i = 0, j = 0; i < 4; i++, j += 2) {
 
             // since a byte is signed in java, convert any negative
             // numbers to positive before shifting.
-            num = localAddressBytes[i] < 0 ? localAddressBytes[i] + 256 : localAddressBytes[i];
-            halfByte = (num >> 4) & 0x0f;
+            int num = localAddressBytes[i] < 0 ? localAddressBytes[i] + 256 : localAddressBytes[i];
+            int halfByte = (num >> 4) & 0x0f;
 
             // map 0 to G
             // The first digit of the IP address is is replaced by
@@ -1286,9 +1269,9 @@ public class NetConnection extends org.a
         // Java returns port numbers in an int so the value is not negative.
         // Get the character representation by converting the
         // 4 low order half bytes to the character representation.
-        num = netAgent_.socket_.getLocalPort();
+        int num = netAgent_.socket_.getLocalPort();
 
-        halfByte = (num >> 12) & 0x0f;
+        int halfByte = (num >> 12) & 0x0f;
         crrtkn_[9] = netAgent_.getCurrentCcsidManager().numToSnaRequiredCrrtknChar_[halfByte];
         halfByte = (num >> 8) & 0x0f;
         crrtkn_[10] = netAgent_.getCurrentCcsidManager().numToCharRepresentation_[halfByte];
@@ -1301,9 +1284,9 @@ public class NetConnection extends org.a
         // crrtkn unique, which is usually the time stamp/process id.
         // If the new time stamp is the
         // same as one of the already created ones, then recreate the time stamp.
-        time = System.currentTimeMillis();
+        long time = System.currentTimeMillis();
 
-        for (i = 0; i < 6; i++) {
+        for (int i = 0; i < 6; i++) {
             // store 6 bytes of 8 byte time into crrtkn
             crrtkn_[i + 13] = (byte) (time >>> (40 - (i * 8)));
         }
@@ -1437,9 +1420,9 @@ public class NetConnection extends org.a
             String dataSourceUserName = dataSource_.getUser();
             if (!dataSourceUserName.equals("") &&
                 userName.equalsIgnoreCase(
-                    dataSource_.propertyDefault_user) &&
+                    ClientDataSourceInterface.propertyDefault_user) &&
                 !dataSourceUserName.equalsIgnoreCase(
-                    dataSource_.propertyDefault_user))
+                    ClientDataSourceInterface.propertyDefault_user))
             {
                 userName = dataSourceUserName;
             }
@@ -1607,7 +1590,9 @@ public class NetConnection extends org.a
         super.readTransactionStart();
     }
 
-    public void setIndoubtTransactions(java.util.Hashtable indoubtTransactions) {
+    public void setIndoubtTransactions(
+            HashMap<Xid, NetIndoubtTransaction> indoubtTransactions) {
+
         if (isXAConnection_) {
             if (indoubtTransactions_ != null) {
                 indoubtTransactions_.clear();
@@ -1616,6 +1601,15 @@ public class NetConnection extends org.a
         }
     }
 
+    public NetIndoubtTransaction getIndoubtTransaction(Xid xid) {
+        return indoubtTransactions_.get(xid);
+    }
+
+    public Xid[] getIndoubtTransactionIds() {
+        Xid[] result = new Xid[0];
+        return indoubtTransactions_.keySet().toArray(result);
+    }
+
     protected void setReadOnlyTransactionFlag(boolean flag) {
         readOnlyTransaction_ = flag;
     }
@@ -1655,7 +1649,9 @@ public class NetConnection extends org.a
     }
 
     public byte[] getTargetPublicKey() {
-        return targetPublicKey_;
+        byte[] cpy = new byte[targetPublicKey_.length];
+        System.arraycopy(targetPublicKey_, 0, cpy, 0, cpy.length);
+        return cpy;
     }
 
     public String getProductID() {
@@ -1674,7 +1670,7 @@ public class NetConnection extends org.a
     /**
      * @return Returns the connectionNull.
      */
-    public boolean isConnectionNull() {
+    public final boolean isConnectionNull() {
         return connectionNull;
     }
     /**
@@ -1792,11 +1788,6 @@ public class NetConnection extends org.a
     synchronized public void close() throws SQLException {
         // call super.close*() to do the close*
         super.close();
-        if (!isXAConnection_)
-            return;
-        if (isOpen()) {
-            return; // still open, return
-        }
     }
     
     /**
@@ -1805,11 +1796,6 @@ public class NetConnection extends org.a
     synchronized public void closeX() throws SQLException {
         // call super.close*() to do the close*
         super.closeX();
-        if (!isXAConnection_)
-            return;
-        if (isOpen()) {
-            return; // still open, return
-        }
     }
     
     /**
@@ -1818,11 +1804,6 @@ public class NetConnection extends org.a
     synchronized public void closeForReuse() throws SqlException {
         // call super.close*() to do the close*
         super.closeForReuse(closeStatementsOnClose);
-        if (!isXAConnection_)
-            return;
-        if (isOpen()) {
-            return; // still open, return
-        }
     }
     
     /**
@@ -1832,12 +1813,6 @@ public class NetConnection extends org.a
     synchronized public void closeResources() throws SQLException {
         // call super.close*() to do the close*
         super.closeResources();
-        if (!isXAConnection_)
-            return;
-        
-        if (isOpen()) {
-            return; // still open, return
-        }
     }
     
     

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java?rev=1463080&r1=1463079&r2=1463080&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java Mon Apr  1 03:59:38 2013
@@ -21,6 +21,7 @@
 
 package org.apache.derby.client.net;
 
+import java.util.HashMap;
 import javax.transaction.xa.Xid;
 
 import org.apache.derby.client.am.Connection;
@@ -31,7 +32,6 @@ import org.apache.derby.client.am.Discon
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.Sqlca;
-import java.io.UnsupportedEncodingException;
 import org.apache.derby.client.am.UnitOfWorkListener;
 
 import org.apache.derby.shared.common.error.ExceptionSeverity;
@@ -39,6 +39,7 @@ import org.apache.derby.shared.common.er
 import org.apache.derby.shared.common.reference.SQLState;
 import org.apache.derby.shared.common.reference.MessageId;
 import org.apache.derby.shared.common.i18n.MessageUtil;
+import org.apache.derby.shared.common.sanity.SanityManager;
 
 
 public class NetConnectionReply extends Reply
@@ -146,10 +147,10 @@ public class NetConnectionReply extends 
     // This method handles the parsing of all command replies and reply data
     // for the rdbcmm command.
     private void parseRDBCMMreply(ConnectionCallbackInterface connection) throws DisconnectException {
-        int peekCP = parseTypdefsOrMgrlvlovrs();
+        parseTypdefsOrMgrlvlovrs();
 
         parseENDUOWRM(connection);
-        peekCP = parseTypdefsOrMgrlvlovrs();
+        int peekCP = parseTypdefsOrMgrlvlovrs();
 
         if (peekCP == CodePoint.SQLCARD) {
             NetSqlca netSqlca = parseSQLCARD(null);
@@ -163,10 +164,10 @@ public class NetConnectionReply extends 
     // This method handles the parsing of all command replies and reply data
     // for the rdbrllbck command.
     private void parseRDBRLLBCKreply(ConnectionCallbackInterface connection) throws DisconnectException {
-        int peekCP = parseTypdefsOrMgrlvlovrs();
+        parseTypdefsOrMgrlvlovrs();
 
         parseENDUOWRM(connection);
-        peekCP = parseTypdefsOrMgrlvlovrs();
+        int peekCP = parseTypdefsOrMgrlvlovrs();
 
         if (peekCP == CodePoint.SQLCARD) {
             NetSqlca netSqlca = parseSQLCARD(null);
@@ -213,10 +214,12 @@ public class NetConnectionReply extends 
         netAgent_.exceptionConvertingRdbnam = null;
 
         peekCP = peekCodePoint();
-        if (peekCP == Reply.END_OF_SAME_ID_CHAIN) {
-            return;
-        }
 
+        if (SanityManager.DEBUG) {
+            if (peekCP != Reply.END_OF_SAME_ID_CHAIN) {
+                SanityManager.THROWASSERT("expected END_OF_SAME_ID_CHAIN");
+            }
+        }
     }
 
     // Parse the reply for the Security Check Command.
@@ -239,8 +242,7 @@ public class NetConnectionReply extends 
             // incorrect but consider it a conversation protocol error
             // 0x03 - OBJDSS sent when not allowed.
             //parseSECTKN (true);
-            boolean done = false;
-            byte[] bytes = parseSECTKN(false);
+            parseSECTKN(false);
         }
     }
 
@@ -1652,8 +1654,6 @@ public class NetConnectionReply extends 
         int svrcod = CodePoint.SVRCOD_INFO;
         boolean rdbnamReceived = false;
         String rdbnam = null;
-        boolean srvdgnReceived = false;
-        byte[] srvdgn = null;
         boolean codpntReceived = false;
         int codpnt = 0;
 
@@ -1720,7 +1720,6 @@ public class NetConnectionReply extends 
         boolean svrcodReceived = false;
         int svrcod = CodePoint.SVRCOD_INFO;
         boolean rdbnamReceived = false;
-        String rdbnam = null;
 
         parseLengthAndMatchCodePoint(CodePoint.ABNUOWRM);
         pushLengthOnCollectionStack();
@@ -1743,7 +1742,7 @@ public class NetConnectionReply extends 
                 // not having to convert this to a string is a time saver also.
                 foundInPass = true;
                 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived);
-                rdbnam = parseRDBNAM(true);
+                String rdbnam = parseRDBNAM(true);
                 peekCP = peekCodePoint();
             }
 
@@ -1778,7 +1777,6 @@ public class NetConnectionReply extends 
     // SRVRLSLV - optional
     private void parseEXCSATRD(NetConnection netConnection) throws DisconnectException {
         boolean extnamReceived = false;
-        String extnam = null;
         boolean mgrlvllsReceived = false;
         boolean srvclsnmReceived = false;
         String srvclsnm = null;
@@ -1802,11 +1800,9 @@ public class NetConnectionReply extends 
                 // or activates to run the DDM server.
                 // No semantic meaning is assigned to external names in DDM.
                 // External names are transmitted to aid in problem determination.
-                // This driver will save the external name of the target (the
-                // driver may use it for logging purposes later).
                 foundInPass = true;
                 extnamReceived = checkAndGetReceivedFlag(extnamReceived);
-                extnam = parseEXTNAM();
+                String extnam = parseEXTNAM();
                 peekCP = peekCodePoint();
             }
 
@@ -1862,13 +1858,12 @@ public class NetConnectionReply extends 
         }
         popCollectionStack();
         // according the the DDM book, all these instance variables are optional
-        netConnection.setServerAttributeData(extnam, srvclsnm, srvnam, srvrlslv);
+        netConnection.setServerAttributeData(srvclsnm, srvnam, srvrlslv);
     }
 
     // Must make a version that does not change state in the associated connection
     private void parseDummyEXCSATRD(NetConnection netConnection) throws DisconnectException {
         boolean extnamReceived = false;
-        String extnam = null;
         boolean mgrlvllsReceived = false;
         boolean srvclsnmReceived = false;
         String srvclsnm = null;
@@ -1896,7 +1891,7 @@ public class NetConnectionReply extends 
                 // driver may use it for logging purposes later).
                 foundInPass = true;
                 extnamReceived = checkAndGetReceivedFlag(extnamReceived);
-                extnam = parseEXTNAM();
+                String extnam = parseEXTNAM();
                 peekCP = peekCodePoint();
             }
 
@@ -2428,7 +2423,8 @@ public class NetConnectionReply extends 
         return null;
     }
 
-    protected java.util.Hashtable parseIndoubtList() throws DisconnectException {
+    protected HashMap<Xid, NetIndoubtTransaction> parseIndoubtList()
+            throws DisconnectException {
         return null;
     }
 
@@ -2606,16 +2602,16 @@ public class NetConnectionReply extends 
                     sqlcode,
                     sqlstate,
                     sqlerrproc);
+            parseSQLCAXGRP(netSqlca);
+
+            if (netAgent_.targetSqlam_ >= NetConfiguration.MGRLVL_7) {
+                netSqlca.setRowsetRowCount(parseSQLDIAGGRP(rowsetSqlca));
+            }
         }
         catch(SqlException sqle)
         {
             throw new DisconnectException(netAgent_,sqle);
         }
-        parseSQLCAXGRP(netSqlca);
-
-        if (netAgent_.targetSqlam_ >= NetConfiguration.MGRLVL_7) {
-            netSqlca.setRowsetRowCount(parseSQLDIAGGRP(rowsetSqlca));
-        }
 
         return netSqlca;
     }
@@ -2691,7 +2687,7 @@ public class NetConnectionReply extends 
         }
 
 
-        int sqlerrmcCcsid = 0;
+        int sqlerrmcCcsid;
         byte[] sqlerrmc = readFastLDBytes();
         if (sqlerrmc != null) {
             sqlerrmcCcsid = netAgent_.targetTypdef_.getCcsidMbc();
@@ -2827,7 +2823,6 @@ public class NetConnectionReply extends 
                 break;
             default:
                 // should never be in this default case...
-                cpValue = 0;
                 break;
             }
             agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_,
@@ -2876,8 +2871,8 @@ public class NetConnectionReply extends 
     }
 
     private void doMgrlvlrmSemantics(int[] nameList, int[] levelList) throws DisconnectException {
-        StringBuffer managerNames = new StringBuffer(100);
-        StringBuffer managerLevels = new StringBuffer(100);
+        StringBuilder managerNames = new StringBuilder(100);
+        StringBuilder managerLevels = new StringBuilder(100);
 
         int count = nameList.length;
         for (int i = 0; i < count; i++) {
@@ -3203,10 +3198,8 @@ public class NetConnectionReply extends 
 
     private String parseFastNVCMorNVCS() throws DisconnectException {
         String stringToBeSet = null;
-        int vcm_length = 0;
-        int vcs_length = 0;
         if (readFastUnsignedByte() != CodePoint.NULLDATA) {
-            vcm_length = readFastUnsignedShort();
+            int vcm_length = readFastUnsignedShort();
             if (vcm_length > 0) {
                 stringToBeSet = readFastString(vcm_length, netAgent_.targetTypdef_.getCcsidMbcEncoding());
             }
@@ -3218,7 +3211,7 @@ public class NetConnectionReply extends 
             }
         } else {
             if (readFastUnsignedByte() != CodePoint.NULLDATA) {
-                vcs_length = readFastUnsignedShort();
+                int vcs_length = readFastUnsignedShort();
                 if (vcs_length > 0) {
                     stringToBeSet = readFastString(vcs_length, netAgent_.targetTypdef_.getCcsidSbcEncoding());
                 }
@@ -3228,10 +3221,8 @@ public class NetConnectionReply extends 
     }
 
     private void skipFastNVCMorNVCS() throws DisconnectException {
-        int vcm_length = 0;
-        int vcs_length = 0;
         if (readFastUnsignedByte() != CodePoint.NULLDATA) {
-            vcm_length = readFastUnsignedShort();
+            int vcm_length = readFastUnsignedShort();
             if (vcm_length > 0)
             //stringToBeSet = readString (vcm_length, netAgent_.targetTypdef_.getCcsidMbcEncoding());
             {
@@ -3245,7 +3236,7 @@ public class NetConnectionReply extends 
             }
         } else {
             if (readFastUnsignedByte() != CodePoint.NULLDATA) {
-                vcs_length = readFastUnsignedShort();
+                int vcs_length = readFastUnsignedShort();
                 if (vcs_length > 0)
                 //stringToBeSet = readString (vcs_length, netAgent_.targetTypdef_.getCcsidSbcEncoding());
                 {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnection.java?rev=1463080&r1=1463079&r2=1463080&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnection.java Mon Apr  1 03:59:38 2013
@@ -143,8 +143,7 @@ public class NetXAConnection {    
     }
 
     public byte[] getUOWID(Xid xid) {
-        NetIndoubtTransaction indoubtTxn = 
-                (NetIndoubtTransaction) netCon.indoubtTransactions_.get(xid);
+        NetIndoubtTransaction indoubtTxn = netCon.getIndoubtTransaction(xid);
         if (indoubtTxn == null) {
             return null;
         }
@@ -153,7 +152,7 @@ public class NetXAConnection {    
     }
 
     public int getPort(Xid xid) {
-        NetIndoubtTransaction indoubtTxn = (NetIndoubtTransaction) netCon.indoubtTransactions_.get(xid);
+        NetIndoubtTransaction indoubtTxn = netCon.getIndoubtTransaction(xid);
         if (indoubtTxn == null) {
             return -1;
         }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnectionReply.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnectionReply.java?rev=1463080&r1=1463079&r2=1463080&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnectionReply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAConnectionReply.java Mon Apr  1 03:59:38 2013
@@ -21,6 +21,7 @@
 
 package org.apache.derby.client.net;
 
+import java.util.HashMap;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 
@@ -290,22 +291,20 @@ public class NetXAConnectionReply extend
         return new org.apache.derby.client.ClientXid(formatId, gtrid, bqual);
     }
 
-    protected java.util.Hashtable parseIndoubtList() throws DisconnectException {
-        boolean found = false;
+    protected HashMap<Xid, NetIndoubtTransaction> parseIndoubtList()
+            throws DisconnectException {
         int port = 0;
-        int numXid = 0;
         String sIpAddr = null;
-        int peekCP = peekCodePoint();
+        peekCodePoint();
         parseLengthAndMatchCodePoint(CodePoint.PRPHRCLST);
-        peekCP = peekCodePoint();
+        int peekCP = peekCodePoint();
         if (peekCP == CodePoint.XIDCNT) {
-            found = true;
-            numXid = parseXIDCNT();
+            int numXid = parseXIDCNT();
             peekCP = peekCodePoint();
         }
 
-        java.util.Hashtable<Xid, NetIndoubtTransaction> indoubtTransactions =
-                new java.util.Hashtable<Xid, NetIndoubtTransaction>();
+        java.util.HashMap<Xid, NetIndoubtTransaction> indoubtTransactions =
+                new java.util.HashMap<Xid, NetIndoubtTransaction>();
         while (peekCP == CodePoint.XID) {
             Xid xid = parseXID();
             indoubtTransactions.put(xid, new NetIndoubtTransaction(xid, null, null, null, sIpAddr, port));

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAResource.java?rev=1463080&r1=1463079&r2=1463080&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAResource.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXAResource.java Mon Apr  1 03:59:38 2013
@@ -436,7 +436,6 @@ public class NetXAResource implements XA
         }
 
         Xid[] xidList = null;
-        int numXid = 0;
 
         NetXACallInfo callInfo = callInfoArray_[conn_.currXACallInfoOffset_];
         callInfo.xaFlags_ = flag;
@@ -454,15 +453,8 @@ public class NetXAResource implements XA
                 callInfo.xaRetVal_ = XAResource.XA_OK; // re-initialize XARETVAL
             }
             netAgent.endReadChain();
-            if (conn_.indoubtTransactions_ != null) {
-                numXid = conn_.indoubtTransactions_.size();
-                xidList = new Xid[numXid];
-                int i = 0;
-                for (Enumeration e = conn_.indoubtTransactions_.keys();
-                     e.hasMoreElements(); i++) {
-                    xidList[i] = (Xid) e.nextElement();
-                }
-            }
+            xidList = conn_.getIndoubtTransactionIds();
+
         } catch (SqlException sqle) {
             rc = getSqlExceptionXAErrorCode(sqle);
             exceptionsOnXA = org.apache.derby.client.am.Utils.accumulateSQLException

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSourceRoot.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSourceRoot.java?rev=1463080&r1=1463079&r2=1463080&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSourceRoot.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSourceRoot.java Mon Apr  1 03:59:38 2013
@@ -545,9 +545,6 @@ public abstract class ClientBaseDataSour
         String logWriterInUseSuffix,
         int traceFileSuffixIndex) throws SqlException {
 
-        int globaltraceFileSuffixIndex =
-            Configuration.traceFileSuffixIndex__++;
-
         // compute regular dnc log writer if there is any
         LogWriter dncLogWriter = computeDncLogWriter(
             logWriter,