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

Fix IllegalStateException: No logical node selected! #5993

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthias-ronge
Copy link
Collaborator

Exception occurs when opening Metadata Editor, because calling method expects null in no-data case, but receives IllegalStateException:

Stacktrace

Copy link
Member

Choose a reason for hiding this comment

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

I think this can potentially create a NullPointerException because the result of DataEditorService.getStructuralElementView is also passed as last parameter to ProcessService.findLinkableChildProcesses where .contains is called on it without a null-check:

if (allowedStructuralElementTypes.contains(getBaseType(process.getId()))) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, because allowedSubstructuralElements is the result of Map.keySet() which cannot be null.

BTW, this is not the problem here. The problem was that the calling method expects null in case there is nothing (and there are severeal more correct return null; statements below in getStructuralElementView()), but in this one place the function throws an IllegalStateException instead of returning null.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe, but AddDocStrucTypeDialog.search definitely calls a method on the result of DataEditorService.getStructuralElementView (DataEditorService.getStructuralElementView(this.dataEditor).getAllowedSubstructuralElements(), to be specific), that will definitely result in a NullPointerException when getStructuralElementView is changed to return null:

Set<String> allowedSubstructuralElements = DataEditorService.getStructuralElementView(this.dataEditor)

It looks to me that the other cases where null is returned are problematic as well, because the resulting NullPointerException is not handled anywhere.

@matthias-ronge
Copy link
Collaborator Author

I also can't rule out that this will cause an error somewhere else, but for me it solved the specific stack trace problem (and maybe that's already helpful, for example to be able to see an error message). There may be more problems, but merging this would still be an improvement on before, not a deterioration overall, I think.

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.

2 participants