public JarAnalyzer getJarAnalyzerByPath(String _jar_path){ if(!this.jarAnalyzerCache.containsKey(_jar_path)){ try { final JarAnalyzer ja = new JarAnalyzer(); ja.analyze(Paths.get(_jar_path).toFile()); this.jarAnalyzerCache.put(_jar_path, ja); } catch(FileAnalysisException e) { TouchPointCollector.getLog().error("Error while reading JAR file from URL [" + _jar_path + "]: " + e.getMessage()); } } return this.jarAnalyzerCache.get(_jar_path); }
public ArchiveFixContainmentCheck(String _b, Path _p) throws IOException, IllegalArgumentException { if(_p==null) throw new IllegalArgumentException("Filesystem path to JAR is required"); try { this.ja = new JarAnalyzer(); this.ja.analyze(_p.toFile()); ArchiveFixContainmentCheck.cp.appendClassPath(this.ja.getPath().toString()); } catch (NotFoundException e) { throw new IllegalArgumentException("JAR cannot be added to classpath: " + e.getMessage()); } catch (FileAnalysisException e) { throw new IllegalArgumentException("JAR cannot be added to classpath: " + e.getMessage()); } this.bugId = _b; } /*
private synchronized String getShaFromCachedJarAnalyzer(URL _jar_url) { // Build the JarAnalyzer (if possible) and put it into the cache if(!this.jarAnalyzersCache.containsKey(_jar_url)) { JarAnalyzer ja = null; try { final URI uri = _jar_url.toURI(); final File file = Paths.get(uri).toFile(); ja = new JarAnalyzer(); ja.analyze(file); } catch (InvalidPathException ex) { log.error("Invalid path [" + _jar_url + "]: " + ex.getMessage(), ex); } catch (FileAnalysisException ex) { log.error("Error analyzing the JAR at [" + _jar_url + "]: " + ex.getMessage(), ex); } catch(java.nio.file.FileSystemNotFoundException fsnfe) { log.error("File system not found for [" + _jar_url + "]: " + fsnfe.getMessage(), fsnfe); } catch (URISyntaxException e) { log.error("URI syntax exception for [" + _jar_url + "]: " + e.getMessage(), e); } this.jarAnalyzersCache.put(_jar_url, ja); // ja can be null } // Return the digest or null (if the JarAnalyzer could not be built) final JarAnalyzer ja = this.jarAnalyzersCache.get(_jar_url); if(ja!=null) return ja.getSHA1(); else return null; } }
log.error("Error when creating file analyzer for [" + _file.toString() + "]: " + e.getMessage(), e);
JavaSignatureFactory.log.error(e.getMessage()); } catch (FileAnalysisException e) { JavaSignatureFactory.log.error(e.getMessage()); JavaSignatureFactory.log.error(e.getMessage()); } catch (FileAnalysisException e) { JavaSignatureFactory.log.error(e.getMessage());
/** * Filter the given packages according to whether the artifact name is (or is not, depending on the boolean flag) contained in the given filter. * @param _packages * @param _filter * @param _include * @return */ public static Set<PipInstalledPackage> filterUsingArtifact(Set<PipInstalledPackage> _packages, StringList _filter, boolean _include) { final Set<PipInstalledPackage> r = new HashSet<PipInstalledPackage>(); for(PipInstalledPackage p: _packages) { try { if(_include) { if(_filter.contains(p.getLibrary().getLibraryId().getArtifact())) r.add(p); } else { if(!_filter.contains(p.getLibrary().getLibraryId().getArtifact())) r.add(p); } } catch (FileAnalysisException e) { log.error("Error getting library ID of package [" + p + "]: " + e.getMessage(), e); } } return r; }
this.getLog().error("Error while reading JAR file from URL [" + jar_path + "]: " + e.getMessage());
FileComparator.log.error("Error while comparing defective and fixed version: " + e.getMessage(), e); FileComparator.log.error("Error while comparing defective and fixed version: " + e.getMessage(), e);
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
log.error(e.getMessage(), e); app_constructs.addAll(fa.getConstructs().keySet()); } catch (FileAnalysisException e) { log.error(e.getMessage(), e); log.error(e.getMessage(), e); log.error(e.getMessage(), e);