kwin commented on code in PR #1983:
URL: https://github.com/apache/maven-resolver/pull/1983#discussion_r3794724640
##########
maven-resolver-tools/src/main/java/org/eclipse/aether/tools/ConfigurationCollectorDoclet.java:
##########
@@ -153,43 +152,85 @@ private boolean doRun(DocletEnvironment environment) {
continue;
}
DocCommentTree docComment = docTrees.getDocCommentTree(field);
- if ("maven".equals(mode)) {
- processMavenField(type, field, docComment, discoveredKeys);
- } else if ("resolver".equals(mode)) {
- processResolverField(type, field, docComment,
discoveredKeys);
- } else {
- throw new IllegalArgumentException("Unknown mode: " +
mode);
+ try {
+ if ("maven".equals(mode)) {
+ processMavenField(type, field, docComment,
discoveredKeys);
+ } else if ("resolver".equals(mode)) {
+ processResolverField(type, field, docComment,
discoveredKeys);
+ } else {
+ // TODO: move to beginning of run() and validate mode
before processing any types
+ reportError("Unknown mode: " + mode);
+ return false;
+ }
+ } catch (DocTreePathAwareRuntimeException e) {
+ reportError(e.getDocTreePath(), e.getMessage());
+ } catch (RuntimeException e) {
+ DocTreePath rootPath = new
DocTreePath(docTrees.getPath(field), docComment);
+ reportError(rootPath, e.getMessage());
Review Comment:
I no longer see a code path where rootPath may be empty!
##########
maven-resolver-tools/src/main/java/org/eclipse/aether/tools/ConfigurationCollectorDoclet.java:
##########
@@ -153,43 +152,85 @@ private boolean doRun(DocletEnvironment environment) {
continue;
}
DocCommentTree docComment = docTrees.getDocCommentTree(field);
- if ("maven".equals(mode)) {
- processMavenField(type, field, docComment, discoveredKeys);
- } else if ("resolver".equals(mode)) {
- processResolverField(type, field, docComment,
discoveredKeys);
- } else {
- throw new IllegalArgumentException("Unknown mode: " +
mode);
+ try {
+ if ("maven".equals(mode)) {
+ processMavenField(type, field, docComment,
discoveredKeys);
+ } else if ("resolver".equals(mode)) {
+ processResolverField(type, field, docComment,
discoveredKeys);
+ } else {
+ // TODO: move to beginning of run() and validate mode
before processing any types
+ reportError("Unknown mode: " + mode);
+ return false;
+ }
+ } catch (DocTreePathAwareRuntimeException e) {
+ reportError(e.getDocTreePath(), e.getMessage());
+ } catch (RuntimeException e) {
+ DocTreePath rootPath = new
DocTreePath(docTrees.getPath(field), docComment);
+ reportError(rootPath, e.getMessage());
Review Comment:
I no longer see a code path where rootPath may be null!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]