reprogrammer / keshmesh

Keshmesh is a static analysis tool for finding and fixing concurrency bug patterns in Java.
http://keshmesh.cs.illinois.edu/
Other
16 stars 5 forks source link

WALA failed on Tomcat #6

Closed reprogrammer closed 13 years ago

reprogrammer commented 13 years ago

When I ran the Keshmesh plugin for Findbugs on the latest version of Tomcat as of Dec 4, 2010, I got the following exception.

!SESSION 2010-12-04 00:14:37.836 -----------------------------------------------
eclipse.buildId=M20100909-0800
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.platform.ide
Command-line arguments:  -product org.eclipse.platform.ide -data /home/username/eclipse-workspaces/keshmesh/../KeshmeshRuntimeWorkspace -dev file:/home/username/eclipse-workspaces/keshmesh/.metadata/.plugins/org.eclipse.pde.core/Keshmesh/dev.properties -os linux -ws gtk -arch x86_64 -consoleLog

!ENTRY org.eclipse.core.jobs 4 2 2010-12-04 00:16:04.718
!MESSAGE An internal error occurred during: "Finding bugs in Tomcat...".
!STACK 0
com.ibm.wala.util.debug.UnimplementedError: Unhandled type declaration type
    at com.ibm.wala.util.debug.Assertions.UNREACHABLE(Assertions.java:55)
    at com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator.visit(JDTJava2CAstTranslator.java:2643)
    at com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator.translate(JDTJava2CAstTranslator.java:241)
    at com.ibm.wala.cast.java.translator.Java2IRTranslator.translate(Java2IRTranslator.java:57)
    at com.ibm.wala.cast.java.translator.jdt.JDTSourceModuleTranslator$1.acceptAST(JDTSourceModuleTranslator.java:144)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:883)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:577)
    at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:888)
    at com.ibm.wala.cast.java.translator.jdt.JDTSourceModuleTranslator.loadAllSources(JDTSourceModuleTranslator.java:140)
    at com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.loadAllSources(JavaSourceLoaderImpl.java:428)
    at com.ibm.wala.classLoader.ClassLoaderImpl.init(ClassLoaderImpl.java:349)
    at com.ibm.wala.cast.java.translator.jdt.JDTClassLoaderFactory.makeNewClassLoader(JDTClassLoaderFactory.java:67)
    at com.ibm.wala.classLoader.ClassLoaderFactoryImpl.getLoader(ClassLoaderFactoryImpl.java:68)
    at com.ibm.wala.ipa.cha.ClassHierarchy.(ClassHierarchy.java:229)
    at com.ibm.wala.ipa.cha.ClassHierarchy.(ClassHierarchy.java:175)
    at com.ibm.wala.ipa.cha.ClassHierarchy.make(ClassHierarchy.java:1172)
    at com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine.buildClassHierarchy(JavaSourceAnalysisEngine.java:130)
    at com.ibm.wala.client.AbstractAnalysisEngine.defaultCallGraphBuilder(AbstractAnalysisEngine.java:292)
    at com.ibm.wala.client.AbstractAnalysisEngine.buildDefaultCallGraph(AbstractAnalysisEngine.java:301)
    at edu.illinois.keshmesh.detector.Main.initAnalysis(Main.java:53)
    at edu.illinois.keshmesh.detector.Main.initAndPerformAnalysis(Main.java:40)
    at edu.illinois.keshmesh.ui.findbugs.KeshmeshFindBugsDetector.visitClassContext(KeshmeshFindBugsDetector.java:80)
    at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:74)
    at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1117)
    at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:269)
    at de.tobject.findbugs.builder.FindBugsWorker.runFindBugs(FindBugsWorker.java:288)
    at de.tobject.findbugs.builder.FindBugsWorker.work(FindBugsWorker.java:198)
    at de.tobject.findbugs.actions.FindBugsAction$StartedFromViewJob.runWithProgress(FindBugsAction.java:265)
    at de.tobject.findbugs.FindBugsJob.run(FindBugsJob.java:61)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

It looks like WALA fails to build the call graph for Tomcat.

reprogrammer commented 13 years ago

The problem is that WALA CAst doesn't handle annotation type declarations at the moment. Therefore, we changed com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator to suppress the exception.

reprogrammer commented 13 years ago

I've reopened this issue because it seems to be causing issue #8.

reprogrammer commented 13 years ago

I filed a bug report on the WALA's bug tracker system for this issue.

reprogrammer commented 13 years ago

