本文整理汇总了Java中com.ibm.wala.util.WalaException类的典型用法代码示例。如果您正苦于以下问题:Java WalaException类的具体用法?Java WalaException怎么用?Java WalaException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WalaException类属于com.ibm.wala.util包,在下文中一共展示了WalaException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeCG
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, WalaException {
try {
IClassHierarchy cha = makeHierarchy(scope, loaders);
com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
Iterable<Entrypoint> roots = makeScriptRoots(cha);
JSAnalysisOptions options = makeOptions(scope, cha, roots);
options.setHandleCallApply(builderType.handleCallApply());
IAnalysisCacheView cache = makeCache(irFactory);
JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.ALLOCATIONS,
builderType.useOneCFA());
if(builderType.extractCorrelatedPairs())
builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), 2, builder.getContextSelector()));
return builder;
} catch (ClassHierarchyException e) {
assert false : "internal error building class hierarchy";
return null;
}
}
示例2: makeCG
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, WalaException {
try {
IClassHierarchy cha = makeHierarchy(scope, loaders);
com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
Iterable<Entrypoint> roots = makeScriptRoots(cha);
JSAnalysisOptions options = makeOptions(scope, cha, roots);
options.setHandleCallApply(builderType.handleCallApply());
AnalysisCache cache = makeCache(irFactory);
JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.ALLOCATIONS,
builderType.useOneCFA());
if(builderType.extractCorrelatedPairs())
builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), 2, builder.getContextSelector()));
return builder;
} catch (ClassHierarchyException e) {
return null;
}
}
示例3: makeHTMLCGBuilder
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
public static JSCFABuilder makeHTMLCGBuilder(URL url,
CGBuilderType builderType) throws IOException, WalaException {
IRFactory<IMethod> irFactory = AstIRFactory.makeDefaultFactory();
CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs
? new CorrelatedPairExtractorFactory(translatorFactory, url)
: null;
JavaScriptLoaderFactory loaders = new WebPageLoaderFactory(
translatorFactory, preprocessor);
SourceModule[] scriptsArray = makeHtmlScope(url, loaders);
JSCFABuilder builder = makeCGBuilder(loaders, scriptsArray,
builderType, irFactory);
if (builderType.extractCorrelatedPairs)
builder.setContextSelector(new PropertyNameContextSelector(builder
.getAnalysisCache(), 2, builder.getContextSelector()));
builder.setBaseURL(url);
return builder;
}
示例4: makeCG
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders,
AnalysisScope scope, CGBuilderType builderType,
IRFactory<IMethod> irFactory) throws IOException, WalaException {
try {
IClassHierarchy cha = makeHierarchy(scope, loaders);
com.ibm.wala.cast.util.Util.checkForFrontEndErrors(cha);
Iterable<Entrypoint> roots = makeScriptRoots(cha);
JSAnalysisOptions options = makeOptions(scope, cha, roots);
options.setHandleCallApply(builderType.handleCallApply());
IAnalysisCacheView cache = makeCache(irFactory);
JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options,
cache, null, null, ZeroXInstanceKeys.ALLOCATIONS,
builderType.useOneCFA());
if (builderType.extractCorrelatedPairs())
builder.setContextSelector(new PropertyNameContextSelector(
builder.getAnalysisCache(), 2, builder
.getContextSelector()));
return builder;
} catch (ClassHierarchyException e) {
// Assert.assertTrue("internal error building class hierarchy",
// false);
return null;
}
}
示例5: makeCG
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, WalaException {
try {
IClassHierarchy cha = makeHierarchy(scope, loaders);
com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
Iterable<Entrypoint> roots = makeScriptRoots(cha);
JSAnalysisOptions options = makeOptions(scope, cha, roots);
options.setHandleCallApply(builderType.handleCallApply());
AnalysisCache cache = makeCache(irFactory);
JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.ALLOCATIONS,
builderType.useOneCFA());
if(builderType.extractCorrelatedPairs())
builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), 2, builder.getContextSelector()));
return builder;
} catch (ClassHierarchyException e) {
Assert.assertTrue("internal error building class hierarchy", false);
return null;
}
}
示例6: main
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
/**
* main method to print out all ir for the test classes
* @param args no args defined
* @throws IOException
* @throws WalaException
*/
public static void main(String[] args) throws IOException, WalaException {
String pathname = TARGET_IRS;
if (args.length > 0) {
pathname = args[0];
}
TargetApplication targetApplication = TestUtilities.loadTestJar();
for (IClass clazz : targetApplication.getApplicationClasses()) {
for (IMethod m : clazz.getDeclaredMethods()) {
printToPDF(pathname, targetApplication.getClassHierachy(), targetApplication.findIRForMethod(m));
}
}
}
示例7: createMethodFor
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
private AnalyzedMethod createMethodFor(String className, String methodName, String jarName) {
TargetApplication application = TestUtilities.loadTestJar("target/" + jarName);
for (IClass cl : application.getClassHierachy()) {
if (cl.getName().toString().endsWith(className)) {
LOG.info("found class {}", className);
for (IMethod m : cl.getAllMethods()) {
if (m.getName().toString().equals(methodName) || m.getSignature().equals(methodName)) {
try {
PrintTestIRs.printToPDF("target", application.getClassHierachy(), application.findIRForMethod(m));
} catch (WalaException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
LOG.info("found method {}; {}", m.getSignature());
return application.findIRMethodForMethod(m);
}
}
}
}
throw new IllegalStateException(String.format("no method found %s %s", className, methodName));
}
示例8: run
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
public static Process run(String[] args) throws IOException {
try {
validateCommandLine(args);
String classpath = args[CLASSPATH_INDEX];
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, null);
ExampleUtil.addDefaultExclusions(scope);
// invoke WALA to build a class hierarchy
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Graph<IClass> g = typeHierarchy2Graph(cha);
g = pruneForAppLoader(g);
//String dotFile = "/tmp" + File.separatorChar + DOT_FILE;
String dotFile = File.createTempFile("out", ".dt").getAbsolutePath();
String pdfFile = File.createTempFile("out", ".pdf").getAbsolutePath();
String dotExe = "dot";
String gvExe = "open";
DotUtil.dotify(g, null, dotFile, pdfFile, dotExe);
return PDFViewUtil.launchPDFView(pdfFile, gvExe);
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
示例9: pruneForAppLoader
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
/**
* Restrict g to nodes from the Application loader
*/
public static Graph<IClass> pruneForAppLoader(Graph<IClass> g) throws WalaException {
Predicate<IClass> f = new Predicate<IClass>() {
@Override public boolean test(IClass c) {
return (c.getClassLoader().getReference().equals(ClassLoaderReference.Application));
}
};
return pruneGraph(g, f);
}
示例10: getSystemJars
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
/**
* Collect the set of JarFiles that constitute the system libraries of the running JRE.
*/
private JarFile[] getSystemJars() throws IOException {
String javaHomePath = "garbage";
Set<JarFile> jarFiles = HashSetFactory.make();
// first, see if wala.properties has been set up
try {
Properties p = WalaProperties.loadProperties();
javaHomePath = p.getProperty(WalaProperties.J2SE_DIR);
} catch (WalaException e) {
// no luck.
}
// if not, try assuming the running JRE looks normal
File x = new File(javaHomePath);
if (!(x.exists() && x.isDirectory())) {
javaHomePath = System.getProperty("java.home");
if (!javaHomePath.endsWith(File.separator)) {
javaHomePath = javaHomePath + File.separator;
}
javaHomePath = javaHomePath + "lib";
}
// find jars from chosen JRE lib path
collectJars(new File(javaHomePath), jarFiles);
return jarFiles.toArray(new JarFile[jarFiles.size()]);
}
示例11: makeScriptCGBuilder
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
/**
* create a CG builder for script. Note that the script at dir/name is loaded via the classloader, not from the filesystem.
*/
public static JSCFABuilder makeScriptCGBuilder(String dir, String name, CGBuilderType builderType, ClassLoader loader) throws IOException, WalaException {
URL script = getURLforFile(dir, name, loader);
CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, script) : null;
JavaScriptLoaderFactory loaders = JSCallGraphUtil.makeLoaders(preprocessor);
AnalysisScope scope = makeScriptScope(dir, name, loaders, loader);
return makeCG(loaders, scope, builderType, AstIRFactory.makeDefaultFactory());
}
示例12: makeScriptCG
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
public static CallGraph makeScriptCG(String dir, String name, CGBuilderType builderType, ClassLoader loader) throws IOException,
IllegalArgumentException, CancelException, WalaException {
PropagationCallGraphBuilder b = makeScriptCGBuilder(dir, name, builderType, loader);
CallGraph CG = b.makeCallGraph(b.getOptions());
// dumpCG(b.getPointerAnalysis(), CG);
return CG;
}
示例13: makeHTMLCGBuilder
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
public static JSCFABuilder makeHTMLCGBuilder(URL url, CGBuilderType builderType, Function<Void, JSSourceExtractor> fExtractor) throws IOException, WalaException {
IRFactory<IMethod> irFactory = AstIRFactory.makeDefaultFactory();
CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, url) : null;
JavaScriptLoaderFactory loaders = new WebPageLoaderFactory(translatorFactory, preprocessor);
SourceModule[] scriptsArray = makeHtmlScope(url, loaders, fExtractor);
JSCFABuilder builder = makeCGBuilder(loaders, scriptsArray, builderType, irFactory);
if(builderType.extractCorrelatedPairs)
builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), 2, builder.getContextSelector()));
builder.setBaseURL(url);
return builder;
}
示例14: makeHTMLCGBuilder
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
public static JSCFABuilder makeHTMLCGBuilder(URL url, CGBuilderType builderType) throws IOException, WalaException {
IRFactory<IMethod> irFactory = AstIRFactory.makeDefaultFactory();
CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, url) : null;
JavaScriptLoaderFactory loaders = new WebPageLoaderFactory(translatorFactory, preprocessor);
SourceModule[] scriptsArray = makeHtmlScope(url, loaders);
JSCFABuilder builder = makeCGBuilder(loaders, scriptsArray, builderType, irFactory);
if(builderType.extractCorrelatedPairs)
builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), 2, builder.getContextSelector()));
builder.setBaseURL(url);
return builder;
}
示例15: makeScriptCGBuilder
import com.ibm.wala.util.WalaException; //导入依赖的package包/类
/**
* create a CG builder for script. Note that the script at dir/name is
* loaded via the classloader, not from the filesystem.
*/
public static JSCFABuilder makeScriptCGBuilder(String dir, String name,
CGBuilderType builderType) throws IOException, WalaException {
URL script = getURLforFile(dir, name);
CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs
? new CorrelatedPairExtractorFactory(translatorFactory, script)
: null;
JavaScriptLoaderFactory loaders = JSCallGraphUtil
.makeLoaders(preprocessor);
AnalysisScope scope = makeScriptScope(script, dir, name, loaders);
return makeCG(loaders, scope, builderType,
AstIRFactory.makeDefaultFactory());
}