public GraphViewer(Graph<Object> graph) throws WalaException { super(null); this.graph = graph; if (graph == null) { throw new WalaException("null graph for SWT viewer"); } }
/** * @return names of the Jar files holding J2EE libraries * @throws IllegalStateException if the J2EE_DIR property is not set */ public static String[] getJ2EEJarFiles() { Properties p = null; try { p = WalaProperties.loadProperties(); } catch (WalaException e) { e.printStackTrace(); throw new IllegalStateException("problem loading wala.properties"); } String dir = p.getProperty(WalaProperties.J2EE_DIR); if (dir == null) { throw new IllegalStateException("No J2EE directory specified"); } return getJarsInDirectory(dir); }
public static <T> File writeDotFile(Graph<T> g, NodeDecorator<T> labels, String title, String dotfile) throws WalaException { if (g == null) { throw new IllegalArgumentException("g is null"); } StringBuilder dotStringBuffer = dotOutput(g, labels, title); // retrieve the filename parameter to this component, a String if (dotfile == null) { throw new WalaException("internal error: null filename parameter"); } try { File f = new File(dotfile); try (Writer fw = Files.newBufferedWriter(f.toPath(), StandardCharsets.UTF_8)) { fw.write(dotStringBuffer.toString()); } return f; } catch (Exception e) { throw new WalaException("Error writing dot file " + dotfile, e); } }
/** * @return names of the Jar files holding J2EE libraries * @throws IllegalStateException if the J2EE_DIR property is not set */ public static String[] getJ2EEJarFiles() { Properties p = null; try { p = WalaProperties.loadProperties(); } catch (WalaException e) { e.printStackTrace(); throw new IllegalStateException("problem loading wala.properties"); } String dir = p.getProperty(WalaProperties.J2EE_DIR); if (dir == null) { throw new IllegalStateException("No J2EE directory specified"); } return getJarsInDirectory(dir); }
public static <T> File writeDotFile(Graph<T> g, NodeDecorator<T> labels, String title, String dotfile) throws WalaException { if (g == null) { throw new IllegalArgumentException("g is null"); } StringBuilder dotStringBuffer = dotOutput(g, labels, title); // retrieve the filename parameter to this component, a String if (dotfile == null) { throw new WalaException("internal error: null filename parameter"); } try { File f = new File(dotfile); try (final FileWriter fw = new FileWriter(f)) { fw.write(dotStringBuffer.toString()); } return f; } catch (Exception e) { throw new WalaException("Error writing dot file " + dotfile, e); } }
public static <T, P, F> void viewIFDS(TabulationResult<T, P, F> r, Collection<? extends P> roots, NodeDecorator<T> labels) throws WalaException { Properties p = null; try { p = WalaProperties.loadProperties(); } catch (WalaException e) { e.printStackTrace(); Assertions.UNREACHABLE(); } String scratch = p.getProperty(WalaProperties.OUTPUT_DIR); viewIFDS(r, roots, labels, scratch); }
public static <T> File writeDotFile(Graph<T> g, NodeDecorator<T> labels, String title, String dotfile) throws WalaException { if (g == null) { throw new IllegalArgumentException("g is null"); } StringBuilder dotStringBuffer = dotOutput(g, labels, title); // retrieve the filename parameter to this component, a String if (dotfile == null) { throw new WalaException("internal error: null filename parameter"); } try { File f = new File(dotfile); try (Writer fw = Files.newBufferedWriter(f.toPath(), StandardCharsets.UTF_8)) { fw.write(dotStringBuffer.toString()); } return f; } catch (Exception e) { throw new WalaException("Error writing dot file " + dotfile, e); } }
@Override public String getText(Object element) { try { return (d == null) ? super.getText(element) : d.getLabel(element); } catch (WalaException e) { e.printStackTrace(); Assertions.UNREACHABLE(); return null; } }
public static <T> File writeDotFile(Graph<T> g, NodeDecorator<T> labels, String title, String dotfile) throws WalaException { if (g == null) { throw new IllegalArgumentException("g is null"); } StringBuilder dotStringBuffer = dotOutput(g, labels, title); // retrieve the filename parameter to this component, a String if (dotfile == null) { throw new WalaException("internal error: null filename parameter"); } try { File f = new File(dotfile); try (Writer fw = Files.newBufferedWriter(f.toPath(), StandardCharsets.UTF_8)) { fw.write(dotStringBuffer.toString()); } return f; } catch (Exception e) { throw new WalaException("Error writing dot file " + dotfile, e); } }
/** * @see org.eclipse.jface.action.IAction#run() * * @throws IllegalStateException if the viewer is not running */ @Override public void run() { IR ir = getIRForSelection(); // spawn the viewer System.err.println("Spawn IR Viewer for " + ir.getMethod()); try { PDFViewUtil.ghostviewIR(cg.getClassHierarchy(), ir, psFile, dotFile, dotExe, gvExe); } catch (WalaException e) { e.printStackTrace(); } }
public void run() { String[] cmdarray = { getGvExe(), getPDFFile() }; try { Process p = Runtime.getRuntime().exec(cmdarray); setProcess(p); } catch (IOException e) { e.printStackTrace(); exception = new WalaException("gv invocation failed for\n" + Arrays.toString(cmdarray)); } }
@Override public void run() { try { final P proc = getProcedureForSelection(); Predicate<T> filter = o -> supergraph.getProcOf(o).equals(proc); Graph<T> localGraph = GraphSlicer.prune(supergraph, filter); // spawn the viewer System.err.println("Spawn Viewer for " + proc); DotUtil.dotify(localGraph, labels, dotFile, pdfFile, dotExe); if (DotUtil.getOutputType() == DotUtil.DotOutputType.PDF) { PDFViewUtil.launchPDFView(pdfFile, pdfViewExe); } } catch (WalaException e) { e.printStackTrace(); Assertions.UNREACHABLE(); } }
public void run() { String[] cmdarray = { getGvExe(), getPDFFile() }; try { Process p = Runtime.getRuntime().exec(cmdarray); setProcess(p); } catch (IOException e) { e.printStackTrace(); exception = new WalaException("gv invocation failed for\n" + Arrays.toString(cmdarray)); } }
public static void main(String[] args) throws IllegalArgumentException, CancelException, IOException { try { Properties p = new Properties(); p.putAll(WalaProperties.loadProperties()); } catch (WalaException e) { e.printStackTrace(); Assertions.UNREACHABLE(); } runTestCase(TestConstants.JLEX_MAIN, TestConstants.JLEX, "JLex"); // runTestCase(TestConstants.HELLO_MAIN, TestConstants.HELLO, "Hello"); }
@Override public boolean mayEscape(MethodReference allocMethod, int allocPC, MethodReference m) throws WalaException { if (allocMethod == null) { throw new IllegalArgumentException("null allocMethod"); } // nodes:= set of call graph nodes representing method m Set nodes = cg.getNodes(m); if (nodes.size() == 0) { throw new WalaException("could not find call graph node for method " + m); } // allocN := set of call graph nodes representing method allocMethod Set<CGNode> allocN = cg.getNodes(allocMethod); if (allocN.size() == 0) { throw new WalaException("could not find call graph node for allocation method " + allocMethod); } return mayEscape(allocN, allocPC, nodes); }
/** * @param appJar something like "c:/temp/testdata/java_cup.jar" */ public static Process run(String appJar, String exclusionFile) throws IllegalArgumentException, CancelException { try { Graph<CGNode> g = buildPrunedCallGraph(appJar, (new FileProvider()).getFile(exclusionFile)); Properties p = null; try { p = WalaExamplesProperties.loadProperties(); p.putAll(WalaProperties.loadProperties()); } catch (WalaException e) { e.printStackTrace(); Assertions.UNREACHABLE(); } String pdfFile = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PDF_FILE; String dotExe = p.getProperty(WalaExamplesProperties.DOT_EXE); DotUtil.dotify(g, null, PDFTypeHierarchy.DOT_FILE, pdfFile, dotExe); String gvExe = p.getProperty(WalaExamplesProperties.PDFVIEW_EXE); return PDFViewUtil.launchPDFView(pdfFile, gvExe); } catch (WalaException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } }
public void run() { String[] cmdarray = { getGvExe(), getPDFFile() }; try { Process p = Runtime.getRuntime().exec(cmdarray); setProcess(p); } catch (IOException e) { e.printStackTrace(); exception = new WalaException("gv invocation failed for\n" + Arrays.toString(cmdarray)); } }
public static Process run(String[] args) throws IOException { try { validateCommandLine(args); String classpath = args[CLASSPATH_INDEX]; AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, (new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS)); // invoke WALA to build a class hierarchy ClassHierarchy cha = ClassHierarchyFactory.make(scope); Graph<IClass> g = typeHierarchy2Graph(cha); g = pruneForAppLoader(g); String dotFile = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + DOT_FILE; String pdfFile = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PDF_FILE; String dotExe = p.getProperty(WalaExamplesProperties.DOT_EXE); String gvExe = p.getProperty(WalaExamplesProperties.PDFVIEW_EXE); DotUtil.dotify(g, null, dotFile, pdfFile, dotExe); return PDFViewUtil.launchPDFView(pdfFile, gvExe); } catch (WalaException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }
public static Properties loadProperties() throws WalaException { try { Properties result = loadPropertiesFromFile(WalaProperties.class.getClassLoader(), PROPERTY_FILENAME); String outputDir = result.getProperty(OUTPUT_DIR, DefaultPropertiesValues.DEFAULT_OUTPUT_DIR); result.setProperty(OUTPUT_DIR, convertToAbsolute(outputDir)); String walaReport = result.getProperty(WALA_REPORT, DefaultPropertiesValues.DEFAULT_WALA_REPORT_FILENAME); result.setProperty(WALA_REPORT, convertToAbsolute(walaReport)); return result; } catch (Exception e) { // e.printStackTrace(); throw new WalaException("Unable to set up wala properties ", e); } }
wp.putAll(WalaExamplesProperties.loadProperties()); } catch (WalaException e) { e.printStackTrace(); Assertions.UNREACHABLE();