]> source.dussan.org Git - jgit.git/commitdiff
[errorprone] SeparateClassloadertTestRunner: use #split(String,int) 15/1197415/6
authorIvan Frade <ifrade@google.com>
Mon, 8 Jul 2024 21:21:45 +0000 (14:21 -0700)
committerIvan Frade <ifrade@google.com>
Wed, 30 Oct 2024 23:00:15 +0000 (23:00 +0000)
Errorprone recommends to use String.split(String, int) as it has a
less surprising behaviour with empty entries.

https://errorprone.info/bugpattern/StringSplitter
Change-Id: I48a01ee18d66bbb4a177aee576629dc5132d4a38

org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/SeparateClassloaderTestRunner.java

index c8c56b21b864f7b768b8a0b6cfeed9cb07ca9712..2a482df04a7b7bbaacdbae8b85af72ea6ef92989 100644 (file)
@@ -44,7 +44,7 @@ public class SeparateClassloaderTestRunner extends BlockJUnit4ClassRunner {
                try {
                        String pathSeparator = System.getProperty("path.separator");
                        String[] classPathEntries = System.getProperty("java.class.path")
-                                       .split(pathSeparator);
+                                       .split(pathSeparator, -1);
                        URL[] urls = new URL[classPathEntries.length];
                        for (int i = 0; i < classPathEntries.length; i++) {
                                urls[i] = Paths.get(classPathEntries[i]).toUri().toURL();