[logback-dev] branch, master, updated. b018525e30ef54b8096d9c9cb9ae7db67eed1a6a
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Tue Dec 1 00:14:36 CET 2009
The branch, master has been updated
via b018525e30ef54b8096d9c9cb9ae7db67eed1a6a (commit)
from c1945db449459277f2bdd97d9bfb97253cefb4a4 (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=b018525e30ef54b8096d9c9cb9ae7db67eed1a6a
http://github.com/ceki/logback/commit/b018525e30ef54b8096d9c9cb9ae7db67eed1a6a
commit b018525e30ef54b8096d9c9cb9ae7db67eed1a6a
Author: Ceki Gulcu <ceki at qos.ch>
Date: Tue Dec 1 00:12:40 2009 +0100
added a test case based on 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 63cbcd1..4693400 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
@@ -46,6 +46,7 @@ public abstract class GenericConfigurator extends ContextAwareBase {
URLConnection urlConnection = url.openConnection();
// per http://jira.qos.ch/browse/LBCORE-105
urlConnection.setDefaultUseCaches(false);
+
InputStream in = urlConnection.getInputStream();
doConfigure(in);
in.close();
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 c081b4f..9e5ea44 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,9 +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.util.HashMap;
import java.util.jar.JarOutputStream;
@@ -51,10 +54,10 @@ public class TrivialConfiguratorTest {
TrivialConfigurator trivialConfigurator = new TrivialConfigurator(rulesMap);
trivialConfigurator.setContext(context);
- trivialConfigurator.doConfigure(CoreTestConstants.TEST_DIR_PREFIX + "input/joran/"
- + filename);
+ trivialConfigurator.doConfigure(CoreTestConstants.TEST_DIR_PREFIX
+ + "input/joran/" + filename);
}
-
+
@Test
public void smoke() throws Exception {
int oldBeginCount = IncAction.beginCount;
@@ -115,6 +118,34 @@ public class TrivialConfiguratorTest {
assertFalse(jarFile.exists());
}
+ @Test
+ public void lbcore127() throws IOException, JoranException {
+ String jarEntry = "buzz.xml";
+ String jarEntry2 = "Lightyear.xml";
+
+ File jarFile = makeJarFile();
+ fillInJarFile(jarFile, jarEntry, jarEntry2);
+
+
+ URL url = asURL(jarFile, jarEntry);
+ URL url2 = asURL(jarFile, jarEntry2);
+
+ InputStream resourceAsStream = url2.openStream();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ resourceAsStream));
+
+ TrivialConfigurator tc = new TrivialConfigurator(rulesMap);
+ tc.setContext(context);
+ tc.doConfigure(url);
+ reader.readLine();
+
+ reader.close();
+
+ // deleting an open file fails
+ assertTrue(jarFile.delete());
+ assertFalse(jarFile.exists());
+ }
+
File makeJarFile() {
File outputDir = new File(CoreTestConstants.OUTPUT_DIR_PREFIX);
outputDir.mkdirs();
@@ -125,10 +156,20 @@ public class TrivialConfiguratorTest {
private void fillInJarFile(File jarFile, String jarEntryName)
throws IOException {
+ fillInJarFile(jarFile, jarEntryName, null);
+ }
+
+ private void fillInJarFile(File jarFile, String jarEntryName,
+ String secondJarEntry) throws IOException {
JarOutputStream jos = new JarOutputStream(new FileOutputStream(jarFile));
jos.putNextEntry(new ZipEntry(jarEntryName));
jos.write("<x/>".getBytes());
jos.closeEntry();
+ if (secondJarEntry != null) {
+ jos.putNextEntry(new ZipEntry(secondJarEntry));
+ jos.write("<y/>".getBytes());
+ jos.closeEntry();
+ }
jos.close();
}
-----------------------------------------------------------------------
Summary of changes:
.../logback/core/joran/GenericConfigurator.java | 1 +
.../core/joran/TrivialConfiguratorTest.java | 47 ++++++++++++++++++-
2 files changed, 45 insertions(+), 3 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
More information about the logback-dev
mailing list