public String toString() { final StringBuilder b = new StringBuilder(); final String classname = this.getClass().getName().substring(1 + this.getClass().getName().lastIndexOf(".")); b.append(classname + "[jar/war=").append(this.jarWriter.getOriginalJarFileName()); b.append(", libId=").append( (this.libraryId==null?"false":this.libraryId.toString())); b.append(", instr=").append(this.instrument); b.append(", instrCtx=").append( (JarAnalyzer.getAppContext()==null?"false":JarAnalyzer.getAppContext().toString(false)) ).append("]"); return b.toString(); }
@Override public Set<FileAnalyzer> getChilds(boolean _recursive) { if(this.mgr==null) { this.mgr = new JarAnalysisManager(4, this.instrument, JarAnalyzer.getAppContext());
try { final PropertiesConfiguration cfg = new PropertiesConfiguration("vulas-core.properties"); cfg.setProperty(CoreConfiguration.APP_CTX_GROUP, JarAnalyzer.getAppContext().getMvnGroup()); cfg.setProperty(CoreConfiguration.APP_CTX_ARTIF, JarAnalyzer.getAppContext().getArtifact()); cfg.setProperty(CoreConfiguration.APP_CTX_VERSI, JarAnalyzer.getAppContext().getVersion()); tmp_file = Files.createTempFile("vulas-core-", ".properties"); cfg.save(tmp_file.toFile());
/** * See here: http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html * @throws JarAnalysisException */ protected void createInstrumentedArchive() throws JarAnalysisException { // Additional manifest file entries this.jarWriter.addManifestEntry("VULAS-classInstrStats", "[" + this.classCount + " total, " + this.instrControl.countClassesInstrumentedAlready() + " existed, " + this.instrControl.countClassesInstrumentedSuccess() + " ok, " + this.instrControl.countClassesInstrumentedFailure() + " err]"); this.jarWriter.addManifestEntry("VULAS-constructStats", "[" + constructs.size() + " constructs]"); if(JarAnalyzer.getAppContext()!=null) this.jarWriter.addManifestEntry("VULAS-appContext", JarAnalyzer.getAppContext().getMvnGroup() + ":" + JarAnalyzer.getAppContext().getArtifact() + ":" + JarAnalyzer.getAppContext().getVersion()); // Register this JarAnalyzer for callbacks this.jarWriter.register(".*.class$", this); // Rename if(this.rename) this.jarWriter.setClassifier("vulas-instr"); // Rewrite this.jarWriter.rewrite(this.workDir); // Stats this.instrControl.logStatistics(); }
if(JarAnalyzer.getAppContext()!=null) this.jarWriter.addManifestEntry("VULAS-appContext", JarAnalyzer.getAppContext().getMvnGroup() + ":" + JarAnalyzer.getAppContext().getArtifact() + ":" + JarAnalyzer.getAppContext().getVersion());
cv.setAppContext(JarAnalyzer.getAppContext()); if(cv.isInstrumented()) this.instrControl.updateInstrumentationStatistics(cv.getJavaId(), null);