-
Notifications
You must be signed in to change notification settings - Fork 858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NETBEANS-7981] Handling Diagnostics with position -1 while writing error/warning index. #7983
Conversation
The warnings that cause this for the sample case @mbien described are:
For these cases the new code path is hit, so from my POV this fixes the issue. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the file location to the message might help in future to track problems down:
diff --git a/ide/parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/errors/TaskCache.java b/ide/parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/errors/TaskCache.java
index 08a415f..95d128a 100644
--- a/ide/parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/errors/TaskCache.java
+++ b/ide/parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/errors/TaskCache.java
@@ -229,7 +229,7 @@
}
});
} catch (IOException ex) {
- Exceptions.printStackTrace(ex);
+ LOG.log(Level.SEVERE, "can't dump errors for: " + String.valueOf(i), ex);
}
}
It might be better to wrap + rethrow as runtime exception and let the indexer handle it - but this would go beyond a hotfix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
I merge as it is ? and @mbien patch is for NB25 ? |
@ebarboni I think it would be good to have better logging there. Since the exception does not tell where the problem is. In my case: i had probably about 100 projects open and had to narrow it down first. A good log line would point to the right place right away. I suppose I could a) open a second PR or b) add a commit to this PR? cc @lahodaj @matthiasblaesing |
I think this is good to go as is. The exception backtrace is a 100% match into the right file. While I agree, that knowing the problematic file, this is IMHO not really needed for this hotfix. |
the exception trace won't contain the file path which is causing the exception. To clarify the diff: the |
My focus is to get a new VC fast. We can discuss this longer, but from my perspective we gain little. I don't care either way. The fix is here and is mergeable, everything else takes more time. |
257a014
to
1a5e7a8
Compare
I've tweaked the code to attach the message to the exception. |
rc4 online |
When code like:
is indexed with
-Xlint:deprecation
, writing error/warning index may fail due to an exception like:This is because the Diagnostics has end position
-1
. This patch simply proposes to treat this case as a missing end position.Separately, it should be investigated if javac should produce errors or warnings like this.