You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2014/10/28 14:05:27 UTC

git commit: Refactor charset name while looking at [LOG4J2-888] Specifying log4jConfiguration in web.xml fails on Windows when the file's path contains spaces

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 115234e73 -> 80fbf903e


Refactor charset name while looking at [LOG4J2-888] Specifying
log4jConfiguration in web.xml fails on Windows when the file's path
contains spaces

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

Branch: refs/heads/master
Commit: 80fbf903e1e66eaa0136c36183d9e11534c1ae2a
Parents: 115234e
Author: Gary Gregory <ga...@gmail.com>
Authored: Tue Oct 28 09:04:58 2014 -0400
Committer: Gary Gregory <ga...@gmail.com>
Committed: Tue Oct 28 09:04:58 2014 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/logging/log4j/core/util/FileUtils.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/80fbf903/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileUtils.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileUtils.java
index 44e2859..f6671c3 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileUtils.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileUtils.java
@@ -65,16 +65,17 @@ public final class FileUtils {
                 return null;
             }
         }
+        String charsetName = Charsets.UTF_8.name();
         try {
             final String fileName = uri.toURL().getFile();
             if (new File(fileName).exists()) { // LOG4J2-466
                 return new File(fileName); // allow files with '+' char in name
             }
-            return new File(URLDecoder.decode(fileName, "UTF8"));
+            return new File(URLDecoder.decode(fileName, charsetName));
         } catch (final MalformedURLException ex) {
             LOGGER.warn("Invalid URL {}", uri, ex);
         } catch (final UnsupportedEncodingException uee) {
-            LOGGER.warn("Invalid encoding: UTF8", uee);
+            LOGGER.warn("Invalid encoding: {}", charsetName, uee);
         }
         return null;
     }