@Test public void testGetValue() throws IOException { assertThat(cff.getValue(Value.DOMAIN, Value.NAME), is(Value.VALUE)); assertThat(cff.getValue("test", "failed"), nullValue()); }
public String getValue(String domain, String name) throws IOException { final String QUERY = "SELECT value FROM moz_cookies WHERE host = \"" + domain + "\" AND name = \"" + name + "\""; ResultSet rs = null; String result = null; try { rs = statement.executeQuery(QUERY); if (rs.next()) { result = rs.getString("value"); } } catch(SQLException e) { if (!e.getMessage().contains("no such table")) { throw new IOException(e); } } return result; }
CookieFromFirefox implements Cookie { public String getValue(String domain, String name) throws IOException { final String QUERY = "SELECT value FROM moz_cookies WHERE host = \"" + domain + "\" AND name = \"" + name + "\""; ResultSet rs = null; String result = null; try { rs = statement.executeQuery(QUERY); if (rs.next()) { result = rs.getString("value"); } } catch(SQLException e) { if (!e.getMessage().contains("no such table")) { throw new IOException(e); } } return result; } }
CookieFromFirefox implements Cookie { public String getValue(String domain, String name) throws IOException { final String QUERY = "SELECT value FROM moz_cookies WHERE host = \"" + domain + "\" AND name = \"" + name + "\""; ResultSet rs = null; String result = null; try { rs = statement.executeQuery(QUERY); if (rs.next()) { result = rs.getString("value"); } } catch(SQLException e) { if (!e.getMessage().contains("no such table")) { throw new IOException(e); } } return result; } CookieFromFirefox();  CookieFromFirefox(File cookieFile); }
CookieFromFirefox implements Cookie { public String getValue(String domain, String name) throws IOException { final String QUERY = "SELECT value FROM moz_cookies WHERE host = \"" + domain + "\" AND name = \"" + name + "\""; ResultSet rs = null; String result = null; try { rs = statement.executeQuery(QUERY); if (rs.next()) { result = rs.getString("value"); } } catch(SQLException e) { if (!e.getMessage().contains("no such table")) { throw new IOException(e); } } return result; } CookieFromFirefox();  CookieFromFirefox(File cookieFile); void setFile(File cookieFile); String getValue(String domain, String name); File defaultCookieFilePath(); boolean isCookieFile(byte[] header); void close(); }
CookieFromFirefox implements Cookie { public String getValue(String domain, String name) throws IOException { final String QUERY = "SELECT value FROM moz_cookies WHERE host = \"" + domain + "\" AND name = \"" + name + "\""; ResultSet rs = null; String result = null; try { rs = statement.executeQuery(QUERY); if (rs.next()) { result = rs.getString("value"); } } catch(SQLException e) { if (!e.getMessage().contains("no such table")) { throw new IOException(e); } } return result; } CookieFromFirefox();  CookieFromFirefox(File cookieFile); void setFile(File cookieFile); String getValue(String domain, String name); File defaultCookieFilePath(); boolean isCookieFile(byte[] header); void close();  }