You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/11/27 03:27:26 UTC
[commons-vfs] 07/08: Fix PMD AvoidBranchingStatementAsLastInLoop & EmptyCatchBlock.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit af7e1dd46070f6e4b9338fdf83d9e97bfd24dd11
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 26 22:15:57 2021 -0500
Fix PMD AvoidBranchingStatementAsLastInLoop & EmptyCatchBlock.
---
.../org/apache/commons/vfs2/provider/AbstractFileName.java | 3 ++-
.../java/org/apache/commons/vfs2/provider/UriParser.java | 14 ++++++--------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
index 874f062..12dcd97 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
@@ -279,7 +279,8 @@ public abstract class AbstractFileName implements FileName {
return UriParser.encode(uri, RESERVED_URI_CHARS);
} catch (final FileSystemException e) {
- // Default to base URI value
+ // Default to base URI value?
+ return uri;
}
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
index 6dd9984..a8f5ffb 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
@@ -415,15 +415,13 @@ public final class UriParser {
// A scheme character
continue;
}
- if (pos > 0 && (ch >= '0' && ch <= '9' || ch == '+' || ch == '-' || ch == '.')) {
- // A scheme character (these are not allowed as the first
- // character of the scheme, but can be used as subsequent
- // characters.
- continue;
+ if (!(pos > 0 && (ch >= '0' && ch <= '9' || ch == '+' || ch == '-' || ch == '.'))) {
+ // Not a scheme character
+ break;
}
-
- // Not a scheme character
- break;
+ // A scheme character (these are not allowed as the first
+ // character of the scheme, but can be used as subsequent
+ // characters.
}
// No scheme in URI