id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
17,900
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java
ConnectionFactory.getConnection
public synchronized Connection getConnection() throws DatabaseException { initialize(); Connection conn = null; try { conn = DriverManager.getConnection(connectionString, userName, password); } catch (SQLException ex) { LOGGER.debug("", ex); throw new ...
java
public synchronized Connection getConnection() throws DatabaseException { initialize(); Connection conn = null; try { conn = DriverManager.getConnection(connectionString, userName, password); } catch (SQLException ex) { LOGGER.debug("", ex); throw new ...
[ "public", "synchronized", "Connection", "getConnection", "(", ")", "throws", "DatabaseException", "{", "initialize", "(", ")", ";", "Connection", "conn", "=", "null", ";", "try", "{", "conn", "=", "DriverManager", ".", "getConnection", "(", "connectionString", "...
Constructs a new database connection object per the database configuration. @return a database connection object @throws DatabaseException thrown if there is an exception loading the database connection
[ "Constructs", "a", "new", "database", "connection", "object", "per", "the", "database", "configuration", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java#L230-L240
17,901
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java
ConnectionFactory.h2DataFileExists
public static boolean h2DataFileExists(Settings configuration) throws IOException { final File file = getH2DataFile(configuration); return file.exists(); }
java
public static boolean h2DataFileExists(Settings configuration) throws IOException { final File file = getH2DataFile(configuration); return file.exists(); }
[ "public", "static", "boolean", "h2DataFileExists", "(", "Settings", "configuration", ")", "throws", "IOException", "{", "final", "File", "file", "=", "getH2DataFile", "(", "configuration", ")", ";", "return", "file", ".", "exists", "(", ")", ";", "}" ]
Determines if the H2 database file exists. If it does not exist then the data structure will need to be created. @param configuration the configured settings @return true if the H2 database file does not exist; otherwise false @throws IOException thrown if the data directory does not exist and cannot be created
[ "Determines", "if", "the", "H2", "database", "file", "exists", ".", "If", "it", "does", "not", "exist", "then", "the", "data", "structure", "will", "need", "to", "be", "created", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java#L263-L266
17,902
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java
ConnectionFactory.getH2DataFile
public static File getH2DataFile(Settings configuration) throws IOException { final File dir = configuration.getH2DataDirectory(); final String fileName = configuration.getString(Settings.KEYS.DB_FILE_NAME); final File file = new File(dir, fileName); return file; }
java
public static File getH2DataFile(Settings configuration) throws IOException { final File dir = configuration.getH2DataDirectory(); final String fileName = configuration.getString(Settings.KEYS.DB_FILE_NAME); final File file = new File(dir, fileName); return file; }
[ "public", "static", "File", "getH2DataFile", "(", "Settings", "configuration", ")", "throws", "IOException", "{", "final", "File", "dir", "=", "configuration", ".", "getH2DataDirectory", "(", ")", ";", "final", "String", "fileName", "=", "configuration", ".", "g...
Returns a reference to the H2 database file. @param configuration the configured settings @return the path to the H2 database file @throws IOException thrown if there is an error
[ "Returns", "a", "reference", "to", "the", "H2", "database", "file", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java#L275-L280
17,903
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java
ConnectionFactory.isH2Connection
public static boolean isH2Connection(Settings configuration) { final String connStr; try { connStr = configuration.getConnectionString( Settings.KEYS.DB_CONNECTION_STRING, Settings.KEYS.DB_FILE_NAME); } catch (IOException ex) { LOGG...
java
public static boolean isH2Connection(Settings configuration) { final String connStr; try { connStr = configuration.getConnectionString( Settings.KEYS.DB_CONNECTION_STRING, Settings.KEYS.DB_FILE_NAME); } catch (IOException ex) { LOGG...
[ "public", "static", "boolean", "isH2Connection", "(", "Settings", "configuration", ")", "{", "final", "String", "connStr", ";", "try", "{", "connStr", "=", "configuration", ".", "getConnectionString", "(", "Settings", ".", "KEYS", ".", "DB_CONNECTION_STRING", ",",...
Determines if the connection string is for an H2 database. @param configuration the configured settings @return true if the connection string is for an H2 database
[ "Determines", "if", "the", "connection", "string", "is", "for", "an", "H2", "database", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java#L297-L308
17,904
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java
ConnectionFactory.ensureSchemaVersion
private void ensureSchemaVersion(Connection conn) throws DatabaseException { ResultSet rs = null; PreparedStatement ps = null; try { //TODO convert this to use DatabaseProperties ps = conn.prepareStatement("SELECT value FROM properties WHERE id = 'version'"); ...
java
private void ensureSchemaVersion(Connection conn) throws DatabaseException { ResultSet rs = null; PreparedStatement ps = null; try { //TODO convert this to use DatabaseProperties ps = conn.prepareStatement("SELECT value FROM properties WHERE id = 'version'"); ...
[ "private", "void", "ensureSchemaVersion", "(", "Connection", "conn", ")", "throws", "DatabaseException", "{", "ResultSet", "rs", "=", "null", ";", "PreparedStatement", "ps", "=", "null", ";", "try", "{", "//TODO convert this to use DatabaseProperties", "ps", "=", "c...
Uses the provided connection to check the specified schema version within the database. @param conn the database connection object @throws DatabaseException thrown if the schema version is not compatible with this version of dependency-check
[ "Uses", "the", "provided", "connection", "to", "check", "the", "specified", "schema", "version", "within", "the", "database", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.java#L405-L440
17,905
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/NexusAnalyzer.java
NexusAnalyzer.checkEnabled
private boolean checkEnabled() { /* Enable this analyzer ONLY if the Nexus URL has been set to something other than the default one (if it's the default one, we'll use the central one) and it's enabled by the user. */ boolean retval = false; try { if (!DEFA...
java
private boolean checkEnabled() { /* Enable this analyzer ONLY if the Nexus URL has been set to something other than the default one (if it's the default one, we'll use the central one) and it's enabled by the user. */ boolean retval = false; try { if (!DEFA...
[ "private", "boolean", "checkEnabled", "(", ")", "{", "/* Enable this analyzer ONLY if the Nexus URL has been set to something\n other than the default one (if it's the default one, we'll use the\n central one) and it's enabled by the user.\n */", "boolean", "retval", "=", ...
Determines if this analyzer is enabled @return <code>true</code> if the analyzer is enabled; otherwise <code>false</code>
[ "Determines", "if", "this", "analyzer", "is", "enabled" ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/NexusAnalyzer.java#L125-L144
17,906
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/NexusAnalyzer.java
NexusAnalyzer.useProxy
public boolean useProxy() { try { return getSettings().getString(Settings.KEYS.PROXY_SERVER) != null && getSettings().getBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY); } catch (InvalidSettingException ise) { LOGGER.warn("Failed to parse proxy settings.", is...
java
public boolean useProxy() { try { return getSettings().getString(Settings.KEYS.PROXY_SERVER) != null && getSettings().getBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY); } catch (InvalidSettingException ise) { LOGGER.warn("Failed to parse proxy settings.", is...
[ "public", "boolean", "useProxy", "(", ")", "{", "try", "{", "return", "getSettings", "(", ")", ".", "getString", "(", "Settings", ".", "KEYS", ".", "PROXY_SERVER", ")", "!=", "null", "&&", "getSettings", "(", ")", ".", "getBoolean", "(", "Settings", ".",...
Determine if a proxy should be used for the Nexus Analyzer. @return {@code true} if a proxy should be used
[ "Determine", "if", "a", "proxy", "should", "be", "used", "for", "the", "Nexus", "Analyzer", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/NexusAnalyzer.java#L288-L296
17,907
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/update/RetireJSDataSource.java
RetireJSDataSource.update
@Override public boolean update(Engine engine) throws UpdateException { this.settings = engine.getSettings(); String url = null; try { final boolean autoupdate = settings.getBoolean(Settings.KEYS.AUTO_UPDATE, true); final boolean enabled = settings.getBoolean(Settings...
java
@Override public boolean update(Engine engine) throws UpdateException { this.settings = engine.getSettings(); String url = null; try { final boolean autoupdate = settings.getBoolean(Settings.KEYS.AUTO_UPDATE, true); final boolean enabled = settings.getBoolean(Settings...
[ "@", "Override", "public", "boolean", "update", "(", "Engine", "engine", ")", "throws", "UpdateException", "{", "this", ".", "settings", "=", "engine", ".", "getSettings", "(", ")", ";", "String", "url", "=", "null", ";", "try", "{", "final", "boolean", ...
Downloads the current RetireJS data source. @return returns false as no updates are made to the database that would require compaction @throws UpdateException thrown if the update failed
[ "Downloads", "the", "current", "RetireJS", "data", "source", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/update/RetireJSDataSource.java#L89-L111
17,908
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/update/RetireJSDataSource.java
RetireJSDataSource.shouldUpdagte
protected boolean shouldUpdagte(File repo) throws NumberFormatException { boolean proceed = true; if (repo != null && repo.isFile()) { final int validForHours = settings.getInt(Settings.KEYS.ANALYZER_RETIREJS_REPO_VALID_FOR_HOURS, 0); final long lastUpdatedOn = repo.lastModified(...
java
protected boolean shouldUpdagte(File repo) throws NumberFormatException { boolean proceed = true; if (repo != null && repo.isFile()) { final int validForHours = settings.getInt(Settings.KEYS.ANALYZER_RETIREJS_REPO_VALID_FOR_HOURS, 0); final long lastUpdatedOn = repo.lastModified(...
[ "protected", "boolean", "shouldUpdagte", "(", "File", "repo", ")", "throws", "NumberFormatException", "{", "boolean", "proceed", "=", "true", ";", "if", "(", "repo", "!=", "null", "&&", "repo", ".", "isFile", "(", ")", ")", "{", "final", "int", "validForHo...
Determines if the we should update the RetireJS database. @param repo the retire JS repository. @return <code>true</code> if an updated to the RetireJS database should be performed; otherwise <code>false</code> @throws NumberFormatException thrown if an invalid value is contained in the database properties
[ "Determines", "if", "the", "we", "should", "update", "the", "RetireJS", "database", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/update/RetireJSDataSource.java#L122-L137
17,909
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/update/RetireJSDataSource.java
RetireJSDataSource.initializeRetireJsRepo
private void initializeRetireJsRepo(Settings settings, URL repoUrl) throws UpdateException { try { final File dataDir = settings.getDataDirectory(); final File tmpDir = settings.getTempDirectory(); boolean useProxy = false; if (null != settings.getString(Settings....
java
private void initializeRetireJsRepo(Settings settings, URL repoUrl) throws UpdateException { try { final File dataDir = settings.getDataDirectory(); final File tmpDir = settings.getTempDirectory(); boolean useProxy = false; if (null != settings.getString(Settings....
[ "private", "void", "initializeRetireJsRepo", "(", "Settings", "settings", ",", "URL", "repoUrl", ")", "throws", "UpdateException", "{", "try", "{", "final", "File", "dataDir", "=", "settings", ".", "getDataDirectory", "(", ")", ";", "final", "File", "tmpDir", ...
Initializes the local RetireJS repository @param settings a reference to the dependency-check settings @param repoUrl the URL to the RetireJS repo to use @throws UpdateException thrown if there is an exception during initialization
[ "Initializes", "the", "local", "RetireJS", "repository" ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/update/RetireJSDataSource.java#L147-L176
17,910
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/AbstractAnalyzer.java
AbstractAnalyzer.prepare
@Override public final void prepare(Engine engine) throws InitializationException { if (isEnabled()) { prepareAnalyzer(engine); } else { LOGGER.debug("{} has been disabled", getName()); } }
java
@Override public final void prepare(Engine engine) throws InitializationException { if (isEnabled()) { prepareAnalyzer(engine); } else { LOGGER.debug("{} has been disabled", getName()); } }
[ "@", "Override", "public", "final", "void", "prepare", "(", "Engine", "engine", ")", "throws", "InitializationException", "{", "if", "(", "isEnabled", "(", ")", ")", "{", "prepareAnalyzer", "(", "engine", ")", ";", "}", "else", "{", "LOGGER", ".", "debug",...
Initialize the abstract analyzer. @param engine a reference to the dependency-check engine @throws InitializationException thrown if there is an exception
[ "Initialize", "the", "abstract", "analyzer", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AbstractAnalyzer.java#L104-L111
17,911
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/nvdcve/DriverShim.java
DriverShim.getParentLogger
@Override public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException { //return driver.getParentLogger(); Method m = null; try { m = driver.getClass().getMethod("getParentLogger"); } catch (Throwable e) { throw new SQLFeatureNotSu...
java
@Override public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException { //return driver.getParentLogger(); Method m = null; try { m = driver.getClass().getMethod("getParentLogger"); } catch (Throwable e) { throw new SQLFeatureNotSu...
[ "@", "Override", "public", "java", ".", "util", ".", "logging", ".", "Logger", "getParentLogger", "(", ")", "throws", "SQLFeatureNotSupportedException", "{", "//return driver.getParentLogger();", "Method", "m", "=", "null", ";", "try", "{", "m", "=", "driver", "...
Wraps the call to the underlying driver's getParentLogger method. @return the parent's Logger @throws SQLFeatureNotSupportedException thrown if the feature is not supported @see java.sql.Driver#getParentLogger()
[ "Wraps", "the", "call", "to", "the", "underlying", "driver", "s", "getParentLogger", "method", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nvdcve/DriverShim.java#L124-L141
17,912
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java
DBUtils.getGeneratedKey
public static int getGeneratedKey(PreparedStatement statement) throws DatabaseException { ResultSet rs = null; int id = 0; try { rs = statement.getGeneratedKeys(); if (!rs.next()) { throw new DatabaseException("Unable to get primary key for inserted row");...
java
public static int getGeneratedKey(PreparedStatement statement) throws DatabaseException { ResultSet rs = null; int id = 0; try { rs = statement.getGeneratedKeys(); if (!rs.next()) { throw new DatabaseException("Unable to get primary key for inserted row");...
[ "public", "static", "int", "getGeneratedKey", "(", "PreparedStatement", "statement", ")", "throws", "DatabaseException", "{", "ResultSet", "rs", "=", "null", ";", "int", "id", "=", "0", ";", "try", "{", "rs", "=", "statement", ".", "getGeneratedKeys", "(", "...
Returns the generated integer primary key for a newly inserted row. @param statement a prepared statement that just executed an insert @return a primary key @throws DatabaseException thrown if there is an exception obtaining the key
[ "Returns", "the", "generated", "integer", "primary", "key", "for", "a", "newly", "inserted", "row", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java#L56-L71
17,913
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java
DBUtils.closeStatement
public static void closeStatement(Statement statement) { try { if (statement != null && !statement.isClosed()) { statement.close(); } } catch (SQLException ex) { LOGGER.trace(statement.toString(), ex); } }
java
public static void closeStatement(Statement statement) { try { if (statement != null && !statement.isClosed()) { statement.close(); } } catch (SQLException ex) { LOGGER.trace(statement.toString(), ex); } }
[ "public", "static", "void", "closeStatement", "(", "Statement", "statement", ")", "{", "try", "{", "if", "(", "statement", "!=", "null", "&&", "!", "statement", ".", "isClosed", "(", ")", ")", "{", "statement", ".", "close", "(", ")", ";", "}", "}", ...
Closes the given statement object ignoring any exceptions that occur. @param statement a Statement object
[ "Closes", "the", "given", "statement", "object", "ignoring", "any", "exceptions", "that", "occur", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java#L78-L87
17,914
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java
DBUtils.closeResultSet
public static void closeResultSet(ResultSet rs) { try { if (rs != null && !rs.isClosed()) { rs.close(); } } catch (SQLException ex) { LOGGER.trace(rs.toString(), ex); } }
java
public static void closeResultSet(ResultSet rs) { try { if (rs != null && !rs.isClosed()) { rs.close(); } } catch (SQLException ex) { LOGGER.trace(rs.toString(), ex); } }
[ "public", "static", "void", "closeResultSet", "(", "ResultSet", "rs", ")", "{", "try", "{", "if", "(", "rs", "!=", "null", "&&", "!", "rs", ".", "isClosed", "(", ")", ")", "{", "rs", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "SQLExcept...
Closes the result set capturing and ignoring any SQLExceptions that occur. @param rs a ResultSet to close
[ "Closes", "the", "result", "set", "capturing", "and", "ignoring", "any", "SQLExceptions", "that", "occur", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java#L95-L103
17,915
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
EscapeTool.url
public String url(String text) { if (text == null || text.isEmpty()) { return text; } try { return URLEncoder.encode(text, UTF_8); } catch (UnsupportedEncodingException ex) { LOGGER.warn("UTF-8 is not supported?"); LOGGER.info("", ex); ...
java
public String url(String text) { if (text == null || text.isEmpty()) { return text; } try { return URLEncoder.encode(text, UTF_8); } catch (UnsupportedEncodingException ex) { LOGGER.warn("UTF-8 is not supported?"); LOGGER.info("", ex); ...
[ "public", "String", "url", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "isEmpty", "(", ")", ")", "{", "return", "text", ";", "}", "try", "{", "return", "URLEncoder", ".", "encode", "(", "text", ",", "UTF_8",...
URL Encodes the provided text. @param text the text to encode @return the URL encoded text
[ "URL", "Encodes", "the", "provided", "text", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java#L51-L62
17,916
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
EscapeTool.html
public String html(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeHtml4(text); }
java
public String html(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeHtml4(text); }
[ "public", "String", "html", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "isEmpty", "(", ")", ")", "{", "return", "text", ";", "}", "return", "StringEscapeUtils", ".", "escapeHtml4", "(", "text", ")", ";", "}" ...
HTML Encodes the provided text. @param text the text to encode @return the HTML encoded text
[ "HTML", "Encodes", "the", "provided", "text", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java#L70-L75
17,917
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
EscapeTool.xml
public String xml(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeXml11(text); }
java
public String xml(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeXml11(text); }
[ "public", "String", "xml", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "isEmpty", "(", ")", ")", "{", "return", "text", ";", "}", "return", "StringEscapeUtils", ".", "escapeXml11", "(", "text", ")", ";", "}" ]
XML Encodes the provided text. @param text the text to encode @return the XML encoded text
[ "XML", "Encodes", "the", "provided", "text", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java#L83-L88
17,918
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
EscapeTool.json
public String json(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeJson(text); }
java
public String json(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeJson(text); }
[ "public", "String", "json", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "isEmpty", "(", ")", ")", "{", "return", "text", ";", "}", "return", "StringEscapeUtils", ".", "escapeJson", "(", "text", ")", ";", "}" ]
JSON Encodes the provided text. @param text the text to encode @return the JSON encoded text
[ "JSON", "Encodes", "the", "provided", "text", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java#L96-L101
17,919
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
EscapeTool.javascript
public String javascript(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeEcmaScript(text); }
java
public String javascript(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeEcmaScript(text); }
[ "public", "String", "javascript", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "isEmpty", "(", ")", ")", "{", "return", "text", ";", "}", "return", "StringEscapeUtils", ".", "escapeEcmaScript", "(", "text", ")", ...
JavaScript encodes the provided text. @param text the text to encode @return the JavaScript encoded text
[ "JavaScript", "encodes", "the", "provided", "text", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java#L109-L114
17,920
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
EscapeTool.csvIdentifiers
public String csvIdentifiers(Set<Identifier> ids) { if (ids == null || ids.isEmpty()) { return "\"\""; } boolean addComma = false; final StringBuilder sb = new StringBuilder(); for (Identifier id : ids) { if (addComma) { sb.append(", "); ...
java
public String csvIdentifiers(Set<Identifier> ids) { if (ids == null || ids.isEmpty()) { return "\"\""; } boolean addComma = false; final StringBuilder sb = new StringBuilder(); for (Identifier id : ids) { if (addComma) { sb.append(", "); ...
[ "public", "String", "csvIdentifiers", "(", "Set", "<", "Identifier", ">", "ids", ")", "{", "if", "(", "ids", "==", "null", "||", "ids", ".", "isEmpty", "(", ")", ")", "{", "return", "\"\\\"\\\"\"", ";", "}", "boolean", "addComma", "=", "false", ";", ...
Takes a set of Identifiers, filters them to none CPE, and formats them for display in a CSV. @param ids the set of identifiers @return the formatted list of none CPE identifiers
[ "Takes", "a", "set", "of", "Identifiers", "filters", "them", "to", "none", "CPE", "and", "formats", "them", "for", "display", "in", "a", "CSV", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java#L142-L160
17,921
jeremylong/DependencyCheck
maven/src/main/java/org/owasp/dependencycheck/maven/AggregateMojo.java
AggregateMojo.scanDependencies
@Override protected ExceptionCollection scanDependencies(final Engine engine) throws MojoExecutionException { ExceptionCollection exCol = scanArtifacts(getProject(), engine, true); for (MavenProject childProject : getDescendants(this.getProject())) { final ExceptionCollection ex = scanAr...
java
@Override protected ExceptionCollection scanDependencies(final Engine engine) throws MojoExecutionException { ExceptionCollection exCol = scanArtifacts(getProject(), engine, true); for (MavenProject childProject : getDescendants(this.getProject())) { final ExceptionCollection ex = scanAr...
[ "@", "Override", "protected", "ExceptionCollection", "scanDependencies", "(", "final", "Engine", "engine", ")", "throws", "MojoExecutionException", "{", "ExceptionCollection", "exCol", "=", "scanArtifacts", "(", "getProject", "(", ")", ",", "engine", ",", "true", ")...
Scans the dependencies of the projects in aggregate. @param engine the engine used to perform the scanning @return a collection of exceptions @throws MojoExecutionException thrown if a fatal exception occurs
[ "Scans", "the", "dependencies", "of", "the", "projects", "in", "aggregate", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/AggregateMojo.java#L65-L89
17,922
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java
ArchiveAnalyzer.closeAnalyzer
@Override public void closeAnalyzer() throws Exception { if (tempFileLocation != null && tempFileLocation.exists()) { LOGGER.debug("Attempting to delete temporary files from `{}`", tempFileLocation.toString()); final boolean success = FileUtils.delete(tempFileLocation); i...
java
@Override public void closeAnalyzer() throws Exception { if (tempFileLocation != null && tempFileLocation.exists()) { LOGGER.debug("Attempting to delete temporary files from `{}`", tempFileLocation.toString()); final boolean success = FileUtils.delete(tempFileLocation); i...
[ "@", "Override", "public", "void", "closeAnalyzer", "(", ")", "throws", "Exception", "{", "if", "(", "tempFileLocation", "!=", "null", "&&", "tempFileLocation", ".", "exists", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"Attempting to delete temporary fil...
The close method deletes any temporary files and directories created during analysis. @throws Exception thrown if there is an exception deleting temporary files
[ "The", "close", "method", "deletes", "any", "temporary", "files", "and", "directories", "created", "during", "analysis", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java#L207-L220
17,923
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java
ArchiveAnalyzer.extractAndAnalyze
private void extractAndAnalyze(Dependency dependency, Engine engine, int scanDepth) throws AnalysisException { final File f = new File(dependency.getActualFilePath()); final File tmpDir = getNextTempDirectory(); extractFiles(f, tmpDir, engine); //make a copy final List<Dependenc...
java
private void extractAndAnalyze(Dependency dependency, Engine engine, int scanDepth) throws AnalysisException { final File f = new File(dependency.getActualFilePath()); final File tmpDir = getNextTempDirectory(); extractFiles(f, tmpDir, engine); //make a copy final List<Dependenc...
[ "private", "void", "extractAndAnalyze", "(", "Dependency", "dependency", ",", "Engine", "engine", ",", "int", "scanDepth", ")", "throws", "AnalysisException", "{", "final", "File", "f", "=", "new", "File", "(", "dependency", ".", "getActualFilePath", "(", ")", ...
Extracts the contents of the archive dependency and scans for additional dependencies. @param dependency the dependency being analyzed @param engine the engine doing the analysis @param scanDepth the current scan depth; extracctAndAnalyze is recursive and will, be default, only go 3 levels deep @throws AnalysisExcepti...
[ "Extracts", "the", "contents", "of", "the", "archive", "dependency", "and", "scans", "for", "additional", "dependencies", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java#L248-L288
17,924
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java
PythonDistributionAnalyzer.collectMetadataFromArchiveFormat
private void collectMetadataFromArchiveFormat(Dependency dependency, FilenameFilter folderFilter, FilenameFilter metadataFilter) throws AnalysisException { final File temp = getNextTempDirectory(); LOGGER.debug("{} exists? {}", temp, temp.exists()); try { Extr...
java
private void collectMetadataFromArchiveFormat(Dependency dependency, FilenameFilter folderFilter, FilenameFilter metadataFilter) throws AnalysisException { final File temp = getNextTempDirectory(); LOGGER.debug("{} exists? {}", temp, temp.exists()); try { Extr...
[ "private", "void", "collectMetadataFromArchiveFormat", "(", "Dependency", "dependency", ",", "FilenameFilter", "folderFilter", ",", "FilenameFilter", "metadataFilter", ")", "throws", "AnalysisException", "{", "final", "File", "temp", "=", "getNextTempDirectory", "(", ")",...
Collects the meta data from an archive. @param dependency the archive being scanned @param folderFilter the filter to apply to the folder @param metadataFilter the filter to apply to the meta data @throws AnalysisException thrown when there is a problem analyzing the dependency
[ "Collects", "the", "meta", "data", "from", "an", "archive", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java#L215-L235
17,925
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java
PythonDistributionAnalyzer.prepareFileTypeAnalyzer
@Override protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { try { final File baseDir = getSettings().getTempDirectory(); tempFileLocation = File.createTempFile("check", "tmp", baseDir); if (!tempFileLocation.delete()) { ...
java
@Override protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { try { final File baseDir = getSettings().getTempDirectory(); tempFileLocation = File.createTempFile("check", "tmp", baseDir); if (!tempFileLocation.delete()) { ...
[ "@", "Override", "protected", "void", "prepareFileTypeAnalyzer", "(", "Engine", "engine", ")", "throws", "InitializationException", "{", "try", "{", "final", "File", "baseDir", "=", "getSettings", "(", ")", ".", "getTempDirectory", "(", ")", ";", "tempFileLocation...
Makes sure a usable temporary directory is available. @param engine a reference to the dependency-check engine @throws InitializationException an AnalyzeException is thrown when the temp directory cannot be created
[ "Makes", "sure", "a", "usable", "temporary", "directory", "is", "available", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java#L244-L267
17,926
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java
PythonDistributionAnalyzer.collectWheelMetadata
private static void collectWheelMetadata(Dependency dependency, File file) { final InternetHeaders headers = getManifestProperties(file); addPropertyToEvidence(dependency, EvidenceType.VERSION, Confidence.HIGHEST, headers, "Version"); addPropertyToEvidence(dependency, EvidenceType.PRODUCT, Confi...
java
private static void collectWheelMetadata(Dependency dependency, File file) { final InternetHeaders headers = getManifestProperties(file); addPropertyToEvidence(dependency, EvidenceType.VERSION, Confidence.HIGHEST, headers, "Version"); addPropertyToEvidence(dependency, EvidenceType.PRODUCT, Confi...
[ "private", "static", "void", "collectWheelMetadata", "(", "Dependency", "dependency", ",", "File", "file", ")", "{", "final", "InternetHeaders", "headers", "=", "getManifestProperties", "(", "file", ")", ";", "addPropertyToEvidence", "(", "dependency", ",", "Evidenc...
Gathers evidence from the METADATA file. @param dependency the dependency being analyzed @param file a reference to the manifest/properties file
[ "Gathers", "evidence", "from", "the", "METADATA", "file", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java#L292-L326
17,927
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java
PythonDistributionAnalyzer.addPropertyToEvidence
private static void addPropertyToEvidence(Dependency dependency, EvidenceType type, Confidence confidence, InternetHeaders headers, String property) { final String value = headers.getHeader(property, null); LOGGER.debug("Property: {}, Value: {}", property, value); if (StringUtils.isN...
java
private static void addPropertyToEvidence(Dependency dependency, EvidenceType type, Confidence confidence, InternetHeaders headers, String property) { final String value = headers.getHeader(property, null); LOGGER.debug("Property: {}, Value: {}", property, value); if (StringUtils.isN...
[ "private", "static", "void", "addPropertyToEvidence", "(", "Dependency", "dependency", ",", "EvidenceType", "type", ",", "Confidence", "confidence", ",", "InternetHeaders", "headers", ",", "String", "property", ")", "{", "final", "String", "value", "=", "headers", ...
Adds a value to the evidence collection. @param dependency the dependency being analyzed @param type the type of evidence to add @param confidence the confidence in the evidence being added @param headers the properties collection @param property the property name
[ "Adds", "a", "value", "to", "the", "evidence", "collection", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java#L337-L344
17,928
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java
PythonDistributionAnalyzer.getMatchingFile
private static File getMatchingFile(File folder, FilenameFilter filter) { File result = null; final File[] matches = folder.listFiles(filter); if (null != matches && 1 == matches.length) { result = matches[0]; } return result; }
java
private static File getMatchingFile(File folder, FilenameFilter filter) { File result = null; final File[] matches = folder.listFiles(filter); if (null != matches && 1 == matches.length) { result = matches[0]; } return result; }
[ "private", "static", "File", "getMatchingFile", "(", "File", "folder", ",", "FilenameFilter", "filter", ")", "{", "File", "result", "=", "null", ";", "final", "File", "[", "]", "matches", "=", "folder", ".", "listFiles", "(", "filter", ")", ";", "if", "(...
Returns a list of files that match the given filter, this does not recursively scan the directory. @param folder the folder to filter @param filter the filter to apply to the files in the directory @return the list of Files in the directory that match the provided filter
[ "Returns", "a", "list", "of", "files", "that", "match", "the", "given", "filter", "this", "does", "not", "recursively", "scan", "the", "directory", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java#L354-L361
17,929
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java
PythonDistributionAnalyzer.getManifestProperties
private static InternetHeaders getManifestProperties(File manifest) { final InternetHeaders result = new InternetHeaders(); if (null == manifest) { LOGGER.debug("Manifest file not found."); } else { try (InputStream in = new BufferedInputStream(new FileInputStream(manifes...
java
private static InternetHeaders getManifestProperties(File manifest) { final InternetHeaders result = new InternetHeaders(); if (null == manifest) { LOGGER.debug("Manifest file not found."); } else { try (InputStream in = new BufferedInputStream(new FileInputStream(manifes...
[ "private", "static", "InternetHeaders", "getManifestProperties", "(", "File", "manifest", ")", "{", "final", "InternetHeaders", "result", "=", "new", "InternetHeaders", "(", ")", ";", "if", "(", "null", "==", "manifest", ")", "{", "LOGGER", ".", "debug", "(", ...
Reads the manifest entries from the provided file. @param manifest the manifest @return the manifest entries
[ "Reads", "the", "manifest", "entries", "from", "the", "provided", "file", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java#L369-L383
17,930
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java
PythonDistributionAnalyzer.getNextTempDirectory
private File getNextTempDirectory() throws AnalysisException { File directory; // getting an exception for some directories not being able to be // created; might be because the directory already exists? do { final int dirCount = DIR_COUNT.incrementAndGet(); dire...
java
private File getNextTempDirectory() throws AnalysisException { File directory; // getting an exception for some directories not being able to be // created; might be because the directory already exists? do { final int dirCount = DIR_COUNT.incrementAndGet(); dire...
[ "private", "File", "getNextTempDirectory", "(", ")", "throws", "AnalysisException", "{", "File", "directory", ";", "// getting an exception for some directories not being able to be", "// created; might be because the directory already exists?", "do", "{", "final", "int", "dirCount...
Retrieves the next temporary destination directory for extracting an archive. @return a directory @throws AnalysisException thrown if unable to create temporary directory
[ "Retrieves", "the", "next", "temporary", "destination", "directory", "for", "extracting", "an", "archive", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java#L392-L407
17,931
jeremylong/DependencyCheck
ant/src/main/java/org/owasp/dependencycheck/taskdefs/Purge.java
Purge.execute
@Override public void execute() throws BuildException { populateSettings(); final File db; try { db = new File(getSettings().getDataDirectory(), getSettings().getString(Settings.KEYS.DB_FILE_NAME, "odc.mv.db")); if (db.exists()) { if (db.delete()) { ...
java
@Override public void execute() throws BuildException { populateSettings(); final File db; try { db = new File(getSettings().getDataDirectory(), getSettings().getString(Settings.KEYS.DB_FILE_NAME, "odc.mv.db")); if (db.exists()) { if (db.delete()) { ...
[ "@", "Override", "public", "void", "execute", "(", ")", "throws", "BuildException", "{", "populateSettings", "(", ")", ";", "final", "File", "db", ";", "try", "{", "db", "=", "new", "File", "(", "getSettings", "(", ")", ".", "getDataDirectory", "(", ")",...
Executes the dependency-check purge to delete the existing local copy of the NVD CVE data. @throws BuildException thrown if there is a problem deleting the file(s)
[ "Executes", "the", "dependency", "-", "check", "purge", "to", "delete", "the", "existing", "local", "copy", "of", "the", "NVD", "CVE", "data", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/ant/src/main/java/org/owasp/dependencycheck/taskdefs/Purge.java#L112-L144
17,932
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/suppression/PropertyType.java
PropertyType.matches
public boolean matches(String text) { if (text == null) { return false; } if (this.regex) { final Pattern rx; if (this.caseSensitive) { rx = Pattern.compile(this.value); } else { rx = Pattern.compile(this.value, Patt...
java
public boolean matches(String text) { if (text == null) { return false; } if (this.regex) { final Pattern rx; if (this.caseSensitive) { rx = Pattern.compile(this.value); } else { rx = Pattern.compile(this.value, Patt...
[ "public", "boolean", "matches", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "this", ".", "regex", ")", "{", "final", "Pattern", "rx", ";", "if", "(", "this", ".", "caseSensitiv...
Uses the object's properties to determine if the supplied string matches the value of this property. @param text the String to validate @return whether the text supplied is matched by the value of the property
[ "Uses", "the", "object", "s", "properties", "to", "determine", "if", "the", "supplied", "string", "matches", "the", "value", "of", "this", "property", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/suppression/PropertyType.java#L114-L133
17,933
jeremylong/DependencyCheck
ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java
Check.getPath
private synchronized Resources getPath() { if (path == null) { path = new Resources(getProject()); path.setCache(true); } return path; }
java
private synchronized Resources getPath() { if (path == null) { path = new Resources(getProject()); path.setCache(true); } return path; }
[ "private", "synchronized", "Resources", "getPath", "(", ")", "{", "if", "(", "path", "==", "null", ")", "{", "path", "=", "new", "Resources", "(", "getProject", "(", ")", ")", ";", "path", ".", "setCache", "(", "true", ")", ";", "}", "return", "path"...
Returns the path. If the path has not been initialized yet, this class is synchronized, and will instantiate the path object. @return the path
[ "Returns", "the", "path", ".", "If", "the", "path", "has", "not", "been", "initialized", "yet", "this", "class", "is", "synchronized", "and", "will", "instantiate", "the", "path", "object", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java#L313-L319
17,934
jeremylong/DependencyCheck
ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java
Check.dealWithReferences
private void dealWithReferences() throws BuildException { if (isReference()) { final Object o = refId.getReferencedObject(getProject()); if (!(o instanceof ResourceCollection)) { throw new BuildException("refId '" + refId.getRefId() + "' does not r...
java
private void dealWithReferences() throws BuildException { if (isReference()) { final Object o = refId.getReferencedObject(getProject()); if (!(o instanceof ResourceCollection)) { throw new BuildException("refId '" + refId.getRefId() + "' does not r...
[ "private", "void", "dealWithReferences", "(", ")", "throws", "BuildException", "{", "if", "(", "isReference", "(", ")", ")", "{", "final", "Object", "o", "=", "refId", ".", "getReferencedObject", "(", "getProject", "(", ")", ")", ";", "if", "(", "!", "("...
If this is a reference, this method will add the referenced resource collection to the collection of paths. @throws BuildException if the reference is not to a resource collection
[ "If", "this", "is", "a", "reference", "this", "method", "will", "add", "the", "referenced", "resource", "collection", "to", "the", "collection", "of", "paths", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java#L349-L358
17,935
jeremylong/DependencyCheck
ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java
Check.setNspAnalyzerEnabled
@Deprecated public void setNspAnalyzerEnabled(Boolean nodeAnalyzerEnabled) { log("The NspAnalyzerEnabled configuration has been deprecated and replaced by NodeAuditAnalyzerEnabled", Project.MSG_ERR); log("The NspAnalyzerEnabled configuration will be removed in the next major release"); this....
java
@Deprecated public void setNspAnalyzerEnabled(Boolean nodeAnalyzerEnabled) { log("The NspAnalyzerEnabled configuration has been deprecated and replaced by NodeAuditAnalyzerEnabled", Project.MSG_ERR); log("The NspAnalyzerEnabled configuration will be removed in the next major release"); this....
[ "@", "Deprecated", "public", "void", "setNspAnalyzerEnabled", "(", "Boolean", "nodeAnalyzerEnabled", ")", "{", "log", "(", "\"The NspAnalyzerEnabled configuration has been deprecated and replaced by NodeAuditAnalyzerEnabled\"", ",", "Project", ".", "MSG_ERR", ")", ";", "log", ...
Set the value of nodeAnalyzerEnabled. @param nodeAnalyzerEnabled new value of nodeAnalyzerEnabled @deprecated As of release 3.3.3, replaced by {@link #setNodeAuditAnalyzerEnabled(java.lang.Boolean)}
[ "Set", "the", "value", "of", "nodeAnalyzerEnabled", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java#L831-L836
17,936
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java
H2DBLock.lock
public void lock() throws H2DBLockException { try { final File dir = settings.getDataDirectory(); lockFile = new File(dir, "odc.update.lock"); checkState(); int ctr = 0; do { try { if (!lockFile.exists() && lockFile....
java
public void lock() throws H2DBLockException { try { final File dir = settings.getDataDirectory(); lockFile = new File(dir, "odc.update.lock"); checkState(); int ctr = 0; do { try { if (!lockFile.exists() && lockFile....
[ "public", "void", "lock", "(", ")", "throws", "H2DBLockException", "{", "try", "{", "final", "File", "dir", "=", "settings", ".", "getDataDirectory", "(", ")", ";", "lockFile", "=", "new", "File", "(", "dir", ",", "\"odc.update.lock\"", ")", ";", "checkSta...
Obtains a lock on the H2 database. @throws H2DBLockException thrown if a lock could not be obtained
[ "Obtains", "a", "lock", "on", "the", "H2", "database", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java#L107-L163
17,937
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java
H2DBLock.checkState
private void checkState() throws H2DBLockException { if (!lockFile.getParentFile().isDirectory() && !lockFile.mkdir()) { throw new H2DBLockException("Unable to create path to data directory."); } if (lockFile.isFile()) { //TODO - this 30 minute check needs to be configura...
java
private void checkState() throws H2DBLockException { if (!lockFile.getParentFile().isDirectory() && !lockFile.mkdir()) { throw new H2DBLockException("Unable to create path to data directory."); } if (lockFile.isFile()) { //TODO - this 30 minute check needs to be configura...
[ "private", "void", "checkState", "(", ")", "throws", "H2DBLockException", "{", "if", "(", "!", "lockFile", ".", "getParentFile", "(", ")", ".", "isDirectory", "(", ")", "&&", "!", "lockFile", ".", "mkdir", "(", ")", ")", "{", "throw", "new", "H2DBLockExc...
Checks the state of the custom h2 lock file and under some conditions will attempt to remove the lock file. @throws H2DBLockException thrown if the lock directory does not exist and cannot be created
[ "Checks", "the", "state", "of", "the", "custom", "h2", "lock", "file", "and", "under", "some", "conditions", "will", "attempt", "to", "remove", "the", "lock", "file", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java#L172-L189
17,938
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java
H2DBLock.release
public void release() { if (lock != null) { try { lock.release(); lock = null; } catch (IOException ex) { LOGGER.debug("Failed to release lock", ex); } } if (file != null) { try { file...
java
public void release() { if (lock != null) { try { lock.release(); lock = null; } catch (IOException ex) { LOGGER.debug("Failed to release lock", ex); } } if (file != null) { try { file...
[ "public", "void", "release", "(", ")", "{", "if", "(", "lock", "!=", "null", ")", "{", "try", "{", "lock", ".", "release", "(", ")", ";", "lock", "=", "null", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LOGGER", ".", "debug", "(", "...
Releases the lock on the H2 database.
[ "Releases", "the", "lock", "on", "the", "H2", "database", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java#L194-L222
17,939
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java
H2DBLock.readLockFile
private String readLockFile() { String msg = null; try (RandomAccessFile f = new RandomAccessFile(lockFile, "rw")) { msg = f.readLine(); } catch (IOException ex) { LOGGER.debug(String.format("Error reading lock file: %s", lockFile), ex); } return msg; ...
java
private String readLockFile() { String msg = null; try (RandomAccessFile f = new RandomAccessFile(lockFile, "rw")) { msg = f.readLine(); } catch (IOException ex) { LOGGER.debug(String.format("Error reading lock file: %s", lockFile), ex); } return msg; ...
[ "private", "String", "readLockFile", "(", ")", "{", "String", "msg", "=", "null", ";", "try", "(", "RandomAccessFile", "f", "=", "new", "RandomAccessFile", "(", "lockFile", ",", "\"rw\"", ")", ")", "{", "msg", "=", "f", ".", "readLine", "(", ")", ";", ...
Reads the first line from the lock file and returns the results as a string. @return the first line from the lock file; or null if the contents could not be read
[ "Reads", "the", "first", "line", "from", "the", "lock", "file", "and", "returns", "the", "results", "as", "a", "string", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java#L231-L239
17,940
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java
H2DBLock.getFileAge
private double getFileAge(File file) { final Date d = new Date(); final long modified = file.lastModified(); final double time = (d.getTime() - modified) / 1000.0 / 60.0; LOGGER.debug("Lock file age is {} minutes", time); return time; }
java
private double getFileAge(File file) { final Date d = new Date(); final long modified = file.lastModified(); final double time = (d.getTime() - modified) / 1000.0 / 60.0; LOGGER.debug("Lock file age is {} minutes", time); return time; }
[ "private", "double", "getFileAge", "(", "File", "file", ")", "{", "final", "Date", "d", "=", "new", "Date", "(", ")", ";", "final", "long", "modified", "=", "file", ".", "lastModified", "(", ")", ";", "final", "double", "time", "=", "(", "d", ".", ...
Returns the age of the file in minutes. @param file the file to calculate the age @return the age of the file
[ "Returns", "the", "age", "of", "the", "file", "in", "minutes", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/H2DBLock.java#L247-L253
17,941
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/nexus/MavenArtifact.java
MavenArtifact.derivePomUrl
public static String derivePomUrl(String artifactId, String version, String artifactUrl) { return artifactUrl.substring(0, artifactUrl.lastIndexOf('/')) + '/' + artifactId + '-' + version + ".pom"; }
java
public static String derivePomUrl(String artifactId, String version, String artifactUrl) { return artifactUrl.substring(0, artifactUrl.lastIndexOf('/')) + '/' + artifactId + '-' + version + ".pom"; }
[ "public", "static", "String", "derivePomUrl", "(", "String", "artifactId", ",", "String", "version", ",", "String", "artifactUrl", ")", "{", "return", "artifactUrl", ".", "substring", "(", "0", ",", "artifactUrl", ".", "lastIndexOf", "(", "'", "'", ")", ")",...
Tries to determine the URL to the pom.xml. @param artifactId the artifact id @param version the version @param artifactUrl the artifact URL @return the string representation of the URL
[ "Tries", "to", "determine", "the", "URL", "to", "the", "pom", ".", "xml", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nexus/MavenArtifact.java#L145-L147
17,942
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
EvidenceCollection.getIterator
public synchronized Iterable<Evidence> getIterator(EvidenceType type, Confidence confidence) { if (null != confidence && null != type) { final Set<Evidence> list; switch (type) { case VENDOR: list = Collections.unmodifiableSet(new HashSet<>(vendors));...
java
public synchronized Iterable<Evidence> getIterator(EvidenceType type, Confidence confidence) { if (null != confidence && null != type) { final Set<Evidence> list; switch (type) { case VENDOR: list = Collections.unmodifiableSet(new HashSet<>(vendors));...
[ "public", "synchronized", "Iterable", "<", "Evidence", ">", "getIterator", "(", "EvidenceType", "type", ",", "Confidence", "confidence", ")", "{", "if", "(", "null", "!=", "confidence", "&&", "null", "!=", "type", ")", "{", "final", "Set", "<", "Evidence", ...
Used to iterate over evidence of the specified type and confidence. @param type the evidence type to iterate over @param confidence the confidence level for the evidence to be iterated over. @return Iterable&lt;Evidence&gt; an iterable collection of evidence
[ "Used", "to", "iterate", "over", "evidence", "of", "the", "specified", "type", "and", "confidence", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java#L110-L140
17,943
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
EvidenceCollection.addEvidence
public synchronized void addEvidence(EvidenceType type, Evidence e) { if (null != type) { switch (type) { case VENDOR: vendors.add(e); break; case PRODUCT: products.add(e); break; ...
java
public synchronized void addEvidence(EvidenceType type, Evidence e) { if (null != type) { switch (type) { case VENDOR: vendors.add(e); break; case PRODUCT: products.add(e); break; ...
[ "public", "synchronized", "void", "addEvidence", "(", "EvidenceType", "type", ",", "Evidence", "e", ")", "{", "if", "(", "null", "!=", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "VENDOR", ":", "vendors", ".", "add", "(", "e", ")", ";"...
Adds evidence to the collection. @param type the type of evidence (vendor, product, version) @param e Evidence
[ "Adds", "evidence", "to", "the", "collection", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java#L148-L164
17,944
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
EvidenceCollection.removeEvidence
public synchronized void removeEvidence(EvidenceType type, Evidence e) { if (null != type) { switch (type) { case VENDOR: vendors.remove(e); break; case PRODUCT: products.remove(e); break;...
java
public synchronized void removeEvidence(EvidenceType type, Evidence e) { if (null != type) { switch (type) { case VENDOR: vendors.remove(e); break; case PRODUCT: products.remove(e); break;...
[ "public", "synchronized", "void", "removeEvidence", "(", "EvidenceType", "type", ",", "Evidence", "e", ")", "{", "if", "(", "null", "!=", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "VENDOR", ":", "vendors", ".", "remove", "(", "e", ")",...
Removes evidence from the collection. @param type the type of evidence (vendor, product, version) @param e Evidence.
[ "Removes", "evidence", "from", "the", "collection", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java#L172-L188
17,945
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
EvidenceCollection.addEvidence
public void addEvidence(EvidenceType type, String source, String name, String value, Confidence confidence) { final Evidence e = new Evidence(source, name, value, confidence); addEvidence(type, e); }
java
public void addEvidence(EvidenceType type, String source, String name, String value, Confidence confidence) { final Evidence e = new Evidence(source, name, value, confidence); addEvidence(type, e); }
[ "public", "void", "addEvidence", "(", "EvidenceType", "type", ",", "String", "source", ",", "String", "name", ",", "String", "value", ",", "Confidence", "confidence", ")", "{", "final", "Evidence", "e", "=", "new", "Evidence", "(", "source", ",", "name", "...
Creates an Evidence object from the parameters and adds the resulting object to the evidence collection. @param type the type of evidence (vendor, product, version) @param source the source of the Evidence. @param name the name of the Evidence. @param value the value of the Evidence. @param confidence the confidence o...
[ "Creates", "an", "Evidence", "object", "from", "the", "parameters", "and", "adds", "the", "resulting", "object", "to", "the", "evidence", "collection", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java#L200-L203
17,946
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
EvidenceCollection.getEvidence
public synchronized Set<Evidence> getEvidence(EvidenceType type) { if (null != type) { switch (type) { case VENDOR: return Collections.unmodifiableSet(new HashSet<>(vendors)); case PRODUCT: return Collections.unmodifiableSet(new...
java
public synchronized Set<Evidence> getEvidence(EvidenceType type) { if (null != type) { switch (type) { case VENDOR: return Collections.unmodifiableSet(new HashSet<>(vendors)); case PRODUCT: return Collections.unmodifiableSet(new...
[ "public", "synchronized", "Set", "<", "Evidence", ">", "getEvidence", "(", "EvidenceType", "type", ")", "{", "if", "(", "null", "!=", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "VENDOR", ":", "return", "Collections", ".", "unmodifiableSet",...
Returns the unmodifiable set of evidence of the given type. @param type the type of evidence (vendor, product, version) @return the unmodifiable set of evidence
[ "Returns", "the", "unmodifiable", "set", "of", "evidence", "of", "the", "given", "type", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java#L271-L285
17,947
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
EvidenceCollection.contains
public synchronized boolean contains(EvidenceType type, Evidence e) { if (null != type) { switch (type) { case VENDOR: return vendors.contains(e); case PRODUCT: return products.contains(e); case VERSION: ...
java
public synchronized boolean contains(EvidenceType type, Evidence e) { if (null != type) { switch (type) { case VENDOR: return vendors.contains(e); case PRODUCT: return products.contains(e); case VERSION: ...
[ "public", "synchronized", "boolean", "contains", "(", "EvidenceType", "type", ",", "Evidence", "e", ")", "{", "if", "(", "null", "!=", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "VENDOR", ":", "return", "vendors", ".", "contains", "(", ...
Tests if the evidence collection contains the given evidence. @param type the type of evidence (vendor, product, version) @param e the evidence to search @return true if the evidence is found; otherwise false
[ "Tests", "if", "the", "evidence", "collection", "contains", "the", "given", "evidence", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java#L294-L308
17,948
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
EvidenceCollection.contains
public synchronized boolean contains(EvidenceType type, Confidence confidence) { if (null == type) { return false; } final Set<Evidence> col; switch (type) { case VENDOR: col = vendors; break; case PRODUCT: ...
java
public synchronized boolean contains(EvidenceType type, Confidence confidence) { if (null == type) { return false; } final Set<Evidence> col; switch (type) { case VENDOR: col = vendors; break; case PRODUCT: ...
[ "public", "synchronized", "boolean", "contains", "(", "EvidenceType", "type", ",", "Confidence", "confidence", ")", "{", "if", "(", "null", "==", "type", ")", "{", "return", "false", ";", "}", "final", "Set", "<", "Evidence", ">", "col", ";", "switch", "...
Returns whether or not the collection contains evidence of a specified type and confidence. @param type the type of evidence (vendor, product, version) @param confidence A Confidence value. @return boolean.
[ "Returns", "whether", "or", "not", "the", "collection", "contains", "evidence", "of", "a", "specified", "type", "and", "confidence", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java#L318-L342
17,949
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/pom/PomParser.java
PomParser.parse
public Model parse(File file) throws PomParseException { try (FileInputStream fis = new FileInputStream(file)) { return parse(fis); } catch (IOException ex) { LOGGER.debug("", ex); throw new PomParseException(String.format("Unable to parse pom '%s'", file.toString()),...
java
public Model parse(File file) throws PomParseException { try (FileInputStream fis = new FileInputStream(file)) { return parse(fis); } catch (IOException ex) { LOGGER.debug("", ex); throw new PomParseException(String.format("Unable to parse pom '%s'", file.toString()),...
[ "public", "Model", "parse", "(", "File", "file", ")", "throws", "PomParseException", "{", "try", "(", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "file", ")", ")", "{", "return", "parse", "(", "fis", ")", ";", "}", "catch", "(", "IOExce...
Parses the given xml file and returns a Model object containing only the fields dependency-check requires. @param file a pom.xml @return a Model object containing only the fields dependency-check requires @throws PomParseException thrown if the xml file cannot be parsed
[ "Parses", "the", "given", "xml", "file", "and", "returns", "a", "Model", "object", "containing", "only", "the", "fields", "dependency", "-", "check", "requires", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/pom/PomParser.java#L64-L71
17,950
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/pom/PomParser.java
PomParser.parse
public Model parse(InputStream inputStream) throws PomParseException { try { final PomHandler handler = new PomHandler(); final SAXParser saxParser = XmlUtils.buildSecureSaxParser(); final XMLReader xmlReader = saxParser.getXMLReader(); xmlReader.setContentHandler...
java
public Model parse(InputStream inputStream) throws PomParseException { try { final PomHandler handler = new PomHandler(); final SAXParser saxParser = XmlUtils.buildSecureSaxParser(); final XMLReader xmlReader = saxParser.getXMLReader(); xmlReader.setContentHandler...
[ "public", "Model", "parse", "(", "InputStream", "inputStream", ")", "throws", "PomParseException", "{", "try", "{", "final", "PomHandler", "handler", "=", "new", "PomHandler", "(", ")", ";", "final", "SAXParser", "saxParser", "=", "XmlUtils", ".", "buildSecureSa...
Parses the given XML file and returns a Model object containing only the fields dependency-check requires. @param inputStream an InputStream containing suppression rues @return a list of suppression rules @throws PomParseException if the XML cannot be parsed
[ "Parses", "the", "given", "XML", "file", "and", "returns", "a", "Model", "object", "containing", "only", "the", "fields", "dependency", "-", "check", "requires", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/pom/PomParser.java#L81-L103
17,951
jeremylong/DependencyCheck
maven/src/main/java/org/owasp/dependencycheck/maven/PurgeMojo.java
PurgeMojo.runCheck
@Override protected void runCheck() throws MojoExecutionException, MojoFailureException { if (getConnectionString() != null && !getConnectionString().isEmpty()) { final String msg = "Unable to purge the local NVD when using a non-default connection string"; if (this.isFailOnError())...
java
@Override protected void runCheck() throws MojoExecutionException, MojoFailureException { if (getConnectionString() != null && !getConnectionString().isEmpty()) { final String msg = "Unable to purge the local NVD when using a non-default connection string"; if (this.isFailOnError())...
[ "@", "Override", "protected", "void", "runCheck", "(", ")", "throws", "MojoExecutionException", ",", "MojoFailureException", "{", "if", "(", "getConnectionString", "(", ")", "!=", "null", "&&", "!", "getConnectionString", "(", ")", ".", "isEmpty", "(", ")", ")...
Purges the local copy of the NVD. @throws MojoExecutionException thrown if there is an exception executing the goal @throws MojoFailureException thrown if dependency-check is configured to fail the build
[ "Purges", "the", "local", "copy", "of", "the", "NVD", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/PurgeMojo.java#L66-L106
17,952
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcher.java
EvidenceMatcher.matches
public boolean matches(Evidence evidence) { return sourceMatches(evidence) && confidenceMatches(evidence) && name.equalsIgnoreCase(evidence.getName()) && valueMatches(evidence); }
java
public boolean matches(Evidence evidence) { return sourceMatches(evidence) && confidenceMatches(evidence) && name.equalsIgnoreCase(evidence.getName()) && valueMatches(evidence); }
[ "public", "boolean", "matches", "(", "Evidence", "evidence", ")", "{", "return", "sourceMatches", "(", "evidence", ")", "&&", "confidenceMatches", "(", "evidence", ")", "&&", "name", ".", "equalsIgnoreCase", "(", "evidence", ".", "getName", "(", ")", ")", "&...
Tests whether the given Evidence matches this EvidenceMatcher. @param evidence the evidence to match @return whether the evidence matches this matcher
[ "Tests", "whether", "the", "given", "Evidence", "matches", "this", "EvidenceMatcher", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcher.java#L91-L96
17,953
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/reporting/ReportTool.java
ReportTool.identifierToSuppressionId
public String identifierToSuppressionId(Identifier id) { if (id instanceof PurlIdentifier) { final PurlIdentifier purl = (PurlIdentifier) id; return purl.toGav(); } else if (id instanceof CpeIdentifier) { try { final CpeIdentifier cpeId = (CpeIdentifie...
java
public String identifierToSuppressionId(Identifier id) { if (id instanceof PurlIdentifier) { final PurlIdentifier purl = (PurlIdentifier) id; return purl.toGav(); } else if (id instanceof CpeIdentifier) { try { final CpeIdentifier cpeId = (CpeIdentifie...
[ "public", "String", "identifierToSuppressionId", "(", "Identifier", "id", ")", "{", "if", "(", "id", "instanceof", "PurlIdentifier", ")", "{", "final", "PurlIdentifier", "purl", "=", "(", "PurlIdentifier", ")", "id", ";", "return", "purl", ".", "toGav", "(", ...
Converts an identifier into the Suppression string when possible. @param id the Identifier to format @return the formatted suppression string when possible; otherwise <code>null</code>.
[ "Converts", "an", "identifier", "into", "the", "Suppression", "string", "when", "possible", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/ReportTool.java#L49-L67
17,954
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/search/FileContentSearch.java
FileContentSearch.contains
public static boolean contains(File file, String pattern) throws IOException { try (Scanner fileScanner = new Scanner(file, UTF_8)) { final Pattern regex = Pattern.compile(pattern); if (fileScanner.findWithinHorizon(regex, 0) != null) { return true; } ...
java
public static boolean contains(File file, String pattern) throws IOException { try (Scanner fileScanner = new Scanner(file, UTF_8)) { final Pattern regex = Pattern.compile(pattern); if (fileScanner.findWithinHorizon(regex, 0) != null) { return true; } ...
[ "public", "static", "boolean", "contains", "(", "File", "file", ",", "String", "pattern", ")", "throws", "IOException", "{", "try", "(", "Scanner", "fileScanner", "=", "new", "Scanner", "(", "file", ",", "UTF_8", ")", ")", "{", "final", "Pattern", "regex",...
Determines if the given file contains the given regular expression. @param file the file to test @param pattern the pattern used to test the file @return <code>true</code> if the regular expression matches the file content; otherwise <code>false</code> @throws java.io.IOException thrown if there is an error reading th...
[ "Determines", "if", "the", "given", "file", "contains", "the", "given", "regular", "expression", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/search/FileContentSearch.java#L52-L60
17,955
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/search/FileContentSearch.java
FileContentSearch.contains
public static boolean contains(File file, String[] patterns) throws IOException { final List<Pattern> regexes = new ArrayList<>(); for (String pattern : patterns) { regexes.add(Pattern.compile(pattern)); } try (Scanner fileScanner = new Scanner(file, UTF_8)) { ret...
java
public static boolean contains(File file, String[] patterns) throws IOException { final List<Pattern> regexes = new ArrayList<>(); for (String pattern : patterns) { regexes.add(Pattern.compile(pattern)); } try (Scanner fileScanner = new Scanner(file, UTF_8)) { ret...
[ "public", "static", "boolean", "contains", "(", "File", "file", ",", "String", "[", "]", "patterns", ")", "throws", "IOException", "{", "final", "List", "<", "Pattern", ">", "regexes", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", ...
Determines if the given file contains the given regular expressions. @param file the file to test @param patterns the array of patterns used to test the file @return <code>true</code> if one of the regular expressions matches the file content; otherwise <code>false</code> @throws java.io.IOException thrown if there is...
[ "Determines", "if", "the", "given", "file", "contains", "the", "given", "regular", "expressions", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/search/FileContentSearch.java#L71-L79
17,956
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.java
FalsePositiveAnalyzer.removeBadSpringMatches
private void removeBadSpringMatches(Dependency dependency) { String mustContain = null; for (Identifier i : dependency.getSoftwareIdentifiers()) { if (i.getValue() != null && i.getValue().startsWith("org.springframework.")) { final int endPoint = i.getValue().indexOf(':', 19)...
java
private void removeBadSpringMatches(Dependency dependency) { String mustContain = null; for (Identifier i : dependency.getSoftwareIdentifiers()) { if (i.getValue() != null && i.getValue().startsWith("org.springframework.")) { final int endPoint = i.getValue().indexOf(':', 19)...
[ "private", "void", "removeBadSpringMatches", "(", "Dependency", "dependency", ")", "{", "String", "mustContain", "=", "null", ";", "for", "(", "Identifier", "i", ":", "dependency", ".", "getSoftwareIdentifiers", "(", ")", ")", "{", "if", "(", "i", ".", "getV...
Removes inaccurate matches on springframework CPEs. @param dependency the dependency to test for and remove known inaccurate CPE matches
[ "Removes", "inaccurate", "matches", "on", "springframework", "CPEs", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.java#L153-L176
17,957
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java
NodePackageAnalyzer.prepareFileTypeAnalyzer
@Override protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { if (engine.getMode() != Mode.EVIDENCE_COLLECTION) { try { final Settings settings = engine.getSettings(); final String[] tmp = settings.getArray(Settings.KEYS.ECOSYSTE...
java
@Override protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { if (engine.getMode() != Mode.EVIDENCE_COLLECTION) { try { final Settings settings = engine.getSettings(); final String[] tmp = settings.getArray(Settings.KEYS.ECOSYSTE...
[ "@", "Override", "protected", "void", "prepareFileTypeAnalyzer", "(", "Engine", "engine", ")", "throws", "InitializationException", "{", "if", "(", "engine", ".", "getMode", "(", ")", "!=", "Mode", ".", "EVIDENCE_COLLECTION", ")", "{", "try", "{", "final", "Se...
Performs validation on the configuration to ensure that the correct analyzers are in place. @param engine the dependency-check engine @throws InitializationException thrown if there is a configuration error
[ "Performs", "validation", "on", "the", "configuration", "to", "ensure", "that", "the", "correct", "analyzers", "are", "in", "place", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java#L111-L133
17,958
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java
NodePackageAnalyzer.isNodeAuditEnabled
private boolean isNodeAuditEnabled(Engine engine) { for (Analyzer a : engine.getAnalyzers()) { if (a instanceof NodeAuditAnalyzer) { return a.isEnabled(); } } return false; }
java
private boolean isNodeAuditEnabled(Engine engine) { for (Analyzer a : engine.getAnalyzers()) { if (a instanceof NodeAuditAnalyzer) { return a.isEnabled(); } } return false; }
[ "private", "boolean", "isNodeAuditEnabled", "(", "Engine", "engine", ")", "{", "for", "(", "Analyzer", "a", ":", "engine", ".", "getAnalyzers", "(", ")", ")", "{", "if", "(", "a", "instanceof", "NodeAuditAnalyzer", ")", "{", "return", "a", ".", "isEnabled"...
Determines if the Node Audit analyzer is enabled. @param engine a reference to the dependency-check engine @return <code>true</code> if the Node Audit Analyzer is enabled; otherwise <code>false</code>
[ "Determines", "if", "the", "Node", "Audit", "analyzer", "is", "enabled", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java#L173-L180
17,959
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/naming/GenericIdentifier.java
GenericIdentifier.compareTo
@Override public int compareTo(Identifier o) { if (o == null) { throw new IllegalArgumentException("Unable to compare a null identifier"); } return new CompareToBuilder() .append(this.value, o.toString()) .append(this.url, o.getUrl()) ...
java
@Override public int compareTo(Identifier o) { if (o == null) { throw new IllegalArgumentException("Unable to compare a null identifier"); } return new CompareToBuilder() .append(this.value, o.toString()) .append(this.url, o.getUrl()) ...
[ "@", "Override", "public", "int", "compareTo", "(", "Identifier", "o", ")", "{", "if", "(", "o", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unable to compare a null identifier\"", ")", ";", "}", "return", "new", "CompareToBuilder...
Implementation of the comparator interface. @param o the object being compared @return an integer indicating the ordering
[ "Implementation", "of", "the", "comparator", "interface", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/naming/GenericIdentifier.java#L188-L198
17,960
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java
AssemblyAnalyzer.buildArgumentList
protected List<String> buildArgumentList() { // Use file.separator as a wild guess as to whether this is Windows final List<String> args = new ArrayList<>(); if (!StringUtils.isEmpty(getSettings().getString(Settings.KEYS.ANALYZER_ASSEMBLY_DOTNET_PATH))) { args.add(getSettings().getSt...
java
protected List<String> buildArgumentList() { // Use file.separator as a wild guess as to whether this is Windows final List<String> args = new ArrayList<>(); if (!StringUtils.isEmpty(getSettings().getString(Settings.KEYS.ANALYZER_ASSEMBLY_DOTNET_PATH))) { args.add(getSettings().getSt...
[ "protected", "List", "<", "String", ">", "buildArgumentList", "(", ")", "{", "// Use file.separator as a wild guess as to whether this is Windows", "final", "List", "<", "String", ">", "args", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "!", "StringUt...
Builds the beginnings of a List for ProcessBuilder @return the list of arguments to begin populating the ProcessBuilder
[ "Builds", "the", "beginnings", "of", "a", "List", "for", "ProcessBuilder" ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java#L105-L117
17,961
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java
AssemblyAnalyzer.prepareFileTypeAnalyzer
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { final File location; try (InputStream in = FileUtils.getResourceAsStream("GrokAssembly.zip")) { if (in == null) { throw new InitializationException("Unable to extract GrokAssembl...
java
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { final File location; try (InputStream in = FileUtils.getResourceAsStream("GrokAssembly.zip")) { if (in == null) { throw new InitializationException("Unable to extract GrokAssembl...
[ "@", "Override", "public", "void", "prepareFileTypeAnalyzer", "(", "Engine", "engine", ")", "throws", "InitializationException", "{", "final", "File", "location", ";", "try", "(", "InputStream", "in", "=", "FileUtils", ".", "getResourceAsStream", "(", "\"GrokAssembl...
Initialize the analyzer. In this case, extract GrokAssembly.dll to a temporary location. @param engine a reference to the dependency-check engine @throws InitializationException thrown if anything goes wrong
[ "Initialize", "the", "analyzer", ".", "In", "this", "case", "extract", "GrokAssembly", ".", "dll", "to", "a", "temporary", "location", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java#L330-L390
17,962
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java
AssemblyAnalyzer.isDotnetPath
private boolean isDotnetPath() { final String[] args = new String[2]; args[0] = "dotnet"; args[1] = "--version"; final ProcessBuilder pb = new ProcessBuilder(args); try { final Process proc = pb.start(); final int retCode = proc.waitFor(); if (...
java
private boolean isDotnetPath() { final String[] args = new String[2]; args[0] = "dotnet"; args[1] = "--version"; final ProcessBuilder pb = new ProcessBuilder(args); try { final Process proc = pb.start(); final int retCode = proc.waitFor(); if (...
[ "private", "boolean", "isDotnetPath", "(", ")", "{", "final", "String", "[", "]", "args", "=", "new", "String", "[", "2", "]", ";", "args", "[", "0", "]", "=", "\"dotnet\"", ";", "args", "[", "1", "]", "=", "\"--version\"", ";", "final", "ProcessBuil...
Tests to see if a file is in the system path. @return <code>true</code> if dotnet could be found in the path; otherwise <code>false</code>
[ "Tests", "to", "see", "if", "a", "file", "is", "in", "the", "system", "path", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java#L444-L467
17,963
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java
AssemblyAnalyzer.addMatchingValues
protected static void addMatchingValues(List<String> packages, String value, Dependency dep, EvidenceType type) { if (value == null || value.isEmpty() || packages == null || packages.isEmpty()) { return; } for (String key : packages) { final int pos = StringUtils.indexOfI...
java
protected static void addMatchingValues(List<String> packages, String value, Dependency dep, EvidenceType type) { if (value == null || value.isEmpty() || packages == null || packages.isEmpty()) { return; } for (String key : packages) { final int pos = StringUtils.indexOfI...
[ "protected", "static", "void", "addMatchingValues", "(", "List", "<", "String", ">", "packages", ",", "String", "value", ",", "Dependency", "dep", ",", "EvidenceType", "type", ")", "{", "if", "(", "value", "==", "null", "||", "value", ".", "isEmpty", "(", ...
Cycles through the collection of class name information to see if parts of the package names are contained in the provided value. If found, it will be added as the HIGHEST confidence evidence because we have more then one source corroborating the value. @param packages a collection of class name information @param val...
[ "Cycles", "through", "the", "collection", "of", "class", "name", "information", "to", "see", "if", "parts", "of", "the", "package", "names", "are", "contained", "in", "the", "provided", "value", ".", "If", "found", "it", "will", "be", "added", "as", "the",...
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java#L480-L495
17,964
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/update/nvd/ProcessTask.java
ProcessTask.call
@Override public ProcessTask call() throws Exception { try { processFiles(); } catch (UpdateException ex) { this.exception = ex; } finally { settings.cleanup(false); } return this; }
java
@Override public ProcessTask call() throws Exception { try { processFiles(); } catch (UpdateException ex) { this.exception = ex; } finally { settings.cleanup(false); } return this; }
[ "@", "Override", "public", "ProcessTask", "call", "(", ")", "throws", "Exception", "{", "try", "{", "processFiles", "(", ")", ";", "}", "catch", "(", "UpdateException", "ex", ")", "{", "this", ".", "exception", "=", "ex", ";", "}", "finally", "{", "set...
Implements the callable interface. @return this object @throws Exception thrown if there is an exception; note that any UpdateExceptions are simply added to the tasks exception collection
[ "Implements", "the", "callable", "interface", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/update/nvd/ProcessTask.java#L110-L120
17,965
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/update/nvd/ProcessTask.java
ProcessTask.importJSON
protected void importJSON(File file) throws ParserConfigurationException, IOException, SQLException, DatabaseException, ClassNotFoundException, UpdateException { final NvdCveParser parser = new NvdCveParser(settings, cveDB); parser.parse(file); }
java
protected void importJSON(File file) throws ParserConfigurationException, IOException, SQLException, DatabaseException, ClassNotFoundException, UpdateException { final NvdCveParser parser = new NvdCveParser(settings, cveDB); parser.parse(file); }
[ "protected", "void", "importJSON", "(", "File", "file", ")", "throws", "ParserConfigurationException", ",", "IOException", ",", "SQLException", ",", "DatabaseException", ",", "ClassNotFoundException", ",", "UpdateException", "{", "final", "NvdCveParser", "parser", "=", ...
Imports the NVD CVE JSON File into the database. @param file the file containing the NVD CVE JSON @throws ParserConfigurationException is thrown if there is a parser configuration exception @throws IOException is thrown if there is a IO Exception @throws SQLException is thrown if there is a SQL exception @throws Datab...
[ "Imports", "the", "NVD", "CVE", "JSON", "File", "into", "the", "database", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/update/nvd/ProcessTask.java#L135-L140
17,966
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/update/nvd/ProcessTask.java
ProcessTask.processFiles
private void processFiles() throws UpdateException { LOGGER.info("Processing Started for NVD CVE - {}", downloadTask.getNvdCveInfo().getId()); final long startProcessing = System.currentTimeMillis(); try { importJSON(downloadTask.getFile()); cveDB.commit(); pr...
java
private void processFiles() throws UpdateException { LOGGER.info("Processing Started for NVD CVE - {}", downloadTask.getNvdCveInfo().getId()); final long startProcessing = System.currentTimeMillis(); try { importJSON(downloadTask.getFile()); cveDB.commit(); pr...
[ "private", "void", "processFiles", "(", ")", "throws", "UpdateException", "{", "LOGGER", ".", "info", "(", "\"Processing Started for NVD CVE - {}\"", ",", "downloadTask", ".", "getNvdCveInfo", "(", ")", ".", "getId", "(", ")", ")", ";", "final", "long", "startPr...
Processes the NVD CVE XML file and imports the data into the DB. @throws UpdateException thrown if there is an error loading the data into the database
[ "Processes", "the", "NVD", "CVE", "XML", "file", "and", "imports", "the", "data", "into", "the", "DB", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/update/nvd/ProcessTask.java#L148-L162
17,967
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java
XmlInputStream.read
private StringBuilder read(int n) throws IOException { // Input stream finished? boolean eof = false; // Read that many. final StringBuilder s = new StringBuilder(n); while (s.length() < n && !eof) { // Always get from the pushBack buffer. if (pushBack.len...
java
private StringBuilder read(int n) throws IOException { // Input stream finished? boolean eof = false; // Read that many. final StringBuilder s = new StringBuilder(n); while (s.length() < n && !eof) { // Always get from the pushBack buffer. if (pushBack.len...
[ "private", "StringBuilder", "read", "(", "int", "n", ")", "throws", "IOException", "{", "// Input stream finished?", "boolean", "eof", "=", "false", ";", "// Read that many.", "final", "StringBuilder", "s", "=", "new", "StringBuilder", "(", "n", ")", ";", "while...
Read n characters. @param n the number of characters to read @return the characters read @throws IOException thrown when an error occurs
[ "Read", "n", "characters", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java#L86-L108
17,968
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java
XmlInputStream.readIntoPushBack
private boolean readIntoPushBack() throws IOException { // File finished? boolean eof = false; // Next char. final int ch = in.read(); if (ch >= 0) { // Discard whitespace at start? if (!(pulled == 0 && isWhiteSpace(ch))) { // Good code. ...
java
private boolean readIntoPushBack() throws IOException { // File finished? boolean eof = false; // Next char. final int ch = in.read(); if (ch >= 0) { // Discard whitespace at start? if (!(pulled == 0 && isWhiteSpace(ch))) { // Good code. ...
[ "private", "boolean", "readIntoPushBack", "(", ")", "throws", "IOException", "{", "// File finished?", "boolean", "eof", "=", "false", ";", "// Next char.", "final", "int", "ch", "=", "in", ".", "read", "(", ")", ";", "if", "(", "ch", ">=", "0", ")", "{"...
Might not actually push back anything but usually will. @return true if at end-of-file @throws IOException thrown if there is an IO exception in the underlying steam
[ "Might", "not", "actually", "push", "back", "anything", "but", "usually", "will", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java#L117-L141
17,969
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java
XmlInputStream.readAmpersand
private void readAmpersand() throws IOException { // Read the whole word, up to and including the ; final StringBuilder reference = new StringBuilder(); int ch; // Should end in a ';' for (ch = in.read(); isAlphaNumeric(ch); ch = in.read()) { reference.append((char) c...
java
private void readAmpersand() throws IOException { // Read the whole word, up to and including the ; final StringBuilder reference = new StringBuilder(); int ch; // Should end in a ';' for (ch = in.read(); isAlphaNumeric(ch); ch = in.read()) { reference.append((char) c...
[ "private", "void", "readAmpersand", "(", ")", "throws", "IOException", "{", "// Read the whole word, up to and including the ;", "final", "StringBuilder", "reference", "=", "new", "StringBuilder", "(", ")", ";", "int", "ch", ";", "// Should end in a ';'", "for", "(", ...
Deal with an ampersand in the stream. @throws IOException thrown if an unknown entity is encountered
[ "Deal", "with", "an", "ampersand", "in", "the", "stream", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java#L148-L173
17,970
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java
XmlInputStream.given
private void given(CharSequence s, int wanted, int got) { red.append(s); given += got; LOGGER.trace("Given: [" + wanted + "," + got + "]-" + s); }
java
private void given(CharSequence s, int wanted, int got) { red.append(s); given += got; LOGGER.trace("Given: [" + wanted + "," + got + "]-" + s); }
[ "private", "void", "given", "(", "CharSequence", "s", ",", "int", "wanted", ",", "int", "got", ")", "{", "red", ".", "append", "(", "s", ")", ";", "given", "+=", "got", ";", "LOGGER", ".", "trace", "(", "\"Given: [\"", "+", "wanted", "+", "\",\"", ...
Keep track of what we've given them. @param s the sequence of characters given @param wanted the number of characters wanted @param got the number of characters given
[ "Keep", "track", "of", "what", "we", "ve", "given", "them", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java#L182-L186
17,971
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java
XmlInputStream.read
@Override public int read(byte[] data, int offset, int length) throws IOException { final StringBuilder s = read(length); int n = 0; for (int i = 0; i < Math.min(length, s.length()); i++) { data[offset + i] = (byte) s.charAt(i); n += 1; } given(s, leng...
java
@Override public int read(byte[] data, int offset, int length) throws IOException { final StringBuilder s = read(length); int n = 0; for (int i = 0; i < Math.min(length, s.length()); i++) { data[offset + i] = (byte) s.charAt(i); n += 1; } given(s, leng...
[ "@", "Override", "public", "int", "read", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "final", "StringBuilder", "s", "=", "read", "(", "length", ")", ";", "int", "n", "=", "0", ";", ...
Reads the next length of bytes from the stream into the given byte array at the given offset. @param data the buffer to store the data read @param offset the offset in the buffer to start writing @param length the length of data to read @return the number of bytes read @throws IOException thrown when there is an issue...
[ "Reads", "the", "next", "length", "of", "bytes", "from", "the", "stream", "into", "the", "given", "byte", "array", "at", "the", "given", "offset", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/XmlInputStream.java#L212-L222
17,972
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.open
public synchronized void open(CveDB cve, Settings settings) throws IndexException { if (INSTANCE.usageCount.addAndGet(1) == 1) { try { final File temp = settings.getTempDirectory(); index = new MMapDirectory(temp.toPath()); buildIndex(cve); ...
java
public synchronized void open(CveDB cve, Settings settings) throws IndexException { if (INSTANCE.usageCount.addAndGet(1) == 1) { try { final File temp = settings.getTempDirectory(); index = new MMapDirectory(temp.toPath()); buildIndex(cve); ...
[ "public", "synchronized", "void", "open", "(", "CveDB", "cve", ",", "Settings", "settings", ")", "throws", "IndexException", "{", "if", "(", "INSTANCE", ".", "usageCount", ".", "addAndGet", "(", "1", ")", "==", "1", ")", "{", "try", "{", "final", "File",...
Creates and loads data into an in memory index. @param cve the data source to retrieve the cpe data @param settings a reference to the dependency-check settings @throws IndexException thrown if there is an error creating the index
[ "Creates", "and", "loads", "data", "into", "an", "in", "memory", "index", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L134-L149
17,973
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.createSearchingAnalyzer
private Analyzer createSearchingAnalyzer() { final Map<String, Analyzer> fieldAnalyzers = new HashMap<>(); fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); productFieldAnalyzer = new SearchFieldAnalyzer(); vendorFieldAnalyzer = new SearchFieldAnalyzer(); fieldAnaly...
java
private Analyzer createSearchingAnalyzer() { final Map<String, Analyzer> fieldAnalyzers = new HashMap<>(); fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); productFieldAnalyzer = new SearchFieldAnalyzer(); vendorFieldAnalyzer = new SearchFieldAnalyzer(); fieldAnaly...
[ "private", "Analyzer", "createSearchingAnalyzer", "(", ")", "{", "final", "Map", "<", "String", ",", "Analyzer", ">", "fieldAnalyzers", "=", "new", "HashMap", "<>", "(", ")", ";", "fieldAnalyzers", ".", "put", "(", "Fields", ".", "DOCUMENT_KEY", ",", "new", ...
Creates an Analyzer for searching the CPE Index. @return the CPE Analyzer.
[ "Creates", "an", "Analyzer", "for", "searching", "the", "CPE", "Index", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L165-L174
17,974
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.close
@Override public synchronized void close() { final int count = INSTANCE.usageCount.get() - 1; if (count <= 0) { INSTANCE.usageCount.set(0); if (searchingAnalyzer != null) { searchingAnalyzer.close(); searchingAnalyzer = null; } ...
java
@Override public synchronized void close() { final int count = INSTANCE.usageCount.get() - 1; if (count <= 0) { INSTANCE.usageCount.set(0); if (searchingAnalyzer != null) { searchingAnalyzer.close(); searchingAnalyzer = null; } ...
[ "@", "Override", "public", "synchronized", "void", "close", "(", ")", "{", "final", "int", "count", "=", "INSTANCE", ".", "usageCount", ".", "get", "(", ")", "-", "1", ";", "if", "(", "count", "<=", "0", ")", "{", "INSTANCE", ".", "usageCount", ".", ...
Closes the CPE Index.
[ "Closes", "the", "CPE", "Index", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L179-L207
17,975
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.buildIndex
private void buildIndex(CveDB cve) throws IndexException { try (Analyzer analyzer = createSearchingAnalyzer(); IndexWriter indexWriter = new IndexWriter(index, new IndexWriterConfig(analyzer))) { final FieldType ft = new FieldType(TextField.TYPE_STORED); ...
java
private void buildIndex(CveDB cve) throws IndexException { try (Analyzer analyzer = createSearchingAnalyzer(); IndexWriter indexWriter = new IndexWriter(index, new IndexWriterConfig(analyzer))) { final FieldType ft = new FieldType(TextField.TYPE_STORED); ...
[ "private", "void", "buildIndex", "(", "CveDB", "cve", ")", "throws", "IndexException", "{", "try", "(", "Analyzer", "analyzer", "=", "createSearchingAnalyzer", "(", ")", ";", "IndexWriter", "indexWriter", "=", "new", "IndexWriter", "(", "index", ",", "new", "I...
Builds the CPE Lucene Index based off of the data within the CveDB. @param cve the data base containing the CPE data @throws IndexException thrown if there is an issue creating the index
[ "Builds", "the", "CPE", "Lucene", "Index", "based", "off", "of", "the", "data", "within", "the", "CveDB", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L215-L252
17,976
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.search
public synchronized TopDocs search(String searchString, int maxQueryResults) throws ParseException, IndexException, IOException { final Query query = parseQuery(searchString); return search(query, maxQueryResults); }
java
public synchronized TopDocs search(String searchString, int maxQueryResults) throws ParseException, IndexException, IOException { final Query query = parseQuery(searchString); return search(query, maxQueryResults); }
[ "public", "synchronized", "TopDocs", "search", "(", "String", "searchString", ",", "int", "maxQueryResults", ")", "throws", "ParseException", ",", "IndexException", ",", "IOException", "{", "final", "Query", "query", "=", "parseQuery", "(", "searchString", ")", ";...
Searches the index using the given search string. @param searchString the query text @param maxQueryResults the maximum number of documents to return @return the TopDocs found by the search @throws ParseException thrown when the searchString is invalid @throws IndexException thrown when there is an internal error rese...
[ "Searches", "the", "index", "using", "the", "given", "search", "string", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L266-L269
17,977
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.parseQuery
public synchronized Query parseQuery(String searchString) throws ParseException, IndexException { if (searchString == null || searchString.trim().isEmpty()) { throw new ParseException("Query is null or empty"); } LOGGER.debug(searchString); final Query query = queryParser.pa...
java
public synchronized Query parseQuery(String searchString) throws ParseException, IndexException { if (searchString == null || searchString.trim().isEmpty()) { throw new ParseException("Query is null or empty"); } LOGGER.debug(searchString); final Query query = queryParser.pa...
[ "public", "synchronized", "Query", "parseQuery", "(", "String", "searchString", ")", "throws", "ParseException", ",", "IndexException", "{", "if", "(", "searchString", "==", "null", "||", "searchString", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", ...
Parses the given string into a Lucene Query. @param searchString the search text @return the Query object @throws ParseException thrown if the search text cannot be parsed @throws IndexException thrown if there is an error resetting the analyzers
[ "Parses", "the", "given", "string", "into", "a", "Lucene", "Query", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L280-L293
17,978
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.search
public synchronized TopDocs search(Query query, int maxQueryResults) throws CorruptIndexException, IOException { return indexSearcher.search(query, maxQueryResults); }
java
public synchronized TopDocs search(Query query, int maxQueryResults) throws CorruptIndexException, IOException { return indexSearcher.search(query, maxQueryResults); }
[ "public", "synchronized", "TopDocs", "search", "(", "Query", "query", ",", "int", "maxQueryResults", ")", "throws", "CorruptIndexException", ",", "IOException", "{", "return", "indexSearcher", ".", "search", "(", "query", ",", "maxQueryResults", ")", ";", "}" ]
Searches the index using the given query. @param query the query used to search the index @param maxQueryResults the max number of results to return @return the TopDocs found be the query @throws CorruptIndexException thrown if the Index is corrupt @throws IOException thrown if there is an IOException
[ "Searches", "the", "index", "using", "the", "given", "query", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L304-L306
17,979
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.explain
public synchronized String explain(Query query, int doc) throws IOException { return indexSearcher.explain(query, doc).toString(); }
java
public synchronized String explain(Query query, int doc) throws IOException { return indexSearcher.explain(query, doc).toString(); }
[ "public", "synchronized", "String", "explain", "(", "Query", "query", ",", "int", "doc", ")", "throws", "IOException", "{", "return", "indexSearcher", ".", "explain", "(", "query", ",", "doc", ")", ".", "toString", "(", ")", ";", "}" ]
Method to explain queries matches. @param query the query used @param doc the document matched @return the expalanation @throws IOException thrown if there is an index error
[ "Method", "to", "explain", "queries", "matches", "." ]
6cc7690ea12e4ca1454210ceaa2e9a5523f0926c
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L339-L341
17,980
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/StringColumn.java
StringColumn.append
public StringColumn append(String value) { try { lookupTable.append(value); } catch (NoKeysAvailableException ex) { lookupTable = lookupTable.promoteYourself(); try { lookupTable.append(value); } catch (NoKeysAvailableException e) { ...
java
public StringColumn append(String value) { try { lookupTable.append(value); } catch (NoKeysAvailableException ex) { lookupTable = lookupTable.promoteYourself(); try { lookupTable.append(value); } catch (NoKeysAvailableException e) { ...
[ "public", "StringColumn", "append", "(", "String", "value", ")", "{", "try", "{", "lookupTable", ".", "append", "(", "value", ")", ";", "}", "catch", "(", "NoKeysAvailableException", "ex", ")", "{", "lookupTable", "=", "lookupTable", ".", "promoteYourself", ...
Added for naming consistency with all other columns
[ "Added", "for", "naming", "consistency", "with", "all", "other", "columns" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/StringColumn.java#L484-L497
17,981
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/columns/strings/ByteDictionaryMap.java
ByteDictionaryMap.addValuesToSelection
private void addValuesToSelection(Selection results, byte key) { if (key != DEFAULT_RETURN_VALUE) { int i = 0; for (byte next : values) { if (key == next) { results.add(i); } i++; } } }
java
private void addValuesToSelection(Selection results, byte key) { if (key != DEFAULT_RETURN_VALUE) { int i = 0; for (byte next : values) { if (key == next) { results.add(i); } i++; } } }
[ "private", "void", "addValuesToSelection", "(", "Selection", "results", ",", "byte", "key", ")", "{", "if", "(", "key", "!=", "DEFAULT_RETURN_VALUE", ")", "{", "int", "i", "=", "0", ";", "for", "(", "byte", "next", ":", "values", ")", "{", "if", "(", ...
Given a key matching some string, add to the selection the index of every record that matches that key
[ "Given", "a", "key", "matching", "some", "string", "add", "to", "the", "selection", "the", "index", "of", "every", "record", "that", "matches", "that", "key" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/columns/strings/ByteDictionaryMap.java#L229-L239
17,982
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/io/FileReader.java
FileReader.selectColumnNames
private String[] selectColumnNames(List<String> names, ColumnType[] types) { List<String> header = new ArrayList<>(); for (int i = 0; i < types.length; i++) { if (types[i] != SKIP) { String name = names.get(i); name = name.trim(); header.add(na...
java
private String[] selectColumnNames(List<String> names, ColumnType[] types) { List<String> header = new ArrayList<>(); for (int i = 0; i < types.length; i++) { if (types[i] != SKIP) { String name = names.get(i); name = name.trim(); header.add(na...
[ "private", "String", "[", "]", "selectColumnNames", "(", "List", "<", "String", ">", "names", ",", "ColumnType", "[", "]", "types", ")", "{", "List", "<", "String", ">", "header", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", ...
Reads column names from header, skipping any for which the type == SKIP
[ "Reads", "column", "names", "from", "header", "skipping", "any", "for", "which", "the", "type", "==", "SKIP" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/io/FileReader.java#L178-L189
17,983
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/aggregate/Summarizer.java
Summarizer.summarize
private Table summarize(TableSliceGroup group) { List<Table> results = new ArrayList<>(); ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap = getAggregateFunctionMultimap(); for (String name : reductionMultimap.keys()) { List<AggregateFunction<?, ?>> reductions =...
java
private Table summarize(TableSliceGroup group) { List<Table> results = new ArrayList<>(); ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap = getAggregateFunctionMultimap(); for (String name : reductionMultimap.keys()) { List<AggregateFunction<?, ?>> reductions =...
[ "private", "Table", "summarize", "(", "TableSliceGroup", "group", ")", "{", "List", "<", "Table", ">", "results", "=", "new", "ArrayList", "<>", "(", ")", ";", "ArrayListMultimap", "<", "String", ",", "AggregateFunction", "<", "?", ",", "?", ">", ">", "r...
Associates the columns to be summarized with the functions that match their type. All valid combinations are used @param group A table slice group @return A table containing a row of summarized data for each group in the table slice group
[ "Associates", "the", "columns", "to", "be", "summarized", "with", "the", "functions", "that", "match", "their", "type", ".", "All", "valid", "combinations", "are", "used" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/aggregate/Summarizer.java#L196-L206
17,984
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/table/StandardTableSliceGroup.java
StandardTableSliceGroup.create
public static StandardTableSliceGroup create(Table original, String... columnsNames) { List<CategoricalColumn<?>> columns = original.categoricalColumns(columnsNames); return new StandardTableSliceGroup(original, columns.toArray(new CategoricalColumn<?>[0])); }
java
public static StandardTableSliceGroup create(Table original, String... columnsNames) { List<CategoricalColumn<?>> columns = original.categoricalColumns(columnsNames); return new StandardTableSliceGroup(original, columns.toArray(new CategoricalColumn<?>[0])); }
[ "public", "static", "StandardTableSliceGroup", "create", "(", "Table", "original", ",", "String", "...", "columnsNames", ")", "{", "List", "<", "CategoricalColumn", "<", "?", ">", ">", "columns", "=", "original", ".", "categoricalColumns", "(", "columnsNames", "...
Returns a viewGroup splitting the original table on the given columns. The named columns must be CategoricalColumns
[ "Returns", "a", "viewGroup", "splitting", "the", "original", "table", "on", "the", "given", "columns", ".", "The", "named", "columns", "must", "be", "CategoricalColumns" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/table/StandardTableSliceGroup.java#L50-L53
17,985
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/table/StandardTableSliceGroup.java
StandardTableSliceGroup.splitOn
private void splitOn(String... columnNames) { List<Column<?>> columns = getSourceTable().columns(columnNames); int byteSize = getByteSize(columns); byte[] currentKey = null; String currentStringKey = null; TableSlice view; Selection selection = new BitmapBackedSelectio...
java
private void splitOn(String... columnNames) { List<Column<?>> columns = getSourceTable().columns(columnNames); int byteSize = getByteSize(columns); byte[] currentKey = null; String currentStringKey = null; TableSlice view; Selection selection = new BitmapBackedSelectio...
[ "private", "void", "splitOn", "(", "String", "...", "columnNames", ")", "{", "List", "<", "Column", "<", "?", ">", ">", "columns", "=", "getSourceTable", "(", ")", ".", "columns", "(", "columnNames", ")", ";", "int", "byteSize", "=", "getByteSize", "(", ...
Splits the sourceTable table into sub-tables, grouping on the columns whose names are given in splitColumnNames
[ "Splits", "the", "sourceTable", "table", "into", "sub", "-", "tables", "grouping", "on", "the", "columns", "whose", "names", "are", "given", "in", "splitColumnNames" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/table/StandardTableSliceGroup.java#L67-L115
17,986
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/ShortColumn.java
ShortColumn.asFloatColumn
@Override public FloatColumn asFloatColumn() { FloatArrayList values = new FloatArrayList(); for (int d : data) { values.add(d); } values.trim(); return FloatColumn.create(this.name(), values.elements()); }
java
@Override public FloatColumn asFloatColumn() { FloatArrayList values = new FloatArrayList(); for (int d : data) { values.add(d); } values.trim(); return FloatColumn.create(this.name(), values.elements()); }
[ "@", "Override", "public", "FloatColumn", "asFloatColumn", "(", ")", "{", "FloatArrayList", "values", "=", "new", "FloatArrayList", "(", ")", ";", "for", "(", "int", "d", ":", "data", ")", "{", "values", ".", "add", "(", "d", ")", ";", "}", "values", ...
Returns a new FloatColumn containing a value for each value in this column, truncating if necessary. A widening primitive conversion from an int to a float does not lose information about the overall magnitude of a numeric value. It may, however, result in loss of precision - that is, the result may lose some of the l...
[ "Returns", "a", "new", "FloatColumn", "containing", "a", "value", "for", "each", "value", "in", "this", "column", "truncating", "if", "necessary", "." ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/ShortColumn.java#L478-L486
17,987
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/ShortColumn.java
ShortColumn.asDoubleColumn
@Override public DoubleColumn asDoubleColumn() { DoubleArrayList values = new DoubleArrayList(); for (int d : data) { values.add(d); } values.trim(); return DoubleColumn.create(this.name(), values.elements()); }
java
@Override public DoubleColumn asDoubleColumn() { DoubleArrayList values = new DoubleArrayList(); for (int d : data) { values.add(d); } values.trim(); return DoubleColumn.create(this.name(), values.elements()); }
[ "@", "Override", "public", "DoubleColumn", "asDoubleColumn", "(", ")", "{", "DoubleArrayList", "values", "=", "new", "DoubleArrayList", "(", ")", ";", "for", "(", "int", "d", ":", "data", ")", "{", "values", ".", "add", "(", "d", ")", ";", "}", "values...
Returns a new DoubleColumn containing a value for each value in this column, truncating if necessary. A widening primitive conversion from an int to a double does not lose information about the overall magnitude of a numeric value. It may, however, result in loss of precision - that is, the result may lose some of the...
[ "Returns", "a", "new", "DoubleColumn", "containing", "a", "value", "for", "each", "value", "in", "this", "column", "truncating", "if", "necessary", "." ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/ShortColumn.java#L501-L509
17,988
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/io/AddCellToColumnException.java
AddCellToColumnException.dumpRow
public void dumpRow(PrintStream out) { for (int i = 0; i < columnNames.size(); i++) { out.print("Column "); out.print(i); out.print(" "); out.print(columnNames.get(columnIndex)); out.print(" : "); try { out.println(line[i]);...
java
public void dumpRow(PrintStream out) { for (int i = 0; i < columnNames.size(); i++) { out.print("Column "); out.print(i); out.print(" "); out.print(columnNames.get(columnIndex)); out.print(" : "); try { out.println(line[i]);...
[ "public", "void", "dumpRow", "(", "PrintStream", "out", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columnNames", ".", "size", "(", ")", ";", "i", "++", ")", "{", "out", ".", "print", "(", "\"Column \"", ")", ";", "out", ".", "p...
Dumps to a PrintStream the information relative to the row that caused the problem @param out The PrintStream to output to
[ "Dumps", "to", "a", "PrintStream", "the", "information", "relative", "to", "the", "row", "that", "caused", "the", "problem" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/io/AddCellToColumnException.java#L104-L117
17,989
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/TimeColumn.java
TimeColumn.asList
public List<LocalTime> asList() { List<LocalTime> times = new ArrayList<>(); for (LocalTime time : this) { times.add(time); } return times; }
java
public List<LocalTime> asList() { List<LocalTime> times = new ArrayList<>(); for (LocalTime time : this) { times.add(time); } return times; }
[ "public", "List", "<", "LocalTime", ">", "asList", "(", ")", "{", "List", "<", "LocalTime", ">", "times", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "LocalTime", "time", ":", "this", ")", "{", "times", ".", "add", "(", "time", ")", ...
Returns the entire contents of this column as a list
[ "Returns", "the", "entire", "contents", "of", "this", "column", "as", "a", "list" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/TimeColumn.java#L246-L252
17,990
jtablesaw/tablesaw
html/src/main/java/tech/tablesaw/io/html/HtmlWriter.java
HtmlWriter.row
private static Element row(int row, Table table, ElementCreator elements, HtmlWriteOptions options) { Element tr = elements.create("tr", null, row); for (Column<?> col : table.columns()) { if (options.escapeText()) { tr.appendChild(elements.create("td", col, row) ...
java
private static Element row(int row, Table table, ElementCreator elements, HtmlWriteOptions options) { Element tr = elements.create("tr", null, row); for (Column<?> col : table.columns()) { if (options.escapeText()) { tr.appendChild(elements.create("td", col, row) ...
[ "private", "static", "Element", "row", "(", "int", "row", ",", "Table", "table", ",", "ElementCreator", "elements", ",", "HtmlWriteOptions", "options", ")", "{", "Element", "tr", "=", "elements", ".", "create", "(", "\"tr\"", ",", "null", ",", "row", ")", ...
Returns a string containing the html output of one table row
[ "Returns", "a", "string", "containing", "the", "html", "output", "of", "one", "table", "row" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/html/src/main/java/tech/tablesaw/io/html/HtmlWriter.java#L62-L74
17,991
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/io/Source.java
Source.createReader
public Reader createReader(byte[] cachedBytes) throws IOException { if (cachedBytes != null) { return new InputStreamReader(new ByteArrayInputStream(cachedBytes)); } if (inputStream != null) { return new InputStreamReader(inputStream, charset); } if (reader != null) { ...
java
public Reader createReader(byte[] cachedBytes) throws IOException { if (cachedBytes != null) { return new InputStreamReader(new ByteArrayInputStream(cachedBytes)); } if (inputStream != null) { return new InputStreamReader(inputStream, charset); } if (reader != null) { ...
[ "public", "Reader", "createReader", "(", "byte", "[", "]", "cachedBytes", ")", "throws", "IOException", "{", "if", "(", "cachedBytes", "!=", "null", ")", "{", "return", "new", "InputStreamReader", "(", "new", "ByteArrayInputStream", "(", "cachedBytes", ")", ")...
If cachedBytes are not null, returns a Reader created from the cachedBytes. Otherwise, returns a Reader from the underlying source.
[ "If", "cachedBytes", "are", "not", "null", "returns", "a", "Reader", "created", "from", "the", "cachedBytes", ".", "Otherwise", "returns", "a", "Reader", "from", "the", "underlying", "source", "." ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/io/Source.java#L82-L93
17,992
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/DateTimeColumn.java
DateTimeColumn.asEpochSecondArray
public long[] asEpochSecondArray(ZoneOffset offset) { long[] output = new long[data.size()]; for (int i = 0; i < data.size(); i++) { LocalDateTime dateTime = PackedLocalDateTime.asLocalDateTime(data.getLong(i)); if (dateTime == null) { output[i] = Long.MIN_VALUE; ...
java
public long[] asEpochSecondArray(ZoneOffset offset) { long[] output = new long[data.size()]; for (int i = 0; i < data.size(); i++) { LocalDateTime dateTime = PackedLocalDateTime.asLocalDateTime(data.getLong(i)); if (dateTime == null) { output[i] = Long.MIN_VALUE; ...
[ "public", "long", "[", "]", "asEpochSecondArray", "(", "ZoneOffset", "offset", ")", "{", "long", "[", "]", "output", "=", "new", "long", "[", "data", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", ...
Returns the seconds from epoch for each value as an array based on the given offset If a value is missing, Long.MIN_VALUE is used
[ "Returns", "the", "seconds", "from", "epoch", "for", "each", "value", "as", "an", "array", "based", "on", "the", "given", "offset" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/DateTimeColumn.java#L389-L400
17,993
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/DateTimeColumn.java
DateTimeColumn.asEpochMillisArray
public long[] asEpochMillisArray(ZoneOffset offset) { long[] output = new long[data.size()]; for (int i = 0; i < data.size(); i++) { LocalDateTime dateTime = PackedLocalDateTime.asLocalDateTime(data.getLong(i)); if (dateTime == null) { output[i] = Long.MIN_VALUE; ...
java
public long[] asEpochMillisArray(ZoneOffset offset) { long[] output = new long[data.size()]; for (int i = 0; i < data.size(); i++) { LocalDateTime dateTime = PackedLocalDateTime.asLocalDateTime(data.getLong(i)); if (dateTime == null) { output[i] = Long.MIN_VALUE; ...
[ "public", "long", "[", "]", "asEpochMillisArray", "(", "ZoneOffset", "offset", ")", "{", "long", "[", "]", "output", "=", "new", "long", "[", "data", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", ...
Returns an array where each entry is the difference, measured in milliseconds, between the LocalDateTime and midnight, January 1, 1970 UTC. If a missing value is encountered, Long.MIN_VALUE is inserted in the array
[ "Returns", "an", "array", "where", "each", "entry", "is", "the", "difference", "measured", "in", "milliseconds", "between", "the", "LocalDateTime", "and", "midnight", "January", "1", "1970", "UTC", "." ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/DateTimeColumn.java#L418-L429
17,994
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/selection/BitmapBackedSelection.java
BitmapBackedSelection.iterator
@Override public IntIterator iterator() { return new IntIterator() { private final org.roaringbitmap.IntIterator iterator = bitmap.getIntIterator(); @Override public int nextInt() { return iterator.next(); } @Override ...
java
@Override public IntIterator iterator() { return new IntIterator() { private final org.roaringbitmap.IntIterator iterator = bitmap.getIntIterator(); @Override public int nextInt() { return iterator.next(); } @Override ...
[ "@", "Override", "public", "IntIterator", "iterator", "(", ")", "{", "return", "new", "IntIterator", "(", ")", "{", "private", "final", "org", ".", "roaringbitmap", ".", "IntIterator", "iterator", "=", "bitmap", ".", "getIntIterator", "(", ")", ";", "@", "...
Returns a fastUtil intIterator that wraps a bitmap intIterator
[ "Returns", "a", "fastUtil", "intIterator", "that", "wraps", "a", "bitmap", "intIterator" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/selection/BitmapBackedSelection.java#L172-L194
17,995
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/selection/BitmapBackedSelection.java
BitmapBackedSelection.selectNRowsAtRandom
protected static Selection selectNRowsAtRandom(int n, int max) { Selection selection = new BitmapBackedSelection(); if (n > max) { throw new IllegalArgumentException("Illegal arguments: N (" + n + ") greater than Max (" + max + ")"); } int[] rows = new int[n]; if (n ...
java
protected static Selection selectNRowsAtRandom(int n, int max) { Selection selection = new BitmapBackedSelection(); if (n > max) { throw new IllegalArgumentException("Illegal arguments: N (" + n + ") greater than Max (" + max + ")"); } int[] rows = new int[n]; if (n ...
[ "protected", "static", "Selection", "selectNRowsAtRandom", "(", "int", "n", ",", "int", "max", ")", "{", "Selection", "selection", "=", "new", "BitmapBackedSelection", "(", ")", ";", "if", "(", "n", ">", "max", ")", "{", "throw", "new", "IllegalArgumentExcep...
Returns an randomly generated selection of size N where Max is the largest possible value
[ "Returns", "an", "randomly", "generated", "selection", "of", "size", "N", "where", "Max", "is", "the", "largest", "possible", "value" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/selection/BitmapBackedSelection.java#L224-L256
17,996
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/BooleanColumn.java
BooleanColumn.get
@Override public Boolean get(int i) { byte b = data.getByte(i); if (b == BooleanColumnType.BYTE_TRUE) { return Boolean.TRUE; } if (b == BooleanColumnType.BYTE_FALSE) { return Boolean.FALSE; } return null; }
java
@Override public Boolean get(int i) { byte b = data.getByte(i); if (b == BooleanColumnType.BYTE_TRUE) { return Boolean.TRUE; } if (b == BooleanColumnType.BYTE_FALSE) { return Boolean.FALSE; } return null; }
[ "@", "Override", "public", "Boolean", "get", "(", "int", "i", ")", "{", "byte", "b", "=", "data", ".", "getByte", "(", "i", ")", ";", "if", "(", "b", "==", "BooleanColumnType", ".", "BYTE_TRUE", ")", "{", "return", "Boolean", ".", "TRUE", ";", "}",...
Returns the value in row i as a Boolean @param i the row number @return A Boolean object (may be null)
[ "Returns", "the", "value", "in", "row", "i", "as", "a", "Boolean" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/BooleanColumn.java#L382-L392
17,997
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/BooleanColumn.java
BooleanColumn.set
public BooleanColumn set(Selection rowSelection, boolean newValue) { for (int row : rowSelection) { set(row, newValue); } return this; }
java
public BooleanColumn set(Selection rowSelection, boolean newValue) { for (int row : rowSelection) { set(row, newValue); } return this; }
[ "public", "BooleanColumn", "set", "(", "Selection", "rowSelection", ",", "boolean", "newValue", ")", "{", "for", "(", "int", "row", ":", "rowSelection", ")", "{", "set", "(", "row", ",", "newValue", ")", ";", "}", "return", "this", ";", "}" ]
Conditionally update this column, replacing current values with newValue for all rows where the current value matches the selection criteria
[ "Conditionally", "update", "this", "column", "replacing", "current", "values", "with", "newValue", "for", "all", "rows", "where", "the", "current", "value", "matches", "the", "selection", "criteria" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/BooleanColumn.java#L558-L563
17,998
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/table/Rows.java
Rows.copyRowsToTable
@SuppressWarnings({"rawtypes","unchecked"}) public static void copyRowsToTable(Selection rows, Table oldTable, Table newTable) { for (int columnIndex = 0; columnIndex < oldTable.columnCount(); columnIndex++) { Column oldColumn = oldTable.column(columnIndex); int r = 0; fo...
java
@SuppressWarnings({"rawtypes","unchecked"}) public static void copyRowsToTable(Selection rows, Table oldTable, Table newTable) { for (int columnIndex = 0; columnIndex < oldTable.columnCount(); columnIndex++) { Column oldColumn = oldTable.column(columnIndex); int r = 0; fo...
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "void", "copyRowsToTable", "(", "Selection", "rows", ",", "Table", "oldTable", ",", "Table", "newTable", ")", "{", "for", "(", "int", "columnIndex", "=", "...
Copies the rows indicated by the row index values in the given selection from oldTable to newTable
[ "Copies", "the", "rows", "indicated", "by", "the", "row", "index", "values", "in", "the", "given", "selection", "from", "oldTable", "to", "newTable" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/table/Rows.java#L37-L48
17,999
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/io/DataFrameWriter.java
DataFrameWriter.csv
public void csv(String file) throws IOException { CsvWriteOptions options = CsvWriteOptions.builder(file).build(); new CsvWriter().write(table, options); }
java
public void csv(String file) throws IOException { CsvWriteOptions options = CsvWriteOptions.builder(file).build(); new CsvWriter().write(table, options); }
[ "public", "void", "csv", "(", "String", "file", ")", "throws", "IOException", "{", "CsvWriteOptions", "options", "=", "CsvWriteOptions", ".", "builder", "(", "file", ")", ".", "build", "(", ")", ";", "new", "CsvWriter", "(", ")", ".", "write", "(", "tabl...
legacy methods left for backwards compatibility
[ "legacy", "methods", "left", "for", "backwards", "compatibility" ]
68a75b4098ac677e9486df5572cf13ec39f9f701
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/io/DataFrameWriter.java#L77-L80