Skip to content

Commit ea56524

Browse files
shaehnVladimir Kotal
authored andcommitted
Cure for missing file separator on subdirectory argument
After looking at the code there was a simple concatenation of a directory string with the data from the command line. A better technique would be to use the Paths interface from java.nio.file.Paths which will deal appropriately with file separation characters when they are missing or not.
1 parent de8268f commit ea56524

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/org/opensolaris/opengrok/index/Indexer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.File;
2828
import java.io.IOException;
2929
import java.lang.reflect.Field;
30+
import java.nio.file.Paths;
3031
import java.text.ParseException;
3132
import java.util.ArrayList;
3233
import java.util.Collections;
@@ -532,7 +533,8 @@ public static void main(String argv[]) {
532533
int optind = getopt.getOptind();
533534
if (optind != -1) {
534535
while (optind < argv.length) {
535-
subFilesList.add(cfg.getSourceRoot() + argv[optind++]);
536+
String path = Paths.get(cfg.getSourceRoot(), argv[optind++]).toString();
537+
subFilesList.add(path);
536538
}
537539
}
538540

0 commit comments

Comments
 (0)