Skip to content

Commit 0698843

Browse files
committed
Fix and cleanup suggested by IDEA
1 parent ab23574 commit 0698843

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

opengrok-web/src/main/webapp/history.jsp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CDDL HEADER END
2020
2121
Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
2222
Portions Copyright 2011 Jens Elkner.
23-
Portions Copyright (c) 2018, Chris Fraire <[email protected]>.
23+
Portions Copyright (c) 2018-2019, Chris Fraire <[email protected]>.
2424
2525
--%>
2626
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
@@ -31,12 +31,12 @@ Portions Copyright (c) 2018, Chris Fraire <[email protected]>.
3131
java.text.Format,
3232
java.text.SimpleDateFormat,
3333
java.util.Date,
34+
java.util.Objects,
3435
java.util.Set,
3536
java.util.regex.Pattern,
3637

3738
org.opengrok.indexer.history.History,
3839
org.opengrok.indexer.history.HistoryEntry,
39-
org.opengrok.indexer.history.HistoryException,
4040
org.opengrok.indexer.configuration.RuntimeEnvironment"
4141
%>
4242
<%/* ---------------------- history.jsp start --------------------- */
@@ -62,7 +62,7 @@ org.opengrok.indexer.configuration.RuntimeEnvironment"
6262
}
6363
6464
if (hist == null) {
65-
/**
65+
/*
6666
* The history is not available even for a renamed file.
6767
* Send 404 Not Found.
6868
*/
@@ -80,7 +80,6 @@ include file="httpheader.jspf"
8080
%>
8181
<%
8282
{
83-
PageConfig cfg = PageConfig.get(request);
8483
if ((request.getAttribute("history.jsp-hist")) != null) {
8584
%>
8685
<body>
@@ -111,7 +110,7 @@ include file="pageheader.jspf"
111110
String context = request.getContextPath();
112111
String path = cfg.getPath();
113112
114-
History hist = null;
113+
History hist;
115114
if ((hist = (History) request.getAttribute("history.jsp-hist")) != null) {
116115
117116
int start = cfg.getSearchStart();
@@ -146,7 +145,7 @@ include file="minisearch.jspf"
146145
PageConfig cfg = PageConfig.get(request);
147146
String context = request.getContextPath();
148147
String path = cfg.getPath();
149-
History hist = null;
148+
History hist;
150149
if ((hist = (History) request.getAttribute("history.jsp-hist")) != null) {
151150
RuntimeEnvironment env = cfg.getEnv();
152151
String uriEncodedName = cfg.getUriEncodedPath();
@@ -249,7 +248,6 @@ document.domReady.push(function() {domReadyHistory();});
249248
<td><%= rev %></td><%
250249
} else {
251250
if (entry.isActive()) {
252-
String rp = uriEncodedName;
253251
StringBuffer urlBuffer = request.getRequestURL();
254252
if (request.getQueryString() != null) {
255253
urlBuffer.append('?').append(request.getQueryString());
@@ -258,7 +256,7 @@ document.domReady.push(function() {domReadyHistory();});
258256
%>
259257
<td><a href="<%= urlBuffer %>"
260258
title="link to revision line">#</a>
261-
<a href="<%= context + Prefix.XREF_P + rp + "?r=" + Util.URIEncode(rev) %>"><%=
259+
<a href="<%= context + Prefix.XREF_P + uriEncodedName + "?r=" + Util.URIEncode(rev) %>"><%=
262260
rev %></a></td>
263261
<td><%
264262
%><input type="radio"
@@ -363,7 +361,7 @@ document.domReady.push(function() {domReadyHistory();});
363361
%><div class="filelist-hidden"><br/><%
364362
for (String ifile : files) {
365363
String jfile = Util.stripPathPrefix(path, ifile);
366-
if (rev == "") {
364+
if (Objects.equals(rev, "")) {
367365
%>
368366
<a class="h" href="<%= context + Prefix.XREF_P + ifile %>"><%= jfile %></a><br/><%
369367
} else {
@@ -383,7 +381,7 @@ document.domReady.push(function() {domReadyHistory();});
383381
<tr>
384382
<td colspan="5">
385383
<%
386-
String slider = null;
384+
String slider;
387385
if ((slider = (String) request.getAttribute("history.jsp-slider")) != null) {
388386
// NOTE: shouldn't happen that it doesn't have this attribute
389387
%><p class="slider"><%= slider %></p><%

0 commit comments

Comments
 (0)