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 ka...@apache.org on 2007/05/27 14:30:31 UTC

svn commit: r541977 - in /db/derby/code/trunk/java/tools/org/apache/derby/impl/tools: ij/utilMain.java sysinfo/Main.java

Author: kahatlen
Date: Sun May 27 05:30:29 2007
New Revision: 541977

URL: http://svn.apache.org/viewvc?view=rev&rev=541977
Log:
DERBY-2701: many sealing violation errors in ibm142 and ibm15 jvm test
runs of junit tests

Removed references to StandardException from java/tools.

Modified:
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java?view=diff&rev=541977&r1=541976&r2=541977
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java Sun May 27 05:30:29 2007
@@ -22,7 +22,6 @@
 package org.apache.derby.impl.tools.ij;
                 
 import org.apache.derby.iapi.reference.JDBC20Translation;
-import org.apache.derby.iapi.reference.JDBC30Translation;
 
 import org.apache.derby.tools.JDBCDisplayUtil;
 import org.apache.derby.iapi.tools.i18n.*;
@@ -30,9 +29,6 @@
 import org.apache.derby.iapi.services.info.ProductVersionHolder;
 import org.apache.derby.iapi.services.info.ProductGenusNames;
 
-import org.apache.derby.iapi.error.PublicAPI;
-import org.apache.derby.iapi.error.StandardException;
-
 import java.util.List;
 import java.util.Stack;
 import java.util.Hashtable;
@@ -53,8 +49,6 @@
 import java.sql.Statement;
 import java.sql.PreparedStatement;
 
-import java.lang.reflect.*;
-
 /**
 	This class is utilities specific to the two ij Main's.
 	This factoring enables sharing the functionality for
@@ -63,9 +57,6 @@
  */
 public class utilMain implements java.security.PrivilegedAction {
 
-  private static final Class[] CONN_PARAM = { Integer.TYPE };
-  private static final Object[] CONN_ARG = { new Integer(JDBC30Translation.CLOSE_CURSORS_AT_COMMIT)};
-
 	private StatementFinder[] commandGrabber;
 	UCode_CharStream charStream;
 	ijTokenManager ijTokMgr;
@@ -671,7 +662,7 @@
 	/**
 	 * Connections by default create ResultSet objects with holdability true. This method can be used
 	 * to change the holdability of the connection by passing one of ResultSet.HOLD_CURSORS_OVER_COMMIT
-	 * or ResultSet.CLOSE_CURSORS_AT_COMMIT. We implement this using reflection in jdk13 and lower
+	 * or ResultSet.CLOSE_CURSORS_AT_COMMIT.
 	 *
 	 * @param conn			The connection.
 	 * @param holdType	The new holdability for the Connection object.
@@ -685,19 +676,13 @@
     //were written based on that assumption
     //Later, as part of db2 compatibility, we changed the default holdability for connection to hold cursors over commit.
     //But in order for the existing tests to work fine, the tests needed a way to set the holdability to close cursors for connections
-    //Since there is no direct jdbc api in jdk13 and lower to do that, we are using reflection to set the holdability to close cursors
-    try { //for jdks prior to jdk14, need to use reflection to set holdability to false. 
-    	Method sh = conn.getClass().getMethod("setHoldability", CONN_PARAM);
-    	sh.invoke(conn, CONN_ARG);
-    } catch( Exception e) {
-    	throw PublicAPI.wrapStandardException( StandardException.plainWrapException( e));
-    }
-    return conn;
+        conn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
+        return conn;
 	}
 
 	/**
 	 * Retrieves the current holdability of ResultSet objects created using this
-	 * Connection object. We implement this using reflection in jdk13 and lower
+	 * Connection object.
 	 *
 	 * @return  The holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT
 	 * or ResultSet.CLOSE_CURSORS_AT_COMMIT
@@ -712,14 +697,7 @@
     //and statement is getting created with holdability true
     //Another instance of holdability of connection and statement not being same is when connection holdability is hold cursor
     //over commit and statement is being created with holdability false
-    int defaultHoldability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;
-    try {
-    	Method sh = conn.getClass().getMethod("getHoldability", null);
-    	defaultHoldability = ((Integer)sh.invoke(conn, null)).intValue();
-    } catch( Exception e) {
-    	throw PublicAPI.wrapStandardException( StandardException.plainWrapException( e));
-    }
-    return defaultHoldability;
+        return conn.getHoldability();
 	}
 
 	/**

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java?view=diff&rev=541977&r1=541976&r2=541977
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java Sun May 27 05:30:29 2007
@@ -51,7 +51,6 @@
 import org.apache.derby.iapi.services.info.PropertyNames;
 import org.apache.derby.iapi.services.info.ProductVersionHolder;
 import org.apache.derby.iapi.services.info.ProductGenusNames;
-import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.tools.i18n.*;
 
@@ -347,7 +346,7 @@
     value is null, the info is written to System.out
 
   */
-  private static void reportLocales (java.io.PrintWriter localAW) {          // throws StandardException {
+  private static void reportLocales (java.io.PrintWriter localAW) {
 
     boolean cur_loc = true;