release 1.7.23

This commit is contained in:
Ceki Gulcu 2017-02-14 23:38:20 +01:00
parent 983b04b546
commit 5c822203c9
23 changed files with 68 additions and 56 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>integration</artifactId>

View File

@ -26,8 +26,6 @@ package org.slf4j.test_osgi;
import java.io.File;
import org.slf4j.helpers.Util;
import junit.framework.TestCase;
public class BundleTest extends TestCase {
@ -48,8 +46,6 @@ public class BundleTest extends TestCase {
}
public void testSmoke() {
if(Util.getJavaMajorVersion() >= 9)
return;
System.out.println("===========" + new File(".").getAbsolutePath());
mbl.dumpAll();
// check that the bundle was installed

View File

@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>jul-to-slf4j</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>osgi-over-slf4j</artifactId>

View File

@ -6,7 +6,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
<packaging>pom</packaging>
<name>SLF4J</name>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-android</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-api</artifactId>

View File

@ -24,8 +24,6 @@
*/
package org.slf4j.helpers;
import java.lang.reflect.Method;
/**
* An internal utility class.
*
@ -34,8 +32,6 @@ import java.lang.reflect.Method;
*/
public final class Util {
static final int MINIMAL_VERSION = 5;
private Util() {
}
@ -133,27 +129,5 @@ public final class Util {
}
static public int getJavaMajorVersion() {
String javaVersionString = Util.safeGetSystemProperty("java.version");
return getJavaMajorVersion(javaVersionString);
}
static int getJavaMajorVersion(String versionString) {
if(versionString == null)
return MINIMAL_VERSION;
if(versionString.startsWith("1.")) {
return versionString.charAt(2) - '0';
} else {
// we running under Java 9 or later
try {
Method versionMethod = Runtime.class.getMethod("version");
Object versionObj = versionMethod.invoke(null);
Method majorMethod = versionObj.getClass().getMethod("major");
Integer resultInteger = (Integer) majorMethod.invoke(versionObj);
return resultInteger.intValue();
} catch (Exception e) {
return MINIMAL_VERSION;
}
}
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-ext</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-jcl</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-jdk14</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-log4j12</artifactId>

View File

@ -29,13 +29,12 @@ import java.util.Iterator;
import java.util.Map;
import org.apache.log4j.MDCFriend;
import org.slf4j.helpers.Util;
import org.slf4j.spi.MDCAdapter;
public class Log4jMDCAdapter implements MDCAdapter {
static {
if (Util.getJavaMajorVersion() >= 9) {
if (VersionUtil.getJavaMajorVersion() >= 9) {
MDCFriend.fixForJava9();
}
}

View File

@ -0,0 +1,33 @@
package org.slf4j.impl;
import java.lang.reflect.Method;
import org.slf4j.helpers.Util;
public class VersionUtil {
static final int MINIMAL_VERSION = 5;
static public int getJavaMajorVersion() {
String javaVersionString = Util.safeGetSystemProperty("java.version");
return getJavaMajorVersion(javaVersionString);
}
static int getJavaMajorVersion(String versionString) {
if (versionString == null)
return MINIMAL_VERSION;
if (versionString.startsWith("1.")) {
return versionString.charAt(2) - '0';
} else {
// we running under Java 9 or later
try {
Method versionMethod = Runtime.class.getMethod("version");
Object versionObj = versionMethod.invoke(null);
Method majorMethod = versionObj.getClass().getMethod("major");
Integer resultInteger = (Integer) majorMethod.invoke(versionObj);
return resultInteger.intValue();
} catch (Exception e) {
return MINIMAL_VERSION;
}
}
}
}

View File

@ -1,11 +1,12 @@
package org.apache.log4j;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.util.Random;
import org.junit.Test;
import org.slf4j.helpers.Util;
import org.slf4j.impl.VersionUtil;
public class MDCFriendTest {
@ -15,7 +16,7 @@ public class MDCFriendTest {
@Test
public void smoke() {
if(Util.getJavaMajorVersion() < 9)
if(VersionUtil.getJavaMajorVersion() < 9)
return;
MDCFriend.fixForJava9();

View File

@ -1,4 +1,4 @@
package org.slf4j.helpers;
package org.slf4j.impl;
import static org.junit.Assert.*;
@ -10,15 +10,15 @@ public class UtilVersionTest {
@Test
public void test() {
System.out.println(System.getProperty("java.version"));
assertEquals(6, Util.getJavaMajorVersion("1.6"));
assertEquals(7, Util.getJavaMajorVersion("1.7.0_21-b11"));
assertEquals(8, Util.getJavaMajorVersion("1.8.0_25"));
assertEquals(6, VersionUtil.getJavaMajorVersion("1.6"));
assertEquals(7, VersionUtil.getJavaMajorVersion("1.7.0_21-b11"));
assertEquals(8, VersionUtil.getJavaMajorVersion("1.8.0_25"));
}
@Ignore
@Test // requires Java 9 to pass
public void testJava9() {
assertEquals(9, Util.getJavaMajorVersion("9ea"));
assertEquals(9, VersionUtil.getJavaMajorVersion("9ea"));
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-migrator</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-nop</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-simple</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.23-SNAPSHOT</version>
<version>1.7.23</version>
</parent>
<artifactId>slf4j-site</artifactId>

View File

@ -35,6 +35,10 @@
<h3>February 15th, 2017 - Release of SLF4J 1.7.23</h3>
<p class="highlight">Update to SLF4J version 1.7.23 to enable
slf4j-log4j12 to run under Java 9.</p>
<p>When running under Java 9, log4j version 1.2.x is unable to
correctly parse the "java.version" system property. Assuming an
inccorect Java version, it proceeded to disable its MDC
@ -49,6 +53,11 @@
Soni with Jonas Neukomm providing the relevant PR.
</p>
<p>The slf4j-simple module now uses the latest reference to
System.out or System.err. In previous releases the reference was
set at the beginning and re-used. This change fixes <a
href="https://jira.qos.ch/browse/SLF4J-389">SLF4J-389</a> reported
by Igor Polevoy.</p>
<hr noshade="noshade" size="1"/>