-
Notifications
You must be signed in to change notification settings - Fork 207
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
Add null check for Disassembly view source #295
Conversation
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.
This looks good to me. May need some cosmetic and version changes to get it through the build, but the code change itself is done apart from the minor logging issue.
// Log error to indicate what is tha cause of the issue | ||
String warningMessage = "Line(s) " + Integer.toString(first) + "-" + Integer.toString(last) //$NON-NLS-1$ | ||
+ " cannot be found in file: " + fFileKey + ".\nSkipping lines!"; //$NON-NLS-1$ | ||
DsfUIPlugin.logErrorMessage(warningMessage); //$NON-NLS-1$ |
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.
This logErrorMessage has two minor problems:
- It discards the exception. I think you should log the exception too, it provides the stack trace/context to diagnose the problem
- What is logged in this case is
Internal message logged from Debug UI
as typeINTERAL_ERROR
, which seems a little to harsh here.
DsfUIPlugin.logErrorMessage(warningMessage); //$NON-NLS-1$ | |
DsfUIPlugin.log(Status.warning(warningMessage, e)); |
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.
I updated this and the Bundle-Version. Thank you!
GitHub doesn't allow me to add a comment to a non-modified file. The build failed with this error:
which means this line
needs to be changed to
|
Disassembly view is expected to be populated with lines that are fetched from a given source file. There might be the case where instructions on what lines to append are wrong. This results in a null response that will propagate through the code leading to a NPE. The current commit is proofing the code from NPE by: - removing the source position of the lines that were not found within the given file - null checking the source before becoming a key element in the code flow - adding logging if expected lines are not found in the given file Resolves: eclipse-cdt#287
Thanks @LizzMre - this change looks good now. I am waiting on CI to confirm no issues and then it can be merged. |
@jonahgraham Thank you very much for your help! |
Disassembly view is expected to be populated with lines that are fetched from a given source file. There might be the case where instructions on what lines to append are wrong. This results in a null response that will propagate through the code leading to a NPE.
The current commit is proofing the code from NPE by:
Resolves: #287