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 2013/08/22 17:49:58 UTC
svn commit: r1516491 -
/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/FileUtils.java
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) {