Repository navigation
[NETBEANS-4620] NullPointerException - finding occurrences - #2325
Merged
Merged
Conversation
To avoid NPE, check new value is not `null` but `Caret`. If it's `null`, `BasicTextUI.editor` field may be `null`. ``` java.lang.NullPointerException at java.desktop/javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1104) at java.desktop/javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1089) at java.desktop/javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1065) at org.netbeans.modules.editor.search.SearchComboBoxEditor$ManageViewPositionListener.changed(SearchComboBoxEditor.java:290) at org.netbeans.modules.editor.search.SearchComboBoxEditor$ManageViewPositionListener.removeUpdate(SearchComboBoxEditor.java:277) at org.netbeans.lib.editor.util.swing.PriorityDocumentListenerList.removeUpdate(PriorityDocumentListenerList.java:91) at java.desktop/javax.swing.text.AbstractDocument.fireRemoveUpdate(AbstractDocument.java:261) at org.netbeans.editor.BaseDocument.fireRemoveUpdate(BaseDocument.java:1650) at org.netbeans.editor.BaseDocument.handleRemove(BaseDocument.java:1022) at org.netbeans.editor.BaseDocument$FilterBypassImpl.remove(BaseDocument.java:2639) at java.desktop/javax.swing.text.DocumentFilter.remove(DocumentFilter.java:79) at org.netbeans.editor.BaseDocument.remove(BaseDocument.java:935) at org.netbeans.modules.editor.search.SearchComboBoxEditor$3.propertyChange(SearchComboBoxEditor.java:137) ```
Member
|
Thanks @junichi11 So this is from fix for NB-4444, and a regression between 12.0 and 12.1? Agree we should merge for release, even if that delays us a few days. Need to work out what to do about commits that went in to master without being intended for 12.1. cc @geertjanw |
Member
Author
Yes, I think so. (#2188) |
Member
|
@lkishalmi not sure this should be backported for 12.0-u2 - #2188 is in 12.1 not 12.0. |
neilcsmith-net
approved these changes
Aug 24, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/NETBEANS-4620
Probably https://issues.apache.org/jira/browse/NETBEANS-4623, too
To avoid NPE, check new value is not
nullbutCaret. If it'snull,BasicTextUI.editorfield may benull.The other NPE:
JTextComponent.write is the following:
I've confirmed that
editorPane.getUI().getEditorKit(editorPane)isnull, when the new value isnull. So we should be able to avoid NPE.Steps to reproduce the problem in beta version
CC: @DevCharly