@@ -174,72 +174,75 @@ document.pageReady.push(function() { pageReadyList();});
174
174
175
175
}
176
176
}
177
- } else if (cfg. annotate()) {
178
- // annotate
179
- BufferedInputStream bin =
180
- new BufferedInputStream (new FileInputStream (resourceFile));
181
- try {
182
- FileAnalyzerFactory a = AnalyzerGuru . find(basename);
183
- Genre g = AnalyzerGuru . getGenre(a);
184
- if (g == null ) {
185
- a = AnalyzerGuru . find(bin);
186
- g = AnalyzerGuru . getGenre(a);
187
- }
188
- if (g == Genre . IMAGE ) {
177
+ } else if (rev. length() != 0 ) {
178
+ // requesting a revision
179
+ if (cfg. isLatestRevision(rev)) {
180
+ if (cfg. annotate()) {
181
+ // annotate
182
+ BufferedInputStream bin =
183
+ new BufferedInputStream (new FileInputStream (resourceFile));
184
+ try {
185
+ FileAnalyzerFactory a = AnalyzerGuru . find(basename);
186
+ Genre g = AnalyzerGuru . getGenre(a);
187
+ if (g == null ) {
188
+ a = AnalyzerGuru . find(bin);
189
+ g = AnalyzerGuru . getGenre(a);
190
+ }
191
+ if (g == Genre . IMAGE ) {
189
192
% >
190
193
<div id =" src" >
191
194
<img src =" <%= rawPath % >" />
192
195
</div ><%
193
- } else if ( g == Genre . HTML ) {
194
- /**
195
- * For backward compatibility, read the OpenGrok-produced
196
- * document using the system default charset.
197
- */
198
- r = new InputStreamReader (bin);
199
- // dumpXref() is also useful here for translating links.
200
- Util . dumpXref(out, r, request. getContextPath());
201
- } else if (g == Genre . PLAIN ) {
196
+ } else if ( g == Genre . HTML ) {
197
+ /**
198
+ * For backward compatibility, read the OpenGrok-produced
199
+ * document using the system default charset.
200
+ */
201
+ r = new InputStreamReader (bin);
202
+ // dumpXref() is also useful here for translating links.
203
+ Util . dumpXref(out, r, request. getContextPath());
204
+ } else if (g == Genre . PLAIN ) {
202
205
% >
203
206
<div id =" src" data-navigate-window-enabled =" <%= navigateWindowEnabled % >" >
204
207
<pre ><%
205
- // We're generating xref for the latest revision, so we can
206
- // find the definitions in the index.
207
- Definitions defs = IndexDatabase . getDefinitions(resourceFile);
208
- Annotation annotation = cfg. getAnnotation();
209
- // SRCROOT is read with UTF-8 as a default.
210
- r = IOUtils . createBOMStrippedReader(bin,
211
- StandardCharsets . UTF_8. name());
212
- AnalyzerGuru . writeDumpedXref(request. getContextPath(), a,
213
- r, out, defs, annotation, project);
208
+ // We're generating xref for the latest revision, so we can
209
+ // find the definitions in the index.
210
+ Definitions defs = IndexDatabase . getDefinitions(resourceFile);
211
+ Annotation annotation = cfg. getAnnotation();
212
+ // SRCROOT is read with UTF-8 as a default.
213
+ r = IOUtils . createBOMStrippedReader(bin,
214
+ StandardCharsets . UTF_8. name());
215
+ AnalyzerGuru . writeDumpedXref(request. getContextPath(), a,
216
+ r, out, defs, annotation, project);
214
217
% > </pre >
215
218
</div ><%
216
- } else {
219
+ } else {
217
220
% >
218
221
Click <a href =" <%= rawPath % >" >download <%= basename % > </a ><%
222
+ }
223
+ } finally {
224
+ if (r != null ) {
225
+ try { r. close(); bin = null ; }
226
+ catch (Exception e) { /* ignore */ }
227
+ }
228
+ if (bin != null ) {
229
+ try { bin. close(); }
230
+ catch (Exception e) { /* ignore */ }
231
+ }
219
232
}
220
- } finally {
221
- if (r != null ) {
222
- try { r. close(); bin = null ; }
223
- catch (Exception e) { /* ignore */ }
224
- }
225
- if (bin != null ) {
226
- try { bin. close(); }
227
- catch (Exception e) { /* ignore */ }
228
- }
229
- }
230
- } else if (rev. length() != 0 ) {
231
- // requesting a revision
232
- if (cfg. isLatestRevision(rev)) {
233
- File xrefFile = cfg. findDataFile();
234
- if (xrefFile != null ) {
233
+
234
+ } else {
235
+ File xrefFile = cfg. findDataFile();
236
+ if (xrefFile != null ) {
235
237
% >
236
238
<div id =" src" data-navigate-window-enabled =" <%= navigateWindowEnabled % >" >
237
239
<pre ><%
238
- boolean compressed = xrefFile. getName(). endsWith(" .gz" );
239
- Util . dumpXref(out, xrefFile, compressed,
240
- request. getContextPath());
240
+ boolean compressed = xrefFile. getName(). endsWith(" .gz" );
241
+ Util . dumpXref(out, xrefFile, compressed,
242
+ request. getContextPath());
241
243
% > </pre >
242
244
</div ><%
245
+ }
243
246
}
244
247
} else {
245
248
// requesting a previous revision
@@ -283,7 +286,8 @@ Click <a href="<%= rawPath %>">download <%= basename %></a><%
283
286
r = IOUtils . createBOMStrippedReader(in,
284
287
StandardCharsets . UTF_8. name());
285
288
AnalyzerGuru . writeDumpedXref(
286
- request. getContextPath(), a, r, out,
289
+ request. getContextPath(),
290
+ a, r, out,
287
291
defs, annotation, project);
288
292
} else if (g == Genre . IMAGE ) {
289
293
% > </pre >
0 commit comments