use of com.github.javaparser.ParseProblemException in project javaparser by javaparser.
the class JavadocExtractorTest method processFile.
private void processFile(File file) throws FileNotFoundException {
try {
CompilationUnit cu = JavaParser.parse(file, StandardCharsets.UTF_8);
new VoidVisitorAdapter<Object>() {
@Override
public void visit(JavadocComment n, Object arg) {
super.visit(n, arg);
n.parse();
}
}.visit(cu, null);
} catch (ParseProblemException e) {
System.err.println("ERROR PROCESSING " + file);
}
}
use of com.github.javaparser.ParseProblemException in project structr by structr.
the class AnalyzeJavaFunction method apply.
@Override
public Object apply(final ActionContext ctx, final Object caller, final Object[] sources) throws FrameworkException {
try {
if (!(arrayHasLengthAndAllElementsNotNull(sources, 1) && sources[0] instanceof String)) {
return null;
}
try {
final SecurityContext securityContext = ctx.getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
// Analyze string as Java code
new JavaParserModule(app).analyzeMethodsInJavaFile((String) sources[0]);
return "";
} catch (final ParseProblemException ex) {
logException(caller, ex, sources);
}
} catch (final IllegalArgumentException e) {
logParameterError(caller, sources, ctx.isJavaScriptContext());
return usage(ctx.isJavaScriptContext());
}
return "";
}
Aggregations