Skip to content

Commit ffe761f

Browse files
Merge branch 'master' into loop-opengrok
2 parents 88f1792 + 57011d5 commit ffe761f

File tree

8 files changed

+27
-24
lines changed

8 files changed

+27
-24
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/RuntimeEnvironment.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,15 +612,16 @@ public boolean validateUniversalCtags() {
612612
executor.exec(false);
613613
String output = executor.getOutputString();
614614
boolean isUnivCtags = output != null && output.contains("Universal Ctags");
615-
if (output == null && !isUnivCtags) {
616-
LOGGER.log(Level.SEVERE, "Error: No Universal Ctags found in PATH !\n"
615+
if (output == null || !isUnivCtags) {
616+
LOGGER.log(Level.SEVERE, "Error: No Universal Ctags found !\n"
617617
+ "(tried running " + "{0}" + ")\n"
618618
+ "Please use the -c option to specify path to a "
619619
+ "Universal Ctags program.\n"
620-
+ "Or set it in Java system property "
621-
+ SYSTEM_CTAGS_PROPERTY, getCtags());
620+
+ "Or set it in Java system property {1}",
621+
new Object[]{getCtags(), SYSTEM_CTAGS_PROPERTY});
622622
ctagsFound = false;
623623
} else {
624+
LOGGER.log(Level.INFO, "Using ctags: {0}", output.trim());
624625
ctagsFound = true;
625626
}
626627
}

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ private void indexDown(File dir, String parent, IndexDownArgs args)
10771077
Arrays.sort(files, FILENAME_COMPARATOR);
10781078

10791079
for (File file : files) {
1080-
String path = parent + '/' + file.getName();
1080+
String path = parent + File.separator + file.getName();
10811081
if (!accept(dir, file, outLocalRelPath)) {
10821082
if (outLocalRelPath[0] != null) {
10831083
File xrefPath = new File(xrefDir, path);

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellXrefTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public void sampleTest() throws IOException {
122122
expectedOutputSteam.close();
123123
}
124124

125-
String actual[] = new String(sampleOutputStream.toByteArray(), "UTF-8").split("\n");
126-
String expected[] = new String(expectedOutputSteam.toByteArray(), "UTF-8").split("\n");
125+
String actual[] = new String(sampleOutputStream.toByteArray(), "UTF-8").split("\\r?\\n");
126+
String expected[] = new String(expectedOutputSteam.toByteArray(), "UTF-8").split("\\r?\\n");
127127
assertLinesEqual("Haskell sampleTest()", expected, actual);
128128
assertEquals("Haskell LOC", 3, actLOC);
129129
}
@@ -161,7 +161,7 @@ private void writeAndCompare(String sourceResource, String resultResource,
161161
baos.close();
162162

163163
String ostr = new String(baos.toByteArray(), "UTF-8");
164-
String gotten[] = ostr.split("\n");
164+
String gotten[] = ostr.split("\\r?\\n");
165165

166166
String estr = new String(expbytes, "UTF-8");
167167
String expected[] = estr.split("\n");

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpXrefTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void sampleTest() throws IOException {
136136
"analysis/php/sampleXrefRes.html");
137137
byte[] expbytes = copyStream(exp);
138138

139-
String gotten[] = new String(baos.toByteArray(), "UTF-8").split("\n");
139+
String gotten[] = new String(baos.toByteArray(), "UTF-8").split("\\r?\\n");
140140
String expected[] = new String(expbytes, "UTF-8").split("\n");
141141
assertLinesEqual("PHP xref", expected, gotten);
142142
assertEquals("PHP LOC", 29, actLOC);

opengrok-indexer/src/test/java/org/opengrok/indexer/history/GitHistoryParserTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,16 @@ public void parseALaLK() throws Exception {
290290
assertEquals(author1, e0.getAuthor());
291291
assertEquals(new SimpleDateFormat(gitISODatePattern).parse(date1), e0.getDate());
292292
assertEquals(1, e0.getFiles().size());
293-
assertEquals(File.separator + filename1, e0.getFiles().first());
293+
assertEquals(File.separator + filename1.replace('/', File.separatorChar), e0.getFiles().first());
294294
assertTrue(e0.getMessage().contains("subject title"));
295295
assertTrue(e0.getMessage().contains("Signed-off-by"));
296296
HistoryEntry e1 = result.getHistoryEntries().get(1);
297297
assertEquals(commitId2, e1.getRevision());
298298
assertEquals(author2, e1.getAuthor());
299299
assertEquals(new SimpleDateFormat(gitISODatePattern).parse(date1), e1.getDate());
300300
assertEquals(2, e1.getFiles().size());
301-
assertEquals(File.separator + filename1, e1.getFiles().first());
302-
assertEquals(File.separator + filename2, e1.getFiles().last());
301+
assertEquals(File.separator + filename1.replace('/', File.separatorChar), e1.getFiles().first());
302+
assertEquals(File.separator + filename2.replace('/', File.separatorChar), e1.getFiles().last());
303303
assertTrue(e1.getMessage().contains("[PATCH]"));
304304
assertTrue(e1.getMessage().contains("Signed-off-by"));
305305
}

opengrok-indexer/src/test/java/org/opengrok/indexer/history/GitRepositoryTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.io.InputStream;
3030
import java.io.Reader;
3131
import java.io.StringReader;
32+
import java.nio.file.Paths;
3233
import java.text.DateFormat;
3334
import java.text.ParseException;
3435
import org.junit.After;
@@ -255,8 +256,8 @@ public void testGetHistoryForOnceRenamed() throws Exception {
255256
+ "\treturn 0;\n"
256257
+ "}\n";
257258

258-
runRenamedTest("moved2/renamed2.c", "84599b3", exp_str);
259-
runRenamedTest("moved/renamed2.c", "67dfbe2", exp_str);
259+
runRenamedTest(Paths.get("moved2", "renamed2.c").toString(), "84599b3", exp_str);
260+
runRenamedTest(Paths.get("moved", "renamed2.c").toString(), "67dfbe2", exp_str);
260261
}
261262

262263
/**
@@ -294,8 +295,8 @@ public void testGetHistoryForTwiceRenamed() throws Exception {
294295
+ "\treturn 0;\n"
295296
+ "}\n";
296297

297-
runRenamedTest("moved/renamed.c", "1086eaf", exp_str);
298-
runRenamedTest("moved/renamed2.c", "67dfbe2", exp_str);
298+
runRenamedTest(Paths.get("moved", "renamed.c").toString(), "1086eaf", exp_str);
299+
runRenamedTest(Paths.get("moved", "renamed2.c").toString(), "67dfbe2", exp_str);
299300
}
300301

301302
/**
@@ -321,7 +322,7 @@ public void testGetHistoryForThreeTimesRenamed() throws Exception {
321322
+ "\treturn 0;\n"
322323
+ "}\n";
323324

324-
runRenamedTest("moved/renamed.c", "b641394", exp_str);
325+
runRenamedTest(Paths.get("moved", "renamed.c").toString(), "b641394", exp_str);
325326
runRenamedTest("renamed.c", "ce4c98e", exp_str);
326327
}
327328

@@ -333,7 +334,7 @@ public void testGetHistoryForThreeTimesRenamed() throws Exception {
333334
*/
334335
@Test
335336
public void testGetHistoryForNonExistentRenamed() throws Exception {
336-
runRenamedTest("moved/renamed.c", "67dfbe2", null);
337+
runRenamedTest(Paths.get("moved", "renamed.c").toString(), "67dfbe2", null);
337338
runRenamedTest("renamed.c", "67dfbe2", null);
338339
}
339340

opengrok-indexer/src/test/java/org/opengrok/indexer/util/PathUtilsTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import java.io.File;
2727
import java.io.IOException;
28+
import java.net.URI;
2829
import java.nio.file.Files;
2930
import java.nio.file.Path;
3031
import java.nio.file.Paths;
@@ -63,16 +64,16 @@ public void tearDown() {
6364

6465
@Test
6566
public void shouldHandleSameInputs() throws IOException {
66-
final String USR_BIN = "/usr/bin";
67+
final String USR_BIN = Paths.get("/usr/bin").toString();
6768
String rel = PathUtils.getRelativeToCanonical(USR_BIN, USR_BIN);
68-
Assert.assertEquals("/usr/bin rel to itself", "", rel);
69+
Assert.assertEquals(USR_BIN + " rel to itself", "", rel);
6970
}
7071

7172
@Test
7273
public void shouldHandleEffectivelySameInputs() throws IOException {
73-
final String USR_BIN = "/usr/bin";
74-
String rel = PathUtils.getRelativeToCanonical(USR_BIN + "/", USR_BIN);
75-
Assert.assertEquals("/usr/bin rel to ~itself", "", rel);
74+
final String USR_BIN = Paths.get("/usr/bin").toString();
75+
String rel = PathUtils.getRelativeToCanonical(USR_BIN + File.separator, USR_BIN);
76+
Assert.assertEquals(USR_BIN + " rel to ~itself", "", rel);
7677
}
7778

7879
@Test

tools/src/main/python/indexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def FindCtags(logger):
9090
"""
9191
binary = None
9292
logger.debug("Trying to find ctags binary")
93-
for program in ['ctags-exuberant', 'exctags', 'ctags']:
93+
for program in ['universal-ctags', 'ctags']:
9494
executable = get_command(logger, None, program)
9595
if executable:
9696
# Verify that this executable is or is based on Exuberant Ctags

0 commit comments

Comments
 (0)