Skip to content

Commit 6d95dac

Browse files
author
Vladimir Kotal
authored
use getPath() for all this.path references (#3213)
1 parent b64c680 commit 6d95dac

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/web/PageConfig.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public String getHeaderData() {
223223
*/
224224
public DiffData getDiffData() {
225225
DiffData data = new DiffData();
226-
data.path = getPath().substring(0, path.lastIndexOf(PATH_SEPARATOR));
226+
data.path = getPath().substring(0, getPath().lastIndexOf(PATH_SEPARATOR));
227227
data.filename = Util.htmlize(getResourceFile().getName());
228228

229229
String srcRoot = getSourceRootPath();
@@ -511,9 +511,9 @@ public String getHistoryDirs() {
511511
}
512512
String[] val = req.getParameterValues("also");
513513
if (val == null || val.length == 0) {
514-
return path;
514+
return getPath();
515515
}
516-
StringBuilder paths = new StringBuilder(path);
516+
StringBuilder paths = new StringBuilder(getPath());
517517
for (String val1 : val) {
518518
paths.append(' ').append(val1);
519519
}
@@ -764,12 +764,12 @@ public Annotation getAnnotation() {
764764
*/
765765
public String[] getSearchOnlyIn() {
766766
if (isDir()) {
767-
return path.length() == 0
767+
return getPath().length() == 0
768768
? new String[]{"/", "this directory", "disabled=\"\""}
769-
: new String[]{path, "this directory", ""};
769+
: new String[]{getPath(), "this directory", ""};
770770
}
771771
String[] res = new String[3];
772-
res[0] = path.substring(0, path.lastIndexOf(PATH_SEPARATOR) + 1);
772+
res[0] = getPath().substring(0, getPath().lastIndexOf(PATH_SEPARATOR) + 1);
773773
res[1] = res[0];
774774
res[2] = "";
775775
return res;
@@ -1257,7 +1257,7 @@ public File[] findDataFiles(List<String> filenames) {
12571257
return new File[0];
12581258
}
12591259
File[] res = new File[filenames.size()];
1260-
File dir = new File(getEnv().getDataRootPath() + Prefix.XREF_P + path);
1260+
File dir = new File(getEnv().getDataRootPath() + Prefix.XREF_P + getPath());
12611261
if (dir.exists() && dir.isDirectory()) {
12621262
getResourceFile();
12631263
boolean compressed = getEnv().isCompressXref();
@@ -1279,7 +1279,7 @@ public File[] findDataFiles(List<String> filenames) {
12791279
*/
12801280
public File findDataFile() {
12811281
return checkFile(new File(getEnv().getDataRootPath() + Prefix.XREF_P),
1282-
path, env.isCompressXref());
1282+
getPath(), env.isCompressXref());
12831283
}
12841284

12851285
public String getLatestRevision() {
@@ -1335,7 +1335,7 @@ public String getRevisionLocation(String revStr) {
13351335

13361336
sb.append(req.getContextPath());
13371337
sb.append(Prefix.XREF_P);
1338-
sb.append(Util.URIEncodePath(path));
1338+
sb.append(Util.URIEncodePath(getPath()));
13391339
sb.append("?");
13401340
sb.append(QueryParameters.REVISION_PARAM_EQ);
13411341
sb.append(Util.URIEncode(revStr));
@@ -1383,7 +1383,7 @@ && getUriEncodedPath().isEmpty()
13831383
return req.getContextPath() + Prefix.XREF_P + '/';
13841384
}
13851385

1386-
if (path.length() == 0) {
1386+
if (getPath().length() == 0) {
13871387
// => /
13881388
return null;
13891389
}
@@ -1392,9 +1392,9 @@ && getUriEncodedPath().isEmpty()
13921392
&& prefix != Prefix.RSS_P) {
13931393
// if it is an existing dir perhaps people wanted dir xref
13941394
return req.getContextPath() + Prefix.XREF_P
1395-
+ getUriEncodedPath() + trailingSlash(path);
1395+
+ getUriEncodedPath() + trailingSlash(getPath());
13961396
}
1397-
String ts = trailingSlash(path);
1397+
String ts = trailingSlash(getPath());
13981398
if (ts.length() != 0) {
13991399
return req.getContextPath() + prefix + getUriEncodedPath() + ts;
14001400
}
@@ -1678,11 +1678,13 @@ public String getSearchTitle() {
16781678
* @return string used for setting page title of search view
16791679
*/
16801680
public String getHistoryTitle() {
1681+
String path = getPath();
16811682
return Util.htmlize(getShortPath(path) +
16821683
" - OpenGrok history log for " + path);
16831684
}
16841685

16851686
public String getPathTitle() {
1687+
String path = getPath();
16861688
String title = getShortPath(path);
16871689
if (getRequestedRevision() != null && !getRequestedRevision().isEmpty()) {
16881690
title += " (revision " + getRequestedRevision() + ")";

0 commit comments

Comments
 (0)