@@ -22,7 +22,8 @@ Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
22
22
23
23
Portions Copyright 2011 Jens Elkner.
24
24
25
- --%> <%@page import =" org.opensolaris.opengrok.web.Util" %>
25
+ --%>
26
+ <%@page import =" org.opensolaris.opengrok.web.Util" %>
26
27
<%@page import =" org.opensolaris.opengrok.history.HistoryGuru" %>
27
28
<%@page import =" java.io.File" %>
28
29
<%@page errorPage =" error.jsp" import="
@@ -45,16 +46,7 @@ org.opensolaris.opengrok.configuration.RuntimeEnvironment"
45
46
46
47
// Need to set the title before inlcuding httpheader.jspf
47
48
cfg. setTitle(cfg. getHistoryTitle());
48
- }
49
- % >
50
- <% @
51
49
52
- include file= " httpheader.jspf"
53
-
54
- % >
55
- <%
56
- {
57
- PageConfig cfg = PageConfig . get(request);
58
50
String path = cfg. getPath();
59
51
60
52
if (path. length() > 0 ) {
@@ -64,10 +56,31 @@ include file="httpheader.jspf"
64
56
hist = HistoryGuru . getInstance(). getHistoryUI(f);
65
57
} catch (Exception e) {
66
58
// should not happen
67
- % > <h3 >Problem</h3 ><p class =" error" ><%= e. getMessage() % > </p ><%
59
+ response. sendError(HttpServletResponse . SC_NOT_FOUND , e. getMessage());
60
+ return ;
68
61
}
69
- if (hist != null ) {
70
- request. setAttribute(" history.jsp-hist" , hist);
62
+
63
+ if (hist == null ) {
64
+ /**
65
+ * The history is not available even for a renamed file.
66
+ * Send 404 Not Found.
67
+ */
68
+ response. sendError(HttpServletResponse . SC_NOT_FOUND );
69
+ return ;
70
+ }
71
+ request. setAttribute(" history.jsp-hist" , hist);
72
+ }
73
+ }
74
+ % >
75
+ <% @
76
+
77
+ include file= " httpheader.jspf"
78
+
79
+ % >
80
+ <%
81
+ {
82
+ PageConfig cfg = PageConfig . get(request);
83
+ if ((request. getAttribute(" history.jsp-hist" )) != null ) {
71
84
% >
72
85
<body >
73
86
<script type =" text/javascript" >/* <![CDATA[ */
@@ -80,7 +93,6 @@ include file="httpheader.jspf"
80
93
<div id =" whole_header" >
81
94
<div id =" header" >
82
95
<%
83
- }
84
96
}
85
97
}
86
98
{
0 commit comments