logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1516491 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java
Date Thu, 22 Aug 2013 15:49:58 GMT
Author: ggregory
Date: Thu Aug 22 15:49:58 2013
New Revision: 1516491

URL: http://svn.apache.org/r1516491
Log:
Make reading this nested code easier: Statements unnecessarily nested within else clause.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java?rev=1516491&r1=1516490&r2=1516491&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java
Thu Aug 22 15:49:58 2013
@@ -53,24 +53,23 @@ public final class FileUtils {
         if (uri == null || (uri.getScheme() != null &&
             (!PROTOCOL_FILE.equals(uri.getScheme()) && !JBOSS_FILE.equals(uri.getScheme()))))
{
             return null;
-        } else {
-            if (uri.getScheme() == null) {
-                try {
-                    uri = new File(uri.getPath()).toURI();
-                } catch (final Exception ex) {
-                    LOGGER.warn("Invalid URI " + uri);
-                    return null;
-                }
-            }
+        }
+        if (uri.getScheme() == null) {
             try {
-                return new File(URLDecoder.decode(uri.toURL().getFile(), "UTF8"));
-            } catch (final MalformedURLException ex) {
-                LOGGER.warn("Invalid URL " + uri, ex);
-            } catch (final UnsupportedEncodingException uee) {
-                LOGGER.warn("Invalid encoding: UTF8", uee);
+                uri = new File(uri.getPath()).toURI();
+            } catch (final Exception ex) {
+                LOGGER.warn("Invalid URI " + uri);
+                return null;
             }
-            return null;
         }
+        try {
+            return new File(URLDecoder.decode(uri.toURL().getFile(), "UTF8"));
+        } catch (final MalformedURLException ex) {
+            LOGGER.warn("Invalid URL " + uri, ex);
+        } catch (final UnsupportedEncodingException uee) {
+            LOGGER.warn("Invalid encoding: UTF8", uee);
+        }
+        return null;
     }
 
     public static boolean isFile(final URL url) {



Mime
View raw message