You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Thomas Guretzki (JIRA)" <ji...@apache.org> on 2010/03/29 17:02:27 UTC
[jira] Created: (PIVOT-447) TextInput Component's selection methods
throw NPE when textNode property is null
TextInput Component's selection methods throw NPE when textNode property is null
--------------------------------------------------------------------------------
Key: PIVOT-447
URL: https://issues.apache.org/jira/browse/PIVOT-447
Project: Pivot
Issue Type: Bug
Components: wtk, wtk-terra
Affects Versions: 1.4, 1.5, 1.5.1, 2.0, 2.1, 3.0
Environment: Windows XP, Java 1.6.0_17
Reporter: Thomas Guretzki
TextInput Component: setSelection(int selectionStart, int selectionLength):
third <if> should be:
"if (selectionStart < 0
|| selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
or something similar
respectively
TerraTextInputSkin's updateSelection():
definition of local variable <n> (6th line of code) should be
"int n = (textNode == null ? 0 : textNode.getCharacterCount());"
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PIVOT-447) TextInput Component's selection
methods throw NPE when textNode property is null
Posted by "Thomas Guretzki (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850945#action_12850945 ]
Thomas Guretzki commented on PIVOT-447:
---------------------------------------
TextInput's setText method is
"public void setText(String text) {
setTextNode((text == null) ? null : new TextNode(text));
}",
so an empty Text produces a null TextNode.
Is that really an illegal state?
The problem came up for me when I tried to edit in a TableView where one column was bound to a null value.
I think that should be possible, don't you?
> TextInput Component's selection methods throw NPE when textNode property is null
> --------------------------------------------------------------------------------
>
> Key: PIVOT-447
> URL: https://issues.apache.org/jira/browse/PIVOT-447
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Affects Versions: 1.4
> Environment: Windows XP, Java 1.6.0_17
> Reporter: Thomas Guretzki
> Fix For: 1.5
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> TextInput Component: setSelection(int selectionStart, int selectionLength):
> third <if> should be:
> "if (selectionStart < 0
> || selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
> or something similar
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PIVOT-447) TextInput Component's selection
methods throw NPE when textNode property is null
Posted by "Thomas Guretzki (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12851408#action_12851408 ]
Thomas Guretzki commented on PIVOT-447:
---------------------------------------
okay, I've tested my original problem against the trunk, and the NPE is gone. So no more need to change anything, from my point of view.
> TextInput Component's selection methods throw NPE when textNode property is null
> --------------------------------------------------------------------------------
>
> Key: PIVOT-447
> URL: https://issues.apache.org/jira/browse/PIVOT-447
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Affects Versions: 1.4
> Environment: Windows XP, Java 1.6.0_17
> Reporter: Thomas Guretzki
> Fix For: 1.5
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> TextInput Component: setSelection(int selectionStart, int selectionLength):
> third <if> should be:
> "if (selectionStart < 0
> || selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
> or something similar
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PIVOT-447) TextInput Component's selection methods
throw NPE when textNode property is null
Posted by "Thomas Guretzki (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Guretzki updated PIVOT-447:
----------------------------------
Component/s: (was: wtk-terra)
Description:
TextInput Component: setSelection(int selectionStart, int selectionLength):
third <if> should be:
"if (selectionStart < 0
|| selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
or something similar
was:
TextInput Component: setSelection(int selectionStart, int selectionLength):
third <if> should be:
"if (selectionStart < 0
|| selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
or something similar
respectively
TerraTextInputSkin's updateSelection():
definition of local variable <n> (6th line of code) should be
"int n = (textNode == null ? 0 : textNode.getCharacterCount());"
> TextInput Component's selection methods throw NPE when textNode property is null
> --------------------------------------------------------------------------------
>
> Key: PIVOT-447
> URL: https://issues.apache.org/jira/browse/PIVOT-447
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Affects Versions: 1.4, 1.5, 1.5.1, 2.0, 2.1, 3.0
> Environment: Windows XP, Java 1.6.0_17
> Reporter: Thomas Guretzki
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> TextInput Component: setSelection(int selectionStart, int selectionLength):
> third <if> should be:
> "if (selectionStart < 0
> || selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
> or something similar
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (PIVOT-447) TextInput Component's selection
methods throw NPE when textNode property is null
Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Greg Brown resolved PIVOT-447.
------------------------------
Resolution: Fixed
This is fixed in the current trunk. TextInput now throws IllegalStateException in this case, similar to TextArea. However, note that TextInput#setTextNode() is deprecated in Pivot 1.5 and will be removed in Pivot 2.0.
> TextInput Component's selection methods throw NPE when textNode property is null
> --------------------------------------------------------------------------------
>
> Key: PIVOT-447
> URL: https://issues.apache.org/jira/browse/PIVOT-447
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Affects Versions: 1.4
> Environment: Windows XP, Java 1.6.0_17
> Reporter: Thomas Guretzki
> Fix For: 1.5
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> TextInput Component: setSelection(int selectionStart, int selectionLength):
> third <if> should be:
> "if (selectionStart < 0
> || selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
> or something similar
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PIVOT-447) TextInput Component's selection
methods throw NPE when textNode property is null
Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850954#action_12850954 ]
Greg Brown commented on PIVOT-447:
----------------------------------
It is an illegal state to set a selection (you can't select any part of null). TextArea applies the same logic.
Again, note that methods related to text nodes (and everything else in org.apache.wtk.text) are deprecated in 1.5 - null values will no longer be supported at all in Pivot 2.0.
> TextInput Component's selection methods throw NPE when textNode property is null
> --------------------------------------------------------------------------------
>
> Key: PIVOT-447
> URL: https://issues.apache.org/jira/browse/PIVOT-447
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Affects Versions: 1.4
> Environment: Windows XP, Java 1.6.0_17
> Reporter: Thomas Guretzki
> Fix For: 1.5
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> TextInput Component: setSelection(int selectionStart, int selectionLength):
> third <if> should be:
> "if (selectionStart < 0
> || selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
> or something similar
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PIVOT-447) TextInput Component's selection methods
throw NPE when textNode property is null
Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Greg Brown updated PIVOT-447:
-----------------------------
Affects Version/s: (was: 1.5.1)
(was: 3.0)
(was: 2.1)
(was: 1.5)
(was: 2.0)
Fix Version/s: 1.5
> TextInput Component's selection methods throw NPE when textNode property is null
> --------------------------------------------------------------------------------
>
> Key: PIVOT-447
> URL: https://issues.apache.org/jira/browse/PIVOT-447
> Project: Pivot
> Issue Type: Bug
> Components: wtk
> Affects Versions: 1.4
> Environment: Windows XP, Java 1.6.0_17
> Reporter: Thomas Guretzki
> Fix For: 1.5
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> TextInput Component: setSelection(int selectionStart, int selectionLength):
> third <if> should be:
> "if (selectionStart < 0
> || selectionStart + selectionLength > (textNode == null ? 0 : textNode.getCharacterCount())) "
> or something similar
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.