Skip to content
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

JBIDE-23303 - NullPointerException in ELValidator.validateElOperand #573

Merged
merged 1 commit into from
Oct 7, 2016

Conversation

vrubezhny
Copy link
Contributor

NPE is prevented.

Signed-off-by: Victor Rubezhny vrubezhny@redhat.com

@@ -510,7 +510,7 @@ private void validateElOperand(ELReference elReference, ELInvocationExpression o
if(token==null) {
WebKbPlugin.getDefault().logError("The token from unresolved segment is null. EL: [" + operand + "]");
}
varName = token.getText();
varName = token != null ? token.getText() : null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably wrap the rest of the method in } else { ...} block instead. See lines 510-512.

Copy link
Contributor Author

@vrubezhny vrubezhny Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually. I believe that adding "return;" statement in the end of "if(token==null){}" body (after the error message is logged) would be better as we don't need to worry of the rest operations in this case (and actually not able to do anything more).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's matter of your personal preferences. The logic will be the same. So feel free to use "return".

NPE is prevented.

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
@vrubezhny
Copy link
Contributor Author

I've pushed an updated fix that just adds 'return;' statement after the error logging. I don't see a need of moving that amount of the rest code into any blocks as we actually cannot do anything else after token is found to be null.

@alexeykazakov alexeykazakov merged commit b2105a6 into jbosstools:master Oct 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants