applied joris's no derby log patch

master
Keith Donald 16 years ago
parent 72c330fffb
commit 0cc3542aed
  1. 2
      build-spring-framework/resources/changelog.txt
  2. 19
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java

@ -17,7 +17,7 @@ Changes in version 3.0.0.RC1 (2009-06-10)
* ReloadableResourceBundleMessageSource correctly calculates filenames for all locales now * ReloadableResourceBundleMessageSource correctly calculates filenames for all locales now
* @Import detects and accepts existing configuration class of the desired type * @Import detects and accepts existing configuration class of the desired type
* @Transactional supports qualifier value for choosing between multiple transaction managers * @Transactional supports qualifier value for choosing between multiple transaction managers
* added spring-jdbc config schema with initial embedded-database tag (supporting HSQL and H2) * added spring-jdbc config schema with embedded-database tag (supporting HSQL, H2, and Derby)
* Velocity/FreeMarker/TilesViewResolver only return a view if the target resource exists now * Velocity/FreeMarker/TilesViewResolver only return a view if the target resource exists now

@ -17,6 +17,7 @@ package org.springframework.jdbc.datasource.embedded;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
@ -55,6 +56,9 @@ final class DerbyEmbeddedDatabaseConfigurer implements EmbeddedDatabaseConfigure
*/ */
public static synchronized DerbyEmbeddedDatabaseConfigurer getInstance() throws ClassNotFoundException { public static synchronized DerbyEmbeddedDatabaseConfigurer getInstance() throws ClassNotFoundException {
if (INSTANCE == null) { if (INSTANCE == null) {
// disable log file
System.setProperty("derby.stream.error.method",
DerbyEmbeddedDatabaseConfigurer.class.getName() + ".getNoopOutputStream");
ClassUtils.forName("org.apache.derby.jdbc.EmbeddedDriver", DerbyEmbeddedDatabaseConfigurer.class ClassUtils.forName("org.apache.derby.jdbc.EmbeddedDriver", DerbyEmbeddedDatabaseConfigurer.class
.getClassLoader()); .getClassLoader());
INSTANCE = new DerbyEmbeddedDatabaseConfigurer(); INSTANCE = new DerbyEmbeddedDatabaseConfigurer();
@ -102,4 +106,17 @@ final class DerbyEmbeddedDatabaseConfigurer implements EmbeddedDatabaseConfigure
} }
} }
}
/**
* Returns an {@link OutputStream} that ignores all data given to it.
* Used by {@link #getInstance()} to prevent writing to Derby.log file.
*/
static OutputStream getNoopOutputStream() {
return new OutputStream() {
public void write(int b) throws IOException {
// ignore the input
}
};
}
}
Loading…
Cancel
Save