branch, master, updated. f73e9afc1951ff45ebaae0d0806e6126aab37bc8

The branch, master has been updated via f73e9afc1951ff45ebaae0d0806e6126aab37bc8 (commit) from b018525e30ef54b8096d9c9cb9ae7db67eed1a6a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=f73e9afc1951ff45ebaae0d08... http://github.com/ceki/logback/commit/f73e9afc1951ff45ebaae0d0806e6126aab37b... commit f73e9afc1951ff45ebaae0d0806e6126aab37bc8 Author: Ceki Gulcu <ceki@qos.ch> Date: Tue Dec 1 14:12:51 2009 +0100 Fixed http://jira.qos.ch/browse/LBCORE-127 diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java b/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java index 4693400..2346adf 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java +++ b/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java @@ -45,7 +45,8 @@ public abstract class GenericConfigurator extends ContextAwareBase { informContextOfURLUsedForConfiguration(url); URLConnection urlConnection = url.openConnection(); // per http://jira.qos.ch/browse/LBCORE-105 - urlConnection.setDefaultUseCaches(false); + // per http://jira.qos.ch/browse/LBCORE-127 + urlConnection.setUseCaches(false); InputStream in = urlConnection.getInputStream(); doConfigure(in); diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/TrivialConfiguratorTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/TrivialConfiguratorTest.java index 9e5ea44..d35f106 100644 --- a/logback-core/src/test/java/ch/qos/logback/core/joran/TrivialConfiguratorTest.java +++ b/logback-core/src/test/java/ch/qos/logback/core/joran/TrivialConfiguratorTest.java @@ -17,13 +17,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.net.URL; +import java.net.URLConnection; import java.util.HashMap; import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; @@ -107,7 +106,7 @@ public class TrivialConfiguratorTest { @Test public void lbcore105() throws IOException, JoranException { String jarEntry = "buzz.xml"; - File jarFile = makeJarFile(); + File jarFile = makeRandomJarFile(); fillInJarFile(jarFile, jarEntry); URL url = asURL(jarFile, jarEntry); TrivialConfigurator tc = new TrivialConfigurator(rulesMap); @@ -121,36 +120,35 @@ public class TrivialConfiguratorTest { @Test public void lbcore127() throws IOException, JoranException { String jarEntry = "buzz.xml"; - String jarEntry2 = "Lightyear.xml"; - - File jarFile = makeJarFile(); + String jarEntry2 = "lightyear.xml"; + + File jarFile = makeRandomJarFile(); fillInJarFile(jarFile, jarEntry, jarEntry2); - - URL url = asURL(jarFile, jarEntry); + URL url1 = asURL(jarFile, jarEntry); URL url2 = asURL(jarFile, jarEntry2); - InputStream resourceAsStream = url2.openStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader( - resourceAsStream)); + URLConnection urlConnection2 = url2.openConnection(); + urlConnection2.setUseCaches(false); + InputStream is = urlConnection2.getInputStream(); TrivialConfigurator tc = new TrivialConfigurator(rulesMap); tc.setContext(context); - tc.doConfigure(url); - reader.readLine(); - - reader.close(); + tc.doConfigure(url1); + + is.read(); + is.close(); // deleting an open file fails assertTrue(jarFile.delete()); assertFalse(jarFile.exists()); } - File makeJarFile() { + File makeRandomJarFile() { File outputDir = new File(CoreTestConstants.OUTPUT_DIR_PREFIX); outputDir.mkdirs(); - int randomInt = RandomUtil.getPositiveInt(); - return new File(CoreTestConstants.OUTPUT_DIR_PREFIX + "foo-" + randomInt + int randomPart = RandomUtil.getPositiveInt(); + return new File(CoreTestConstants.OUTPUT_DIR_PREFIX + "foo-" + randomPart + ".jar"); } @@ -159,14 +157,14 @@ public class TrivialConfiguratorTest { fillInJarFile(jarFile, jarEntryName, null); } - private void fillInJarFile(File jarFile, String jarEntryName, - String secondJarEntry) throws IOException { + private void fillInJarFile(File jarFile, String jarEntryName1, + String jarEntryName2) throws IOException { JarOutputStream jos = new JarOutputStream(new FileOutputStream(jarFile)); - jos.putNextEntry(new ZipEntry(jarEntryName)); + jos.putNextEntry(new ZipEntry(jarEntryName1)); jos.write("<x/>".getBytes()); jos.closeEntry(); - if (secondJarEntry != null) { - jos.putNextEntry(new ZipEntry(secondJarEntry)); + if (jarEntryName2 != null) { + jos.putNextEntry(new ZipEntry(jarEntryName2)); jos.write("<y/>".getBytes()); jos.closeEntry(); } ----------------------------------------------------------------------- Summary of changes: .../logback/core/joran/GenericConfigurator.java | 3 +- .../core/joran/TrivialConfiguratorTest.java | 44 +++++++++---------- 2 files changed, 23 insertions(+), 24 deletions(-) hooks/post-receive -- Logback: the generic, reliable, fast and flexible logging framework.
participants (1)
-
git-noreply@pixie.qos.ch