private DynamicTransformer() throws IllegalStateException { this.instrControl = InstrumentationControl.getInstance(this.getClass().getSimpleName()); try { if(!CoreConfiguration.existsInBackend(CoreConfiguration.getAppContext())) throw new IllegalStateException("Application " + CoreConfiguration.getAppContext() + " does not exist in backend"); } catch (ConfigurationException e) { throw new IllegalStateException("Error while reading configuration: " + e.getMessage()); } // Freeze a couple of classes this.freezeClasses(); }
public StackTraceInstrumentor() { try { final Map<String, Set<com.sap.psr.vulas.shared.json.model.ConstructId>> bug_change_lists = BackendConnector.getInstance().getAppBugs(CoreConfiguration.buildGoalContextFromGlobalConfiguration(), CoreConfiguration.getAppContext()); this.constructsCollectStacktrace = AbstractTraceInstrumentor.merge(bug_change_lists); } catch (ConfigurationException e) { StackTraceInstrumentor.log.error("Error during instantiation: " + e.getMessage()); throw new IllegalStateException("Error during instantiation: " + e.getMessage(), e); } catch (IllegalStateException e) { StackTraceInstrumentor.log.error("Error during instantiation: " + e.getMessage()); throw new IllegalStateException("Error during instantiation: " + e.getMessage(), e); } catch (BackendConnectionException e) { StackTraceInstrumentor.log.error("Error during instantiation: " + e.getMessage()); throw new IllegalStateException("Error during instantiation: " + e.getMessage(), e); } }
/** * Uploads trace information collected during JVM execution to the central collector. * If batch size is equal to -1, all traces will be uploaded. */ private synchronized void uploadTraces(int _batch_size) { if(this.constructUsage.isEmpty()) TraceCollector.getLog().info("No traces collected"); else { try { BackendConnector.getInstance().uploadTraces(CoreConfiguration.buildGoalContextFromGlobalConfiguration(), CoreConfiguration.getAppContext(), this.toJSON(_batch_size)); } catch (Exception e) { this.getLog().error("Error while uploaded traces: " + e.getMessage()); } } }
public SingleStackTraceInstrumentor() { this.maxStacktraces = VulasConfiguration.getGlobal().getConfiguration().getInt(CoreConfiguration.INSTR_MAX_STACKTRACES, 10); try { final Map<String, Set<com.sap.psr.vulas.shared.json.model.ConstructId>> bug_change_lists = BackendConnector.getInstance().getAppBugs(CoreConfiguration.buildGoalContextFromGlobalConfiguration(), CoreConfiguration.getAppContext()); this.constructsCollectStacktrace = AbstractTraceInstrumentor.merge(bug_change_lists); } catch (ConfigurationException e) { SingleStackTraceInstrumentor.log.error("Error during instantiation: " + e.getMessage()); throw new IllegalStateException("Error during instantiation: " + e.getMessage(), e); } catch (IllegalStateException e) { SingleStackTraceInstrumentor.log.error("Error during instantiation: " + e.getMessage()); throw new IllegalStateException("Error during instantiation: " + e.getMessage(), e); } catch (BackendConnectionException e) { SingleStackTraceInstrumentor.log.error("Error during instantiation: " + e.getMessage()); throw new IllegalStateException("Error during instantiation: " + e.getMessage(), e); } }
private ConstructIdUtil() { try { final Set<com.sap.psr.vulas.shared.json.model.ConstructId> app_constructs = BackendConnector.getInstance().getAppConstructIds(CoreConfiguration.buildGoalContextFromGlobalConfiguration(), CoreConfiguration.getAppContext()); this.appConstructs = new HashSet<ConstructId>(); for(com.sap.psr.vulas.shared.json.model.ConstructId cid: app_constructs) { this.appConstructs.add(JavaId.toCoreType(cid)); } } catch (ConfigurationException e) { ConstructIdUtil.getLog().error(e.getMessage(), e); } catch (BackendConnectionException e) { ConstructIdUtil.getLog().error(e.getMessage(), e); } }
public ExecutionMonitor() { try { final Application app_ctx = CoreConfiguration.getAppContext(); final Configuration cfg = VulasConfiguration.getGlobal().getConfiguration(); // Always create and register shutdown uploader this.shutdownUploader = new UploadScheduler(this); Runtime.getRuntime().addShutdownHook(new Thread(this.shutdownUploader, "vulas-shutdown-trace-upload")); // Configure uploader: Create and start periodic uploader according to configuration if(cfg.getBoolean(CoreConfiguration.MONI_PERIODIC_UPL_ENABLED, true)) this.enablePeriodicUpload(cfg.getInt(CoreConfiguration.MONI_PERIODIC_UPL_INTERVAL, 300000), cfg.getInt(CoreConfiguration.MONI_PERIODIC_UPL_BATCH_SIZE, 1000)); // Goal execution this.exe = new TestGoal(); this.exe.setGoalClient(GoalClient.AGENT); this.startGoal(); } catch(ConfigurationException ce) { ExecutionMonitor.getLog().error(ce.getMessage()); } catch(GoalConfigurationException gce) { ExecutionMonitor.getLog().error(gce.getMessage()); } }
app = CoreConfiguration.getAppContext(); VulasConfiguration.getGlobal().setPropertyIfEmpty(CoreConfiguration.APP_CTX_ARTIF, this.project.getArtifactId()); VulasConfiguration.getGlobal().setPropertyIfEmpty(CoreConfiguration.APP_CTX_VERSI, this.project.getVersion()); app = CoreConfiguration.getAppContext();
BackendConnector.getInstance().uploadTouchPoints(CoreConfiguration.buildGoalContextFromGlobalConfiguration(), CoreConfiguration.getAppContext(), entry.getKey(), myArray.toString()); } catch (ConfigurationException e) { TouchPointCollector.getLog().error(e.getMessage(), e);
app_ctx = CoreConfiguration.getAppContext(); } catch (ConfigurationException e) { TraceCollector.getLog().error("Application context could not be determined");
app = CoreConfiguration.getAppContext(); VulasConfiguration.getGlobal().setPropertyIfEmpty(CoreConfiguration.APP_CTX_ARTIF, this.project.getArtifactId()); VulasConfiguration.getGlobal().setPropertyIfEmpty(CoreConfiguration.APP_CTX_VERSI, this.project.getVersion()); app = CoreConfiguration.getAppContext();
ctx = CoreConfiguration.getAppContext(); // Via configuration } catch (ConfigurationException e) { log.error(e.getMessage());
try { final Set<Dependency> deps = BackendConnector.getInstance().getAppDeps(CoreConfiguration.buildGoalContextFromGlobalConfiguration(), CoreConfiguration.getAppContext()); int blacklisted_deps_count = 0; for(Dependency dep: deps) {