@Test public void exception() { Log.SuppressionCounter l = new Log.SuppressionCounter(); Log.registerSuppression(Cache2kVersion.class.getName(), l); Cache2kVersion.parse(new InputStream() { @Override public int read() throws IOException { throw new IOException("ouch"); } }); assertTrue("a warning", l.getWarnCount() > 0); Log.deregisterSuppression(Cache2kVersion.class.getName()); }
static void parse(InputStream in) { if (in != null) { try { Properties p = new Properties(); p.load(in); in.close(); String s = p.getProperty("version"); if (isDefined(s)) { version = s; } } catch (Exception e) { Log.getLog(Cache2kVersion.class).warn("error parsing version properties", e); } } }
Cache2kVersion { static void parse(InputStream in) { if (in != null) { try { Properties p = new Properties(); p.load(in); in.close(); String s = p.getProperty("version"); if (isDefined(s)) { version = s; } } catch (Exception e) { Log.getLog(Cache2kVersion.class).warn("error parsing version properties", e); } } } }
Cache2kVersion { static void parse(InputStream in) { if (in != null) { try { Properties p = new Properties(); p.load(in); in.close(); String s = p.getProperty("version"); if (isDefined(s)) { version = s; } } catch (Exception e) { Log.getLog(Cache2kVersion.class).warn("error parsing version properties", e); } } }  }
Cache2kVersion { static void parse(InputStream in) { if (in != null) { try { Properties p = new Properties(); p.load(in); in.close(); String s = p.getProperty("version"); if (isDefined(s)) { version = s; } } catch (Exception e) { Log.getLog(Cache2kVersion.class).warn("error parsing version properties", e); } } }  static String getVersion(); }
Cache2kVersion { static void parse(InputStream in) { if (in != null) { try { Properties p = new Properties(); p.load(in); in.close(); String s = p.getProperty("version"); if (isDefined(s)) { version = s; } } catch (Exception e) { Log.getLog(Cache2kVersion.class).warn("error parsing version properties", e); } } }  static String getVersion();  }