2020/*
2121 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2222 * Portions Copyright 2011 Jens Elkner.
23- * Portions Copyright (c) 2017-2018 , Chris Fraire <cfraire@me.com>.
23+ * Portions Copyright (c) 2017-2019 , Chris Fraire <cfraire@me.com>.
2424 */
2525
2626package org .opengrok .indexer .search ;
@@ -276,7 +276,7 @@ private static void printPlain(PrintPlainFinalArgs fargs, Document doc,
276276 fargs .morePrefix , true , fargs .tabSize );
277277
278278 if (!didPresentNew ) {
279- /**
279+ /*
280280 * Fall back to the old view, which re-analyzes text using
281281 * PlainLinetokenizer. E.g., when source code is updated (thus
282282 * affecting timestamps) but re-indexing is not yet complete.
@@ -295,12 +295,15 @@ private static void printPlain(PrintPlainFinalArgs fargs, Document doc,
295295 }
296296 boolean isDefSearch = fargs .shelp .builder .isDefSearch ();
297297 // SRCROOT is read with UTF-8 as a default.
298+ File sourceFile = new File (fargs .shelp .sourceRoot , rpath );
298299 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 ())) {
301301 fargs .shelp .sourceContext .getContext (r , fargs .out ,
302302 fargs .xrefPrefix , fargs .morePrefix , rpath , tags , true ,
303303 isDefSearch , null , scopes );
304+ } catch (IOException ex ) {
305+ LOGGER .log (Level .WARNING , String .format ("No context for %s" ,
306+ sourceFile , ex ));
304307 }
305308 }
306309 }
0 commit comments