It turned out that our patch had fixed this problem but we didn't realize it. Anyways, this problem has been fixed in revision 4020 of com.ibm.wala.cast.java.jdt.

reprogrammer commented 13 years ago

WALA still fails on Tomcat with the following exception.

edu.illinois.keshmesh.detector.exception.Exceptions$WALAInitializationException: java.lang.NullPointerException
    at edu.illinois.keshmesh.detector.Main.initAnalysis(Main.java:60)
    at edu.illinois.keshmesh.detector.Main.initAndPerformAnalysis(Main.java:40)
    at edu.illinois.keshmesh.ui.findbugs.KeshmeshFindBugsDetector.visitClassContext(KeshmeshFindBugsDetector.java:80)
    at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:74)
    at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1109)
    at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:266)
    at de.tobject.findbugs.builder.FindBugsWorker.runFindBugs(FindBugsWorker.java:288)
    at de.tobject.findbugs.builder.FindBugsWorker.work(FindBugsWorker.java:198)
    at de.tobject.findbugs.actions.FindBugsAction$StartedFromViewJob.runWithProgress(FindBugsAction.java:265)
    at de.tobject.findbugs.FindBugsJob.run(FindBugsJob.java:61)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.NullPointerException
    at com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.defineType(JavaSourceLoaderImpl.java:456)
    at com.ibm.wala.cast.java.translator.JavaCAst2IRTranslator.defineType(JavaCAst2IRTranslator.java:322)
    at com.ibm.wala.cast.ir.translator.AstTranslator.visitTypeEntity(AstTranslator.java:2385)
    at com.ibm.wala.cast.tree.visit.CAstVisitor.visitEntities(CAstVisitor.java:156)
    at com.ibm.wala.cast.tree.visit.CAstVisitor.visitScopedEntities(CAstVisitor.java:122)
    at com.ibm.wala.cast.tree.visit.CAstVisitor.visitScopedEntities(CAstVisitor.java:114)
    at com.ibm.wala.cast.tree.visit.CAstVisitor.visitEntities(CAstVisitor.java:138)
    at com.ibm.wala.cast.ir.translator.AstTranslator.walkEntities(AstTranslator.java:3611)
    at com.ibm.wala.cast.ir.translator.AstTranslator.translate(AstTranslator.java:3682)
    at com.ibm.wala.cast.java.translator.JavaCAst2IRTranslator.translate(JavaCAst2IRTranslator.java:51)
    at com.ibm.wala.cast.java.translator.Java2IRTranslator.translate(Java2IRTranslator.java:76)
    at com.ibm.wala.cast.java.translator.jdt.JDTSourceModuleTranslator$1.acceptAST(JDTSourceModuleTranslator.java:144)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:883)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:577)
    at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:888)
    at com.ibm.wala.cast.java.translator.jdt.JDTSourceModuleTranslator.loadAllSources(JDTSourceModuleTranslator.java:140)
    at com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.loadAllSources(JavaSourceLoaderImpl.java:428)
    at com.ibm.wala.classLoader.ClassLoaderImpl.init(ClassLoaderImpl.java:478)
    at com.ibm.wala.cast.java.translator.jdt.JDTClassLoaderFactory.makeNewClassLoader(JDTClassLoaderFactory.java:67)
    at com.ibm.wala.classLoader.ClassLoaderFactoryImpl.getLoader(ClassLoaderFactoryImpl.java:68)
    at com.ibm.wala.ipa.cha.ClassHierarchy.(ClassHierarchy.java:229)
    at com.ibm.wala.ipa.cha.ClassHierarchy.(ClassHierarchy.java:175)
    at com.ibm.wala.ipa.cha.ClassHierarchy.make(ClassHierarchy.java:1172)
    at com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine.buildClassHierarchy(JavaSourceAnalysisEngine.java:130)
    at com.ibm.wala.client.AbstractAnalysisEngine.defaultCallGraphBuilder(AbstractAnalysisEngine.java:292)
    at com.ibm.wala.client.AbstractAnalysisEngine.buildDefaultCallGraph(AbstractAnalysisEngine.java:301)
    at edu.illinois.keshmesh.detector.Main.initAnalysis(Main.java:53)
    ... 10 more

This exception is thrown because com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.fTypeMap is null in com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.defineType even though it's initialized when it's declared because com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.loadAllSources(Set<ModuleEntry>) sets it to null.

reprogrammer commented 13 years ago

We've switched from WALA's source front end (CAst) to the byte code front end. So, we no longer need to fix this issue.