/** * Returns true if the library has a digest and a digest algorithm, false otherwise. * @return */ public boolean hasValidDigest() { return this.getDigest()!=null && this.getDigestAlgorithm()!=null; }
private JsonObject createJsonResult(Library _lib, Boolean _affected){ JsonObject result = new JsonObject(); result.addProperty("source", "PROPAGATE_MANUAL"); result.addProperty("explanation", "Generated automatically by DigestAnalyzer on " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())); if(_affected!=null) result.addProperty("affected", _affected); JsonObject lib = new JsonObject(); lib.addProperty("digest", _lib.getDigest()); result.add("lib", lib); return result; }
/** * Returns a short or long string representation of the library. * @param _deep * @return */ public final String toString(boolean _deep) { final StringBuilder builder = new StringBuilder(); if(_deep) { builder.append("Library ").append(this.toString(false)).append(System.getProperty("line.separator")); for(ConstructId cid: this.getConstructs()) { builder.append(" ConstructId ").append(cid).append(System.getProperty("line.separator")); } } else { builder.append("[").append(this.getDigest()).append("]"); } return builder.toString(); } }
public Dependency getDependency(@NotNull String _sha1) { for(Dependency d: this.getDependencies()) { if(d.getLib()!=null && d.getLib().getDigest().equals(_sha1)) { return d; } } return null; } public Collection<Dependency> getDependencies() { return dependencies; }
BackendConnector.getInstance().uploadLibrary(lib); if(CoreConfiguration.isJarUploadEnabled()) BackendConnector.getInstance().uploadLibraryFile(lib.getDigest(), Paths.get(dep.getPath()));
final AggregatedVuln new_av = new AggregatedVuln(v.getDep().getLib().getDigest(), v.getDep().getFilename(), v.getBug()); final AggregatedVuln added_av = this.update(this.vulns, new_av);
private void uploadLibraryRequest(Library _lib) throws BackendConnectionException { final String sha1 = _lib.getDigest(); final String json = JacksonUtil.asJsonString(_lib);