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 rh...@apache.org on 2014/04/17 17:44:40 UTC
svn commit: r1588289 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
Author: rhillegas
Date: Thu Apr 17 15:44:40 2014
New Revision: 1588289
URL: http://svn.apache.org/r1588289
Log:
DERBY-6533: Plug another NPE in NsTest; commit derby-6533-aa-anotherNPE.diff.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java?rev=1588289&r1=1588288&r2=1588289&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java Thu Apr 17 15:44:40 2014
@@ -96,6 +96,19 @@ public class TesterObject {
return conn; // null if there was a problem, else a valid connection
}
+ /** Get a new connection and raise an error if this can't be done */
+ public Connection getNewConnection()
+ {
+ Connection conn = getConnection();
+
+ if ( conn == null )
+ {
+ throw new RuntimeException( "Could not get a connection!" );
+ }
+
+ return conn;
+ }
+
// *******************************************************************************
//
// Sets the isolation level to that indicated.
@@ -142,6 +155,8 @@ public class TesterObject {
// decide Insert, Update or Delete
int decider = (int) (Math.random() * 100) % 3;
+ if ( connex == null ) { connex = getNewConnection(); }
+
switch (decider) {
case 0: // do an Insert