load known issues from a file. the file must contains one integer per line. lines stating with '#' are ignored. @param file path to the file to load
(String file)
| 29 | * @param file path to the file to load |
| 30 | */ |
| 31 | public void fromFile(String file) { |
| 32 | String line = null; |
| 33 | |
| 34 | try { |
| 35 | BufferedReader reader = new BufferedReader(new FileReader(file)); |
| 36 | |
| 37 | while((line = reader.readLine()) != null) { |
| 38 | line = line.trim(); |
| 39 | |
| 40 | if(line.isEmpty() || line.startsWith("#")) |
| 41 | continue; |
| 42 | |
| 43 | Integer issue = Integer.parseInt(line); |
| 44 | |
| 45 | if(!foundIssues.contains(issue)) { |
| 46 | foundIssues.add(issue); |
| 47 | Logger.info(String.format("issue #%d loaded from file", issue)); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | } catch (FileNotFoundException e) { |
| 52 | // ignored |
| 53 | } catch (IOException e) { |
| 54 | Logger.warning(String.format("unable to read from '%s': %s", file, e.getMessage())); |
| 55 | } catch (NumberFormatException e) { |
| 56 | Logger.error(String.format("unable to parse '%s' as number.", line)); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * check if {@code issue} has been found on this device |