20
20
/*
21
21
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
22
22
* Portions Copyright 2011 Jens Elkner.
23
- * Portions Copyright (c) 2017-2018 , Chris Fraire <[email protected] >.
23
+ * Portions Copyright (c) 2017-2019 , Chris Fraire <[email protected] >.
24
24
*/
25
25
26
26
package org .opengrok .indexer .search ;
@@ -276,7 +276,7 @@ private static void printPlain(PrintPlainFinalArgs fargs, Document doc,
276
276
fargs .morePrefix , true , fargs .tabSize );
277
277
278
278
if (!didPresentNew ) {
279
- /**
279
+ /*
280
280
* Fall back to the old view, which re-analyzes text using
281
281
* PlainLinetokenizer. E.g., when source code is updated (thus
282
282
* affecting timestamps) but re-indexing is not yet complete.
@@ -295,12 +295,15 @@ private static void printPlain(PrintPlainFinalArgs fargs, Document doc,
295
295
}
296
296
boolean isDefSearch = fargs .shelp .builder .isDefSearch ();
297
297
// SRCROOT is read with UTF-8 as a default.
298
+ File sourceFile = new File (fargs .shelp .sourceRoot , rpath );
298
299
try (Reader r = IOUtils .createBOMStrippedReader (new FileInputStream (
299
- new File (fargs .shelp .sourceRoot , rpath )),
300
- StandardCharsets .UTF_8 .name ())) {
300
+ sourceFile ), StandardCharsets .UTF_8 .name ())) {
301
301
fargs .shelp .sourceContext .getContext (r , fargs .out ,
302
302
fargs .xrefPrefix , fargs .morePrefix , rpath , tags , true ,
303
303
isDefSearch , null , scopes );
304
+ } catch (IOException ex ) {
305
+ LOGGER .log (Level .WARNING , String .format ("No context for %s" ,
306
+ sourceFile , ex ));
304
307
}
305
308
}
306
309
}
0 commit comments