Skip to content

Commit

Permalink
Log parsing errors instead of failing (#125)
Browse files Browse the repository at this point in the history
1. Split the class hierarchy construction front-end parsing error
checking into two.
2. Log parsing errors instead of throwing an exception.
  • Loading branch information
khatchad authored Dec 22, 2023
1 parent 244697e commit 1fd3e0e
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.CancelException;
import com.ibm.wala.util.WalaException;
import com.ibm.wala.util.WalaRuntimeException;
import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.collections.HashSetFactory;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

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

@Override
public IClassHierarchy buildClassHierarchy() {
IClassHierarchy cha = null;

try {
IClassHierarchy cha = SeqClassHierarchyFactory.make(scope, loader);
Util.checkForFrontEndErrors(cha);
setClassHierarchy(cha);
return cha;
cha = SeqClassHierarchyFactory.make(scope, loader);
} catch (ClassHierarchyException e) {
assert false : e;
return null;
}

try {
Util.checkForFrontEndErrors(cha);
} catch (WalaException e) {
throw new WalaRuntimeException(e.getMessage(), e);
logger.log(
Level.WARNING,
e,
() -> "Encountered WALA exception, most likely from front-end parsing errors.");
}

setClassHierarchy(cha);
return cha;
}

protected void addSummaryBypassLogic(AnalysisOptions options, String summary) {
Expand Down

0 comments on commit 1fd3e0e

Please sign in to comment.