Skip to content

Commit

Permalink
Catch Thrown Exceptions During Parsing Failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Konloch committed Sep 26, 2024
1 parent ec67ba8 commit d811272
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.resolution.TypeSolver;
import com.github.javaparser.resolution.UnsolvedSymbolException;
import com.github.javaparser.symbolsolver.JavaSymbolSolver;
import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver;
import com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver;
Expand Down Expand Up @@ -58,10 +59,13 @@ public void parse()
StaticJavaParser.getParserConfiguration().setSymbolResolver(new JavaSymbolSolver(typeSolver));
CompilationUnit compilationUnit = StaticJavaParser.parse(this.content);
compilationUnit.accept(new MyVoidVisitor(this, compilationUnit), null);
} catch (ParseProblemException e)
}
catch (java.lang.ClassCastException | UnsolvedSymbolException | ParseProblemException e)
{
System.err.println("Parsing error!");
} catch (IOException e)
e.printStackTrace();
}
catch (IOException e)
{
throw new RuntimeException(e);
}
Expand Down

0 comments on commit d811272

Please sign in to comment.