db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1465193 - in /db/derby/code/trunk/java/client/org/apache/derby/client: ./ am/ net/
Date Sat, 06 Apr 2013 05:47:59 GMT
Author: dag
Date: Sat Apr  6 05:47:58 2013
New Revision: 1465193

URL: http://svn.apache.org/r1465193
Log:
DERBY-6125 Code clean up in client driver.
Patch derby-6125-05-d; details:

** ClientXid

- reworked ClientXid#equals to find favor with FindBugs: now tests for null and wrong type.
  The old version would get classcastexception if a wrong type object was compared.

- made ClientXid#getData clone the result - it is a byte array

** Section

- clone bytes in Section#setPKGNAMCBytes to avoid having a package private variable
  wriable from outside the package (it's an array).

- make Section#getPKGNAMCBytes return a clone

** Sqlca

- removed unnecessary a priori allocation to Sqlca#sqlErrd_.

- made Sqlca#sqlWarn_ private

- changed #getSqlWarn to return String since all its uses need a String anyway.

- made Sqlca#getSqlErrd private

- simplified implementation of Sqlca#getSqlWarn

- made Sqlca#rowsetRowCount_ private

- made Sqlca#containsSqlcax_ private

- made Sqlca#sqlErrmcMessages_ private

- removed argument sqlErrpBytes from Sqlca#setContainsSqlcax (only called once; with null).

- removed argument sqlErrpBytes from Sqlca#resetRowsetSqlca  (only called with null).

- introduced Sqlca#getReturnValue in Statement#completeExecute instead
  of allowing access to sqlca.getSqlErrd()[0]

- removed unused Sqlca#sqlErrmcCcsid_

- introduced public String Sqlca#formatSqlErrd as replacement for
  direct access to Sqlca#sqlErrd_.

** NetSqlca

- made NetSqlca#setSqlwarnBytes package private

- made NetSqlca#setSqlerrmcBytes package private and removed its
  argument sqlErrmcCcsid

- made NetSqlca#setSqlerrd package private

- removed unnecessary test for BIG_ENDIAN in NetSqlca#getRowCount: the
  protocol always uses big endian (SignedBinary.BIG_ENDIAN = 1 is final).

- removed unnecessary type argument to NetSqlca#getRowCount now that endian test is no longer
done

** Statement

- made Statement#materialStatement_ private; new accessors

** NetConnection

- removed unnecessary default NetConnection finalizer

- three methods in NetConnection do nothing except calling the method with the same name in
the super class:

  - close()
  - closeX()
  - closeResources()

  Remove them and let NetConnection inherit them from its super class.

- Since we remove these methods from NetConnection, we also make
  Connection.closeX() private and unsynchronized, as it will only be
  called from Connection.close().

- NetConnection's closeForReuse() method doesn't have any callers;
  remove that one too.

- NetConnection.completeConnect() doesn't actually do anything except
  calling super.completeConnect(). Remove the override and make the
  super method final instead.

** NetXAConnection

- removed potentially harmful finalizer in NetXAConnection: it calls a
  finalizer for another class (NetConnection). FindBugs advice on this
  (quote):

  "If a connected set of objects beings finalizable, then the VM will
  invoke the finalize method on all the finalizable object, possibly
  at the same time in different threads. Thus, it is a particularly
  bad idea, in the finalize method for a class X, invoke finalize on
  objects referenced by X, because they may already be getting
  finalized in a separate thread. "

  It also neglected to call super.finalize()...

** Typdef

- made Typdef#FdocaSimpleDataArray private

- removed unused TypDef#getByteOrder

- made Typdef#environmentTables_ private

** SqlException

- made SqlException#SQLExceptionFactory package private (was protected)

** EncryptionManager

- removed unused methods EncryptionManager#setInitVector and #setSecKey

** NetXACallInfo

- removed unused NetXACallInfo#getCorrelatorToken

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/ClientXid.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Section.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/SqlException.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Sqlca.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.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/NetCursor.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetReply.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetRequest.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetSqlca.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXACallInfo.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/Typdef.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/ClientXid.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/ClientXid.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/ClientXid.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/ClientXid.java Sat Apr  6 05:47:58
2013
@@ -21,6 +21,8 @@
 package org.apache.derby.client;
 
 import javax.transaction.xa.Xid;
+import org.apache.derby.client.net.NetXAResource;
+import org.apache.derby.shared.common.sanity.SanityManager;
 
 public class ClientXid implements Xid {
     //
@@ -182,7 +184,7 @@ public class ClientXid implements Xid {
     // return fields of Xid
     //
     public byte[] getData() {
-        return data_;
+        return data_.clone();
     }
 
     public int getGtridLength() {
@@ -201,6 +203,19 @@ public class ClientXid implements Xid {
     }
 
     public boolean equals(Object obj) {
-        return org.apache.derby.client.net.NetXAResource.xidsEqual(this, (javax.transaction.xa.Xid)
obj);
+        if (obj == null) {
+            return false;
+        }
+
+        if(obj instanceof Xid) {
+            return NetXAResource.xidsEqual(this, (Xid)obj);
+        } else {
+            if (SanityManager.DEBUG) {
+                SanityManager.THROWASSERT(
+                        "ClientXid#equals: object of unexpected type: " +
+                        obj.getClass().getName());
+            }
+            return false;
+        }
     }
 } // class Xid

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java Sat
Apr  6 05:47:58 2013
@@ -488,14 +488,6 @@ public class EncryptionManager {
         return plainText;
     }
 
-    public void setInitVector(byte[] initVector) {
-        token_ = initVector;
-    }
-
-    public void setSecKey(byte[] secKey) {
-        secKey_ = secKey;
-    }
-
     public void resetSecurityKeys() {
         token_ = null;
         secKey_ = null;

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java Sat
Apr  6 05:47:58 2013
@@ -149,11 +149,11 @@ public class ExceptionFormatter {
         synchronized (printWriter) {
             printWriter.println(header + " DERBY SQLCA from server");
             printWriter.println(header + " SqlCode        = " + sqlca.getSqlCode());
-            printWriter.println(header + " SqlErrd        = " + Utils.getStringFromInts(sqlca.getSqlErrd()));
+            printWriter.println(header + " SqlErrd        = " + sqlca.formatSqlErrd());
             printWriter.println(header + " SqlErrmc       = " + sqlca.getSqlErrmc());
             printWriter.println(header + " SqlErrp        = " + sqlca.getSqlErrp());
             printWriter.println(header + " SqlState       = " + sqlca.getSqlState());
-            printWriter.println(header + " SqlWarn        = " + new String(sqlca.getSqlWarn()));
+            printWriter.println(header + " SqlWarn        = " + sqlca.getSqlWarn());
         }
     }
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Section.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Section.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Section.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Section.java Sat Apr  6 05:47:58
2013
@@ -64,13 +64,21 @@ public class Section {
     }
 
     /**
-     * Store the Packagename and consistency token information for reuse. Case 1: if it is
generated section, just store
-     * the byte array in PKGNAMCBytes Case 2: for not a generated section, information is
stored in the correct byte
-     * array depending on the holdability in SectionManager
+     * Store the Packagename and consistency token information for
+     * reuse.
+     * <ul>
+     *    <li>Case 1: if it is generated section, just store the byte
+     *        array in PKGNAMCBytes.</li>
+     *    <li>Case 2: for not a generated section, information is
+     *        stored in the correct byte array depending on the holdability
+     *        in SectionManager.</li>
+     * </ul>
+     * @arg b the Packagename and consistency token information to store;
+     *      should never be null.
      */
     public void setPKGNAMCBytes(byte[] b) {
         if (isGenerated) {
-            PKGNAMCBytes = b;
+            PKGNAMCBytes = b.clone();
         } else {
             agent_.sectionManager_.setPKGNAMCBytes(b, resultSetHoldability_);
         }
@@ -80,7 +88,9 @@ public class Section {
      * retrieve the package name and consistency token information
      */
     public byte[] getPKGNAMCBytes() {
-        return PKGNAMCBytes;
+        return PKGNAMCBytes != null ?
+               PKGNAMCBytes.clone() :
+               null;
     }
 
     public String getPackageName() {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/SqlException.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/SqlException.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/SqlException.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/SqlException.java Sat Apr 
6 05:47:58 2013
@@ -89,10 +89,12 @@ public class SqlException extends Except
     public static final String CLIENT_MESSAGE_RESOURCE_NAME =
         "org.apache.derby.loc.clientmessages";
     
-    //SQLException factory initialised with default factory
-    //It will be over written by the SQLException factory of the 
-    //supported jdbc version    
-    protected static SQLExceptionFactory 
+    /**
+     * SQLException factory is initialized with default factory.
+     * It will be over written by the SQLException factory of the
+     * supported JDBC version.
+     */
+    static SQLExceptionFactory
             exceptionFactory = new SQLExceptionFactory ();
     
     /** 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Sqlca.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Sqlca.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Sqlca.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Sqlca.java Sat Apr  6 05:47:58
2013
@@ -21,6 +21,7 @@
 
 package org.apache.derby.client.am;
 
+import java.io.UnsupportedEncodingException;
 import java.sql.DataTruncation;
 import org.apache.derby.client.net.Typdef;
 import org.apache.derby.shared.common.error.ExceptionSeverity;
@@ -43,13 +44,13 @@ public abstract class Sqlca {
     /** A string representation of <code>sqlErrmcBytes_</code>. */
     private String sqlErrmc_;
     /** Array of errmc strings for each message in the chain. */
-    protected String[] sqlErrmcMessages_;
+    private String[] sqlErrmcMessages_;
     /** SQL states for all the messages in the exception chain. */
     private String[] sqlStates_;
     // contain an error token
-    protected String sqlErrp_;        // function name issuing error
+    private String sqlErrp_;        // function name issuing error
     protected int[] sqlErrd_;        // 6 diagnostic Information
-    protected char[] sqlWarn_;        // 11 warning Flags
+    private String sqlWarn_;        // 11 warning Flags
     protected String sqlState_;       // SQLSTATE
 
     // raw sqlca data fields before unicode conversion
@@ -57,9 +58,8 @@ public abstract class Sqlca {
     protected byte[] sqlErrpBytes_;
     protected byte[] sqlWarnBytes_;
     
-    protected int sqlErrmcCcsid_;
-    protected boolean containsSqlcax_ = true;
-    protected long rowsetRowCount_;
+    private boolean containsSqlcax_ = true;
+    private long rowsetRowCount_;
 
     /**
      * Character sequence that separates the different messages in the errmc.
@@ -217,7 +217,7 @@ public abstract class Sqlca {
         }
     }
 
-    public int[] getSqlErrd() {
+    private int[] getSqlErrd() {
         if (sqlErrd_ != null) {
             return sqlErrd_;
         }
@@ -226,22 +226,31 @@ public abstract class Sqlca {
         return sqlErrd_;
     }
 
-    synchronized public char[] getSqlWarn() {
-        if (sqlWarn_ != null) {
-            return sqlWarn_;
-        }
+    public String formatSqlErrd() {
+        return Utils.getStringFromInts(getSqlErrd());
+    }
 
-        try {
-            if (sqlWarnBytes_ == null) {
-                sqlWarn_ = new char[]{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '
'}; // 11 blank.
+    // what is this for??
+    public int getReturnValue() {
+        return getSqlErrd()[0];
+    }
+
+    private final static String elevenBlanks = "           ";
+
+    synchronized public String getSqlWarn() {
+        if (sqlWarn_ == null) {
+            if (sqlWarnBytes_ != null) {
+                try {
+                    sqlWarn_ =
+                        bytes2String(sqlWarnBytes_, 0, sqlWarnBytes_.length);
+                } catch (UnsupportedEncodingException e) {
+                    sqlWarn_ = elevenBlanks;
+                }
             } else {
-                sqlWarn_ = bytes2String(sqlWarnBytes_, 0, sqlWarnBytes_.length).toCharArray();
+                sqlWarn_ = elevenBlanks;
             }
-            return sqlWarn_;
-        } catch (java.io.UnsupportedEncodingException e) {
-            sqlWarn_ = new char[]{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '};
// 11 blank.
-            return sqlWarn_;
         }
+        return sqlWarn_;
     }
 
     synchronized public String getSqlState() {
@@ -302,7 +311,7 @@ public abstract class Sqlca {
                 cs.setIntX(9, getSqlErrd()[4]);
                 cs.setIntX(10, getSqlErrd()[5]);
                 // SQLWarn: SQL warning flags.
-                cs.setStringX(11, new String(getSqlWarn()));
+                cs.setStringX(11, getSqlWarn());
                 // SQLState: standard SQL state.
                 cs.setStringX(12, sqlState);
                 // MessageFileName: Not used by our driver, so set to null.
@@ -480,14 +489,15 @@ public abstract class Sqlca {
         if (sqlErrd_ == null) {
             return 0L;
         }
-        long    result = sqlErrd_[ LOW_ORDER_UPDATE_COUNT ];
+        long    result = getSqlErrd()[ LOW_ORDER_UPDATE_COUNT ];
         result &= 0xFFFFFFFFL;
-        result |= ((long) sqlErrd_[ HIGH_ORDER_UPDATE_COUNT ] << 32);
+        result |= ((long) getSqlErrd()[ HIGH_ORDER_UPDATE_COUNT ] << 32);
         return result;
     }
 
     public long getRowCount() throws org.apache.derby.client.am.DisconnectException {
-        return ((long) sqlErrd_[ HIGH_ORDER_ROW_COUNT ] << 32) + sqlErrd_[ LOW_ORDER_ROW_COUNT
];
+        return ((long) getSqlErrd()[ HIGH_ORDER_ROW_COUNT ] << 32) +
+                getSqlErrd()[ LOW_ORDER_ROW_COUNT ];
     }
 
     public void setContainsSqlcax(boolean containsSqlcax) {
@@ -500,12 +510,11 @@ public abstract class Sqlca {
 
     public void resetRowsetSqlca(org.apache.derby.client.am.Connection connection,
                                  int sqlCode,
-                                 String sqlState,
-                                 byte[] sqlErrpBytes) {
+                                 String sqlState) {
         connection_ = connection;
         sqlCode_ = sqlCode;
         sqlState_ = sqlState;
-        sqlErrpBytes_ = sqlErrpBytes;
+        sqlErrpBytes_ = null;
     }
 
     public void setRowsetRowCount(long rowCount) {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java Sat Apr  6 05:47:58
2013
@@ -33,7 +33,21 @@ public class Statement implements java.s
     
     //---------------------navigational members-----------------------------------
 
-    public MaterialStatement materialStatement_ = null;
+    private MaterialStatement materialStatement_ = null;
+
+    /**
+     * @return the materialStatement
+     */
+    public MaterialStatement getMaterialStatement() {
+        return materialStatement_;
+    }
+
+    /**
+     * @param materialStatement the materialStatement to set
+     */
+    public void setMaterialStatement(MaterialStatement materialStatement) {
+        this.materialStatement_ = materialStatement;
+    }
 
     Connection connection_;
     public Section section_;
@@ -1766,7 +1780,7 @@ public class Statement implements java.s
             // sqlMode_ is not set for statements, only for prepared statements
             if (sqlMode_ == isCall__) {
                 updateCount_ = -1L;
-                returnValueFromProcedure_ = sqlca.getSqlErrd()[0];  ////what is this for??
+                returnValueFromProcedure_ = sqlca.getReturnValue();
             }
             // Sqlcode 466 indicates a call statement has issued and result sets returned.
             // This is a good place to set some state variable to indicate result sets are
open
@@ -3274,5 +3288,4 @@ public class Statement implements java.s
     {
         return ( (rs != null) && (!rs.isClosed()) );
     }
-    
 }

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=1465193&r1=1465192&r2=1465193&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 Sat Apr
 6 05:47:58 2013
@@ -582,10 +582,6 @@ public class NetConnection extends org.a
         }
     }
 
-    protected void finalize() throws java.lang.Throwable {
-        super.finalize();
-    }
-
     protected byte[] getCnnToken() {
         return cnntkn_;
     }
@@ -1029,7 +1025,7 @@ public class NetConnection extends org.a
     }
 
     protected void resetStatement_(Statement statement, int type, int concurrency, int holdability)
throws SqlException {
-        ((NetStatement) statement.materialStatement_).resetNetStatement(netAgent_, this,
type, concurrency, holdability);
+        ((NetStatement) statement.getMaterialStatement()).resetNetStatement(netAgent_, this,
type, concurrency, holdability);
     }
 
     protected PreparedStatement newPositionedUpdatePreparedStatement_(String sql,
@@ -1645,7 +1641,9 @@ public class NetConnection extends org.a
     }
 
     public byte[] getTargetPublicKey() {
-        return targetPublicKey_.clone();
+        return targetPublicKey_ != null ?
+               targetPublicKey_.clone() :
+               null;
     }
 
     public String getProductID() {

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=1465193&r1=1465192&r2=1465193&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 Sat
Apr  6 05:47:58 2013
@@ -2699,7 +2699,7 @@ public class NetConnectionReply extends 
 
         netSqlca.setSqlerrd(sqlerrd);
         netSqlca.setSqlwarnBytes(sqlwarn);
-        netSqlca.setSqlerrmcBytes(sqlerrmc, sqlerrmcCcsid); // sqlerrmc may be null
+        netSqlca.setSqlerrmcBytes(sqlerrmc); // sqlerrmc may be null
     }
 
     // SQLDIAGGRP : FDOCA EARLY GROUP
@@ -3115,8 +3115,7 @@ public class NetConnectionReply extends 
             if (rowsetSqlca[sqldcRown] != null) {
                 rowsetSqlca[sqldcRown].resetRowsetSqlca(netAgent_.netConnection_,
                         sqldcCode,
-                        sqldcState,
-                        null);
+                        sqldcState);
             } else {
                 rowsetSqlca[sqldcRown] = new NetSqlca(netAgent_.netConnection_,
                         sqldcCode,

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java Sat Apr  6
05:47:58 2013
@@ -171,8 +171,7 @@ public class NetCursor extends org.apach
                         if (netResultSet_ != null && 
                                 netSqlca[i].containsSqlcax()) {
                             netResultSet_.setRowCountEvent(
-                                    netSqlca[i].getRowCount(
-                                        qrydscTypdef_));
+                                    netSqlca[i].getRowCount());
                         }
                     } else if (netResultSet_ != null && sqlcode > 0) {
                         String sqlState = netSqlca[i].getSqlState();
@@ -691,7 +690,7 @@ public class NetCursor extends org.apach
 
         netSqlca.setSqlerrd(sqlerrd);
         netSqlca.setSqlwarnBytes(sqlwarn);
-        netSqlca.setSqlerrmcBytes(sqlerrmc, sqlerrmcCcsid);
+        netSqlca.setSqlerrmcBytes(sqlerrmc);
     }
 
     // SQLDIAGGRP : FDOCA EARLY GROUP
@@ -801,8 +800,7 @@ public class NetCursor extends org.apach
         String sqldcMsg = parseVCS(qrydscTypdef_); // MESSAGE_TEXT
 
         if (sqldcMsg != null) {
-            sqlca.setSqlerrmcBytes(sqldcMsg.getBytes(), 
-                    netAgent_.targetTypdef_.getByteOrder());
+            sqlca.setSqlerrmcBytes(sqldcMsg.getBytes());
         }
 
         skipFdocaBytes(12);  // COLUMN_NAME + PARAMETER_NAME + EXTENDED_NAMES

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetReply.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetReply.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetReply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetReply.java Sat
Apr  6 05:47:58 2013
@@ -118,7 +118,7 @@ public class NetResultSetReply extends N
                 // define event interface and use the event method
                 // only get the rowCount_ if sqlca is not null and rowCount_ is unknown
                 if (sqlca != null && sqlca.containsSqlcax()) {
-                    ((ResultSet) resultSetI).setRowCountEvent(sqlca.getRowCount(netAgent_.targetTypdef_));
+                    ((ResultSet) resultSetI).setRowCountEvent(sqlca.getRowCount());
                 }
 
                 peekCP = peekCodePoint();
@@ -162,7 +162,7 @@ public class NetResultSetReply extends N
             // atomic.  (the only operation that is not atomic is multi-row insert).
             if (((ResultSet) resultSetI).sensitivity_ != ResultSet.sensitivity_sensitive_dynamic__)
{
                 if (netSqlca != null && netSqlca.containsSqlcax() && netSqlca.getRowsetRowCount()
== 0) {
-                    ((ResultSet) resultSetI).setRowCountEvent(netSqlca.getRowCount(netAgent_.targetTypdef_));
+                    ((ResultSet) resultSetI).setRowCountEvent(netSqlca.getRowCount());
                 }
             }
             resultSetI.completeSqlca(netSqlca);

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetRequest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetRequest.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetRequest.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSetRequest.java Sat
Apr  6 05:47:58 2013
@@ -42,7 +42,7 @@ public class NetResultSetRequest extends
         // - for forward-only cursors we do not send qryrowset on OPNQRY, fetchSize is ignored.
         //   but qryrowset is sent on EXCSQLSTT for a stored procedure call.
         boolean sendQryrowset =
-                ((NetStatement) resultSet.statement_.materialStatement_).qryrowsetSentOnOpnqry_;
+                ((NetStatement) resultSet.statement_.getMaterialStatement()).qryrowsetSentOnOpnqry_;
 
         boolean sendRtnextdta = false;
         if (sendQryrowset && resultSet.resultSetType_ == java.sql.ResultSet.TYPE_FORWARD_ONLY
&&
@@ -92,7 +92,7 @@ public class NetResultSetRequest extends
         //       then the fetch is going fetch next row as opposed to fetch next rowset.
         boolean sendQryrowset =
                 (resultSet.isRowsetCursor_ ||
-                (((NetStatement) resultSet.statement_.materialStatement_).qryrowsetSentOnOpnqry_
&&
+                (((NetStatement) resultSet.statement_.getMaterialStatement()).qryrowsetSentOnOpnqry_
&&
                 (resultSet.sensitivity_ == ResultSet.sensitivity_sensitive_static__ ||
                 ((NetCursor) resultSet.cursor_).blocking_)));
 
@@ -119,7 +119,7 @@ public class NetResultSetRequest extends
         // do not send qryrowste if the cursor is a non-rowset, sensitive dynamic cursor
         boolean sendQryrowset =
                 resultSet.isRowsetCursor_ ||
-                (((NetStatement) resultSet.statement_.materialStatement_).qryrowsetSentOnOpnqry_
&&
+                (((NetStatement) resultSet.statement_.getMaterialStatement()).qryrowsetSentOnOpnqry_
&&
                 resultSet.sensitivity_ != resultSet.sensitivity_sensitive_dynamic__);
 
         buildPositioningCNTQRY(protocolOrientation,

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetSqlca.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetSqlca.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetSqlca.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetSqlca.java Sat Apr  6 05:47:58
2013
@@ -26,6 +26,7 @@ import org.apache.derby.shared.common.re
 import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.SqlException;
 import java.io.UnsupportedEncodingException;
+import org.apache.derby.client.am.DisconnectException;
 
 public class NetSqlca extends Sqlca {
     // these are the same variables that are in the Sqlca except ccsids
@@ -57,24 +58,17 @@ public class NetSqlca extends Sqlca {
                        "sqlstate bytes", "SQLSTATE",uee);
        }
        sqlErrpBytes_ = sqlErrpBytes;
-   }
-    protected void setSqlerrd(int[] sqlErrd) {
+    }
+
+    void setSqlerrd(int[] sqlErrd) {
         sqlErrd_ = sqlErrd;
     }
 
-    protected void setSqlwarnBytes(byte[] sqlWarnBytes) {
+    void setSqlwarnBytes(byte[] sqlWarnBytes) {
         sqlWarnBytes_ = sqlWarnBytes;
     }
 
-    protected void setSqlerrmcBytes(byte[] sqlErrmcBytes, int sqlErrmcCcsid) {
+    void setSqlerrmcBytes(byte[] sqlErrmcBytes) {
         sqlErrmcBytes_ = sqlErrmcBytes;
-        sqlErrmcCcsid_ = sqlErrmcCcsid;
-    }
-
-    public long getRowCount(Typdef typdef) throws org.apache.derby.client.am.DisconnectException
{
-        int byteOrder = typdef.getByteOrder();
-        long num = (byteOrder == org.apache.derby.client.am.SignedBinary.BIG_ENDIAN) ?
-                super.getRowCount() : ((long) sqlErrd_[1] << 32) + sqlErrd_[0];
-        return num;
     }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatement.java Sat Apr
 6 05:47:58 2013
@@ -71,7 +71,7 @@ public class NetStatement implements org
         netAgent_ = netAgent;
         netConnection_ = netConnection;
         statement_ = statement;
-        statement_.materialStatement_ = this;
+        statement_.setMaterialStatement(this);
     }
 
     // Called by abstract Connection.createStatement().newStatement() for jdbc 1 statements

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementReply.java Sat
Apr  6 05:47:58 2013
@@ -896,7 +896,7 @@ public class NetStatementReply extends N
             try {
                 rs = (NetResultSet)ClientDriver.getFactory().newNetResultSet
                         (netAgent_,
-                        (NetStatement) statement.materialStatement_,
+                        (NetStatement) statement.getMaterialStatement(),
                         statement.cachedCursor_,
                         qryprctyp, //protocolType, CodePoint.FIXROWPRC | 
                                    //              CodePoint.LMTBLKPRC
@@ -917,7 +917,7 @@ public class NetStatementReply extends N
             try {
                 rs = (NetResultSet)ClientDriver.getFactory().newNetResultSet
                         (netAgent_,
-                        (NetStatement) statement.materialStatement_,
+                        (NetStatement) statement.getMaterialStatement(),
                         new NetCursor(netAgent_, qryprctyp),
                         qryprctyp, //protocolType, CodePoint.FIXROWPRC | 
                                    //              CodePoint.LMTBLKPRC

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXACallInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXACallInfo.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXACallInfo.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetXACallInfo.java Sat Apr
 6 05:47:58 2013
@@ -117,10 +117,6 @@ public class NetXACallInfo {
         return out_;
     }
 
-    public byte[] getCorrelatorToken() {
-        return crrtkn_;
-    }
-
     protected void setUOWID(byte[] uowid) {
         uowid_ = uowid;
     }

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=1465193&r1=1465192&r2=1465193&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 Sat Apr
 6 05:47:58 2013
@@ -77,10 +77,6 @@ public class NetXAConnection {    
         checkPlatformVersion();
     }
 
-    protected void finalize() throws java.lang.Throwable {
-        netCon.finalize();
-    }
-
     public void setCorrelatorToken(byte[] crttoken) {
         netCon.crrtkn_ = crttoken;
     }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java?rev=1465193&r1=1465192&r2=1465193&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/Typdef.java Sat Apr  6 05:47:58
2013
@@ -264,7 +264,7 @@ public class Typdef implements java.lang
     // constructor calls should be the corresponding constant from
     // DRDAConstants.
     //
-    protected static final FdocaSimpleDataArray[] environmentTables_ = {
+    private static final FdocaSimpleDataArray[] environmentTables_ = {
         /* 0x00 Empties */
         null,
         /* 0x01 Empties */
@@ -1051,10 +1051,6 @@ public class Typdef implements java.lang
         return ccsidMbcEncoding_;
     }
 
-    int getByteOrder() {
-        return SignedBinary.BIG_ENDIAN;
-    }
-
     public Object clone() {
         try {
             return super.clone();



Mime
View raw message