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 2016/02/04 13:59:33 UTC
svn commit: r1728459 - in /db/derby/code/trunk/java:
optional/org/apache/derby/optional/dump/DataFileVTI.java
testing/org/apache/derbyTesting/functionTests/tests/lang/RawDBReaderTest.java
Author: kahatlen
Date: Thu Feb 4 12:59:32 2016
New Revision: 1728459
URL: http://svn.apache.org/viewvc?rev=1728459&view=rev
Log:
DERBY-6864: RawDBReaderTest fails on Windows
DataFileVTI.makeDecryptionEngine() opens a stream that reads from
service.properties, but it never closes the stream. This prevents the
file from being deleted later. This patch makes it open the stream in
a try-with-resources statement so that it gets closed automatically.
Modified:
db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/DataFileVTI.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RawDBReaderTest.java
Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/DataFileVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/DataFileVTI.java?rev=1728459&r1=1728458&r2=1728459&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/DataFileVTI.java (original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/dump/DataFileVTI.java Thu Feb 4 12:59:32 2016
@@ -29,17 +29,11 @@ import java.io.FileInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.RandomAccessFile;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Connection;
@@ -58,7 +52,6 @@ import java.util.Properties;
import org.apache.derby.authentication.UserAuthenticator;
import org.apache.derby.catalog.TypeDescriptor;
-import org.apache.derby.iapi.jdbc.AuthenticationService;
import org.apache.derby.iapi.reference.Property;
import org.apache.derby.iapi.services.crypto.CipherFactory;
import org.apache.derby.iapi.services.crypto.CipherProvider;
@@ -897,7 +890,9 @@ public class DataFileVTI extends VTIT
File serviceProperties = new File( _dbDirectory, "service.properties" );
Properties properties = unpackEncryptionProperties( encryptionProperties );
- properties.load( new FileInputStream( serviceProperties ) );
+ try (FileInputStream in = new FileInputStream(serviceProperties)) {
+ properties.load(in);
+ }
CipherFactory cipherFactory =
new JCECipherFactoryBuilder()
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RawDBReaderTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RawDBReaderTest.java?rev=1728459&r1=1728458&r2=1728459&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RawDBReaderTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RawDBReaderTest.java Thu Feb 4 12:59:32 2016
@@ -28,7 +28,6 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import junit.framework.Test;
-import org.apache.derbyTesting.junit.BaseTestSuite;
import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
import org.apache.derbyTesting.junit.Decorator;
import org.apache.derbyTesting.junit.SecurityManagerSetup;
@@ -53,7 +52,6 @@ public class RawDBReaderTest extends Gen
private static final String MEMORY_DB = "jdbc:derby:memory:rrt";
private static final String RECOVERY_SCRIPT = "extinout/recovery.sql";
private static final String BOOT_PASSWORD = "fooBarWibble";
- private static final String CORRUPT_DATABASE = "rrtCorruptDatabase";
private static final String LIST_USER_SCHEMAS =
"select schemaname from sys.sysschemas\n" +
@@ -119,8 +117,7 @@ public class RawDBReaderTest extends Gen
*/
public static Test suite()
{
- BaseTestSuite baseTest = (BaseTestSuite)TestConfiguration.embeddedSuite(
- RawDBReaderTest.class );
+ Test baseTest = TestConfiguration.embeddedSuite(RawDBReaderTest.class);
// We don't expect that users of this tool will run with a security
// manager. The tool is run standalone behind a firewall.