mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 20:12:14 +00:00
Use Collection.isEmpty() to test if collections are empty (#9072)
Fix issue S1155 'Collection.isEmpty()' should be used to test for emptiness
This commit is contained in:
1 parent
e4079f71c1
commit
c729b41763
7 files changed
+11
-11
No files matched your search
@@ -345,21 +345,21 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
String token = tokens.get(i);
|
||||
if (token.equals(".")) {
|
||||
tokens.remove(i);
|
||||
if (tokens.size() > 0)
|
||||
if (!tokens.isEmpty())
|
||||
tokens.remove(i > 0 ? i - 1 : i);
|
||||
} else if (token.equals("..")) {
|
||||
if (i == 0) {
|
||||
// If absolute path, just remove: /../something
|
||||
// If relative path, not collapsible so leave as-is
|
||||
tokens.remove(0);
|
||||
if (tokens.size() > 0) token += tokens.remove(0);
|
||||
if (!tokens.isEmpty()) token += tokens.remove(0);
|
||||
if (!isAbsolute) buf.append(token);
|
||||
} else {
|
||||
// Normalize: remove something/.. plus separator before/after
|
||||
i -= 2;
|
||||
for (int j = 0; j < 3; j++) tokens.remove(i);
|
||||
if (i > 0) tokens.remove(i - 1);
|
||||
else if (tokens.size() > 0) tokens.remove(0);
|
||||
else if (!tokens.isEmpty()) tokens.remove(0);
|
||||
}
|
||||
} else
|
||||
i += 2;
|
||||
|
||||
Reference in new issue
Block a user