- fixed bug 154

- It is expected that all SLF4J releases in the 1.6.x and 2.0.x series
will be mutually compatible. Note that the 2.0.x series is expected to
require JDK 1.5 or later.
This commit is contained in:
Ceki Gulcu 2010-04-05 00:11:16 +02:00
parent 40e51c6d8c
commit 581b20f8aa
19 changed files with 142 additions and 88 deletions

View File

@ -15,21 +15,33 @@
<echo message="plugin classpath: ${plugin_classpath}" />
<path id="path150">
<pathelement location="xtarget/classes/" />
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
</path >
<path id="path1511API">
<pathelement location="target/test-classes/" />
<pathelement location="./lib/slf4j-api-1.5.11.jar" />
<pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
</path >
<path id="path1511Binding">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-1.5.11.jar" />
</path >
<path id="pathIncompatible">
<pathelement location="xtarget/classes/" />
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-INCOMPATIBLE.jar" />
</path >
<path id="pathCurrent">
<pathelement location="xtarget/classes/" />
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
@ -37,13 +49,47 @@
<path id="multiBinding">
<pathelement location="xtarget/classes/" />
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
<pathelement location="./lib/slf4j-nop-1.5.6.jar" />
</path >
<path id="multiBinding">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
<pathelement location="./lib/slf4j-nop-1.5.6.jar" />
</path >
<path id="binding1699">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-1.6.99.jar" />
</path >
<path id="binding2099">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-2.0.99.jar" />
</path >
<path id="api1699">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-api-1.6.99.jar" />
</path >
<path id="api2099">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-api-2.0.99.jar" />
</path >
<!-- this is really very ugly, but it's the only way to circumvent
http://jira.codehaus.org/browse/MANTRUN-95
-->
@ -57,23 +103,48 @@
<target name="testAll" depends="init,
testMismatch,
testPre155,
testMatch,
testMultiBinding">
testMatch,
testMultiBinding,
testFuture_16Series">
</target>
<target name="testMismatch">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="pathIncompatible" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports" name="org.slf4j.VersionMismatchTest" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-INCOMPATIBLE"
name="org.slf4j.VersionMismatchAssertionTest" />
</junit>
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="path1511API" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-MISMATCH-1511API"
name="org.slf4j.VersionMismatchAssertionTest" />
</junit>
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="path1511Binding" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-MISMATCH-1511Binding"
name="org.slf4j.VersionMismatchAssertionTest" />
</junit>
</target>
<target name="testPre155">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="path150" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports" name="org.slf4j.Pre155VersionTest" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-testPre155"
name="org.slf4j.CompatibilityAssertionTest" />
</junit>
</target>
@ -81,7 +152,9 @@
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="pathCurrent" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports" name="org.slf4j.VersionMatchTest" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-Match"
name="org.slf4j.CompatibilityAssertionTest" />
</junit>
</target>
@ -89,7 +162,44 @@
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="multiBinding" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports" name="org.slf4j.MultiBindingTest" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-MultiBinding"
name="org.slf4j.MultiBindingAssertionTest" />
</junit>
</target>
<target name="testFuture_16Series">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="binding1699" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-_binding1699"
name="org.slf4j.CompatibilityAssertionTest" />
</junit>
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="binding2099" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-_binding2099"
name="org.slf4j.CompatibilityAssertionTest" />
</junit>
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="api1699" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-api1699"
name="org.slf4j.CompatibilityAssertionTest" />
</junit>
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="api2099" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
outfile="TEST-api2099"
name="org.slf4j.CompatibilityAssertionTest" />
</junit>
</target>
</project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,14 +6,13 @@ import java.util.Random;
import junit.framework.TestCase;
public class VersionMatchTest extends TestCase {
public class CompatibilityAssertionTest extends TestCase {
StringPrintStream sps = new StringPrintStream(System.err);
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
public VersionMatchTest(String name) {
public CompatibilityAssertionTest(String name) {
super(name);
}

View File

@ -29,13 +29,13 @@ import java.util.Random;
import junit.framework.TestCase;
public class MultiBindingTest extends TestCase {
public class MultiBindingAssertionTest extends TestCase {
StringPrintStream sps = new StringPrintStream(System.err);
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
public MultiBindingTest(String name) {
public MultiBindingAssertionTest(String name) {
super(name);
}

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2004-2009 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package org.slf4j;
import java.io.PrintStream;
import java.util.Random;
import junit.framework.TestCase;
public class Pre155VersionTest extends TestCase {
StringPrintStream sps = new StringPrintStream(System.err);
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
public Pre155VersionTest(String name) {
super(name);
}
protected void setUp() throws Exception {
super.setUp();
System.setErr(sps);
}
protected void tearDown() throws Exception {
super.tearDown();
System.setErr(old);
}
public void test() throws Exception {
Logger logger = LoggerFactory.getLogger(this.getClass());
String msg = "hello world " + diff;
logger.info(msg);
String s0 = (String) sps.stringList.get(0);
assertTrue(s0.contains(msg));
}
}

View File

@ -5,13 +5,13 @@ import java.util.Random;
import junit.framework.TestCase;
public class VersionMismatchTest extends TestCase {
public class VersionMismatchAssertionTest extends TestCase {
StringPrintStream sps = new StringPrintStream(System.err);
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
public VersionMismatchTest(String name) {
public VersionMismatchAssertionTest(String name) {
super(name);
}

View File

@ -81,11 +81,9 @@ public final class LoggerFactory {
* the compatibility list.
*
* <p>
* It is assumed that qualifiers after the 3rd digit have no impact on
* compatibility. Thus, 1.5.7-SNAPSHOT, 1.5.7.RC0 are compatible with 1.5.7.
*/
static private final String[] API_COMPATIBILITY_LIST = new String[] {
"1.5.5", "1.5.6", "1.5.7", "1.5.8", "1.5.9", "1.5.10", "1.5.11" };
* It is assumed that all versions in the 1.6 are mutually compatible.
* */
static private final String[] API_COMPATIBILITY_LIST = new String[] { "1.6", "2.0" };
// private constructor prevents instantiation
private LoggerFactory() {
@ -196,7 +194,8 @@ public final class LoggerFactory {
if (loggerFactoryClassLoader == null) {
paths = ClassLoader.getSystemResources(STATIC_LOGGER_BINDER_PATH);
} else {
paths = loggerFactoryClassLoader.getResources(STATIC_LOGGER_BINDER_PATH);
paths = loggerFactoryClassLoader
.getResources(STATIC_LOGGER_BINDER_PATH);
}
List implementationList = new ArrayList();
while (paths.hasMoreElements()) {

View File

@ -61,7 +61,7 @@ public class StaticLoggerBinder {
* The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.11"; // !final
public static String REQUESTED_API_VERSION = "1.6"; // !final
private StaticLoggerBinder() {
throw new UnsupportedOperationException("This code should have never made it into the jar");

View File

@ -65,7 +65,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
*/
//to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.11";
public static String REQUESTED_API_VERSION = "1.6";
// Binding specific code:
private static final String loggerFactoryClassStr = JCLLoggerFactory.class

View File

@ -66,7 +66,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
* The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.11"; // !final
public static String REQUESTED_API_VERSION = "1.6"; // !final
private static final String loggerFactoryClassStr = org.slf4j.impl.JDK14LoggerFactory.class.getName();

View File

@ -66,7 +66,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
* against. The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.11"; // !final
public static String REQUESTED_API_VERSION = "1.6"; // !final
private static final String loggerFactoryClassStr = Log4jLoggerFactory.class
.getName();

View File

@ -66,7 +66,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
* The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.11"; // !final
public static String REQUESTED_API_VERSION = "1.6"; // !final
private static final String loggerFactoryClassStr = NOPLoggerFactory.class.getName();

View File

@ -58,7 +58,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
* against. The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.11"; // !final
public static String REQUESTED_API_VERSION = "1.6"; // !final
private static final String loggerFactoryClassStr = SimpleLoggerFactory.class.getName();

View File

@ -29,6 +29,11 @@
<h3>April Xth, 2010 - Release of SLF4J 1.6.0</h3>
<p>It is expected that <em>all</em> SLF4J releases in the 1.6.x and
2.0.x series will be mutually compatible. Note that the 2.0.x
series is expected to require JDK 1.5 or later.
</p>
<p>Fixed <a
href="http://bugzilla.slf4j.org/show_bug.cgi?id=150">bug 150</a> by
implementing missing <code>resetConfiguration()</code> and