// identifiers.org data
HashMap<String, UrlLink> idData = new HashMap<String, UrlLink>();
+ String errorMessage = null;
try
{
FileReader reader = new FileReader(idFileName);
(String) item.get("prefix"));
idData.put((String) item.get("id"), link);
}
- } catch (FileNotFoundException e)
+ } catch (IOException | ParseException e)
{
- e.printStackTrace();
- idData.clear();
- } catch (IOException e)
- {
- e.printStackTrace();
- idData.clear();
- } catch (ParseException e)
- {
- e.printStackTrace();
+ // unnecessary e.printStackTrace();
+ // Note how in JavaScript we can grab the first bytes from any file reader.
+ // Typical report here is "NetworkError" because the file does not exist.
+ // "https://." is coming from System.getProperty("user.home"), but this could
+ // be set by the page developer to anything, of course.
+ errorMessage = (/** @j2sNative String.fromCharCode.apply(null, reader.$in.is.buf.slice(0,12)) || */e.toString());
idData.clear();
}
+ // BH 2018 -- added more valuable report
+ if (errorMessage != null)
+ System.err.println("IdentifiersUrlProvider: cannot read " + idFileName + ": " + errorMessage);
return idData;
}