You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2017/02/02 16:46:52 UTC

[1/3] logging-log4j2 git commit: [LOG4J2-1799]: Error determining the current charset

Repository: logging-log4j2
Updated Branches:
  refs/heads/master d52ce48f7 -> ac51b5bc4


[LOG4J2-1799]: Error determining the current charset


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/84d816ff
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/84d816ff
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/84d816ff

Branch: refs/heads/master
Commit: 84d816ffbfac090de73ff283307b473850899723
Parents: 7164e8b
Author: Eduard Gizatullin <ed...@gmail.com>
Authored: Thu Feb 2 14:16:10 2017 +0300
Committer: Eduard Gizatullin <ed...@gmail.com>
Committed: Thu Feb 2 14:16:10 2017 +0300

----------------------------------------------------------------------
 .../logging/log4j/util/PropertiesUtil.java      |  2 +-
 .../logging/log4j/util/PropertiesUtilTest.java  | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/84d816ff/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index 0fbd1c1..16b9ef6 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -143,7 +143,7 @@ public final class PropertiesUtil {
      */
     public Charset getCharsetProperty(final String name, final Charset defaultValue) {
         final String prop = getStringProperty(name);
-        return prop == null ? defaultValue : Charset.forName(name);
+        return prop == null ? defaultValue : Charset.forName(prop);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/84d816ff/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java
index 131e87b..f25162e 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesUtilTest.java
@@ -17,6 +17,9 @@
 
 package org.apache.logging.log4j.util;
 
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.charset.UnsupportedCharsetException;
 import java.util.Map;
 import java.util.Properties;
 
@@ -62,4 +65,21 @@ public class PropertiesUtilTest {
         assertEquals("2", properties.getProperty("2"));
         assertEquals("3", properties.getProperty("3"));
     }
+
+
+    @Test
+    public void testGetCharsetProperty() throws Exception {
+        Properties p = new Properties();
+        p.setProperty("e.1", StandardCharsets.US_ASCII.name());
+        p.setProperty("e.2", "wrong-charset-name");
+        PropertiesUtil pu = new PropertiesUtil(p);
+
+        assertEquals(Charset.defaultCharset(), pu.getCharsetProperty("e.0"));
+        assertEquals(StandardCharsets.US_ASCII, pu.getCharsetProperty("e.1"));
+        try {
+            pu.getCharsetProperty("e.2");
+            fail("No expected UnsupportedCharsetException");
+        } catch (UnsupportedCharsetException ignored) {
+        }
+    }
 }


[3/3] logging-log4j2 git commit: LOG4J2-1799 Fixed bug in PropertiesUtil::getCharsetProperty that caused UnsupportedCharsetException for ConsoleAppender.

Posted by rp...@apache.org.
LOG4J2-1799 Fixed bug in PropertiesUtil::getCharsetProperty that caused UnsupportedCharsetException for ConsoleAppender.

This closes #57
https://github.com/apache/logging-log4j2/pull/57


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ac51b5bc
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ac51b5bc
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ac51b5bc

Branch: refs/heads/master
Commit: ac51b5bc451f2de2ab80fb42d1b9782c7c785d29
Parents: e31731b
Author: rpopma <rp...@apache.org>
Authored: Fri Feb 3 01:46:42 2017 +0900
Committer: rpopma <rp...@apache.org>
Committed: Fri Feb 3 01:46:42 2017 +0900

----------------------------------------------------------------------
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ac51b5bc/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d32bd46..3d9582b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -34,6 +34,9 @@
       <action issue="LOG4J2-1805" dev="rpopma" type="fix">
         Fixed rare race condition in FixedDateFormat, made FixedDateFormat::millisSinceMidnight method public.
       </action>
+      <action issue="LOG4J2-1799" dev="rpopma" type="fix" due-to="Eduard Gizatullin">
+        Fixed bug in PropertiesUtil::getCharsetProperty that caused UnsupportedCharsetException for ConsoleAppender.
+      </action>
     </release>
     <release version="2.8" date="2017-01-21" description="GA Release 2.8">
       <action issue="LOG4J2-1780" dev="mikes" type="fix">


[2/3] logging-log4j2 git commit: Merge branch 'LOG4J2-1799' of https://github.com/edwgiz/logging-log4j2

Posted by rp...@apache.org.
Merge branch 'LOG4J2-1799' of https://github.com/edwgiz/logging-log4j2


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e31731b6
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e31731b6
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e31731b6

Branch: refs/heads/master
Commit: e31731b6898a3f241c65fc613e7948284a4a42df
Parents: d52ce48 84d816f
Author: rpopma <rp...@apache.org>
Authored: Fri Feb 3 01:39:25 2017 +0900
Committer: rpopma <rp...@apache.org>
Committed: Fri Feb 3 01:39:25 2017 +0900

----------------------------------------------------------------------
 .../logging/log4j/util/PropertiesUtil.java      |  2 +-
 .../logging/log4j/util/PropertiesUtilTest.java  | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------