Skip to content

Commit 1fd3e0e

Browse files
authored
Log parsing errors instead of failing (#125)
1. Split the class hierarchy construction front-end parsing error checking into two. 2. Log parsing errors instead of throwing an exception.
1 parent 244697e commit 1fd3e0e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/client/PythonAnalysisEngine.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@
5858
import com.ibm.wala.types.TypeReference;
5959
import com.ibm.wala.util.CancelException;
6060
import com.ibm.wala.util.WalaException;
61-
import com.ibm.wala.util.WalaRuntimeException;
6261
import com.ibm.wala.util.collections.HashMapFactory;
6362
import com.ibm.wala.util.collections.HashSetFactory;
6463
import java.io.IOException;
6564
import java.util.Collection;
6665
import java.util.Collections;
6766
import java.util.Map;
6867
import java.util.Set;
68+
import java.util.logging.Level;
6969
import java.util.logging.Logger;
7070

7171
public abstract class PythonAnalysisEngine<T>
@@ -135,17 +135,26 @@ public void buildAnalysisScope() throws IOException {
135135

136136
@Override
137137
public IClassHierarchy buildClassHierarchy() {
138+
IClassHierarchy cha = null;
139+
138140
try {
139-
IClassHierarchy cha = SeqClassHierarchyFactory.make(scope, loader);
140-
Util.checkForFrontEndErrors(cha);
141-
setClassHierarchy(cha);
142-
return cha;
141+
cha = SeqClassHierarchyFactory.make(scope, loader);
143142
} catch (ClassHierarchyException e) {
144143
assert false : e;
145144
return null;
145+
}
146+
147+
try {
148+
Util.checkForFrontEndErrors(cha);
146149
} catch (WalaException e) {
147-
throw new WalaRuntimeException(e.getMessage(), e);
150+
logger.log(
151+
Level.WARNING,
152+
e,
153+
() -> "Encountered WALA exception, most likely from front-end parsing errors.");
148154
}
155+
156+
setClassHierarchy(cha);
157+
return cha;
149158
}
150159

151160
protected void addSummaryBypassLogic(AnalysisOptions options, String summary) {

0 commit comments

Comments
 (0)