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 ma...@apache.org on 2012/09/18 17:03:34 UTC

svn commit: r1387211 - in /db/derby/code/branches/10.5: ./ java/ java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java

Author: mamta
Date: Tue Sep 18 15:03:33 2012
New Revision: 1387211

URL: http://svn.apache.org/viewvc?rev=1387211&view=rev
Log:
DERBY-5663 (Getting NPE when trying to set derby.language.logStatementText property to true inside a junit suite.)

Backporting changes(without the test changes) into 10.5.3.2. The test changed(largedata/LobLimitsTest.java) does not exist in 10.7 and earlier releases 


Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/   (props changed)
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.7:r1386854
  Merged /db/derby/code/trunk:r1309244
  Merged /db/derby/code/branches/10.8:r1386677

Propchange: db/derby/code/branches/10.5/java/
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.7/java:r1386854

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java?rev=1387211&r1=1387210&r2=1387211&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java Tue Sep 18 15:03:33 2012
@@ -51,7 +51,6 @@ public class SystemPropertyTestSetup ext
 	{
 		super(test);
 		this.newValues = newValues;
-		this.oldValues = new Properties();
 		this.staticProperties = staticProperties;
 	}
 
@@ -67,7 +66,6 @@ public class SystemPropertyTestSetup ext
 	{
 		super(test);
 		this.newValues = newValues;
-		this.oldValues = new Properties();
 		this.staticProperties = false;
 	}
 	/**
@@ -77,6 +75,15 @@ public class SystemPropertyTestSetup ext
     protected void setUp()
     throws java.lang.Exception
     {
+    	//DERBY-5663 Getting NPE when trying to set 
+    	// derby.language.logStatementText property to true inside a junit 
+    	// suite.
+    	//The same instance of SystemPropertyTestSetup can be used again
+    	// and hence we want to make sure that oldValues is not null as set
+    	// in the tearDown() method. If we leave it null, we will run into NPE
+    	// during the tearDown of SystemPropertyTestSetup during the 
+    	// decorator's reuse.
+		this.oldValues = new Properties();
     	setProperties(newValues);
     	// shutdown engine so static properties take effect
     	if (staticProperties)
@@ -102,7 +109,6 @@ public class SystemPropertyTestSetup ext
     	// shutdown engine to restore any static properties
     	if (staticProperties)
     		TestConfiguration.getCurrent().shutdownEngine();
-        newValues = null;
         oldValues = null;
     }