Skip to content

Commit 9f5ca42

Browse files
committed
Remove unnecessary stripCount parameter
1 parent 7ddba3a commit 9f5ca42

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
22-
* Portions Copyright (c) 2017-2018, Chris Fraire <[email protected]>.
22+
* Portions Copyright (c) 2017-2019, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.configuration;
2525

@@ -424,7 +424,7 @@ public void setSourceRoot(String sourceRoot) {
424424
*/
425425
public String getPathRelativeToSourceRoot(File file)
426426
throws IOException, ForbiddenSymlinkException {
427-
return PathUtils.getPathRelativeToSourceRoot(file, 0);
427+
return PathUtils.getPathRelativeToSourceRoot(file);
428428
}
429429

430430
/**
@@ -1457,7 +1457,7 @@ private void generateProjectRepositoriesMap() throws IOException {
14571457
String repoPath;
14581458
try {
14591459
repoPath = PathUtils.getPathRelativeToSourceRoot(
1460-
new File(r.getDirectoryName()), 0);
1460+
new File(r.getDirectoryName()));
14611461
} catch (ForbiddenSymlinkException e) {
14621462
LOGGER.log(Level.FINER, e.getMessage());
14631463
continue;

opengrok-indexer/src/main/java/org/opengrok/indexer/util/PathUtils.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2017, Chris Fraire <[email protected]>.
21+
* Copyright (c) 2017, 2019, Chris Fraire <[email protected]>.
2222
*/
2323

2424
package org.opengrok.indexer.util;
@@ -189,15 +189,14 @@ private static boolean isAllowedSymlink(String canonicalFile,
189189
* source root.
190190
*
191191
* @param file A file to resolve
192-
* @param stripCount Number of characters past source root to strip
193192
* @return Path relative to source root
194193
* @throws IOException if an IO error occurs
195194
* @throws FileNotFoundException if the file is not relative to source root
196195
* @throws ForbiddenSymlinkException if symbolic-link checking encounters
197196
* an ineligible link
198197
* @throws InvalidPathException if the path cannot be decoded
199198
*/
200-
public static String getPathRelativeToSourceRoot(File file, int stripCount)
199+
public static String getPathRelativeToSourceRoot(File file)
201200
throws IOException, ForbiddenSymlinkException, FileNotFoundException,
202201
InvalidPathException {
203202
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
@@ -215,7 +214,7 @@ public static String getPathRelativeToSourceRoot(File file, int stripCount)
215214
// elsewhere directly appended to env.getSourceRootPath() and also
216215
// stored as such.
217216
maybeRelPath = File.separator + maybeRelPath;
218-
return maybeRelPath.substring(stripCount);
217+
return maybeRelPath;
219218
}
220219

221220
throw new FileNotFoundException("Failed to resolve [" + file.getPath()

0 commit comments

Comments
 (0)