You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey A. Ivanov (JIRA)" <ji...@apache.org> on 2006/12/07 15:33:21 UTC

[jira] Created: (HARMONY-2523) [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null

[classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null
------------------------------------------------------------------------------------------------

                 Key: HARMONY-2523
                 URL: http://issues.apache.org/jira/browse/HARMONY-2523
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Alexey A. Ivanov
            Priority: Minor




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (HARMONY-2523) [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey A. Ivanov closed HARMONY-2523.
-------------------------------------


Works fine.
Thank you, Mark.

> [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2523
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2523
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>         Assigned To: Mark Hindess
>            Priority: Minor
>         Attachments: H2523-j.s.t.DefaultFormatter.patch, H2523-JFormattedTextFieldTest.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-2523) [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2523?page=all ]

Alexey A. Ivanov updated HARMONY-2523:
--------------------------------------

    Attachment: H2523-j.s.t.DefaultFormatter.patch

Fixes the problem. The actual fix:
-  Math.max(length, text.length()));
+ Math.max(length, text != null ? text.length() : 0));

Also the patch resolves all compiler warnings for DefaultFormatter.

> [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2523
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2523
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: H2523-j.s.t.DefaultFormatter.patch, H2523-JFormattedTextFieldTest.patch
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (HARMONY-2523) [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess resolved HARMONY-2523.
-----------------------------------

    Resolution: Fixed
      Assignee: Mark Hindess

Applied in r495897.  Please confirm that they have been applied as expected.


> [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2523
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2523
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>         Assigned To: Mark Hindess
>            Priority: Minor
>         Attachments: H2523-j.s.t.DefaultFormatter.patch, H2523-JFormattedTextFieldTest.patch
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2523) [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2523?page=all ]

Alexey A. Ivanov updated HARMONY-2523:
--------------------------------------

    Patch Info: [Patch Available]

> [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2523
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2523
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: H2523-j.s.t.DefaultFormatter.patch, H2523-JFormattedTextFieldTest.patch
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2523) [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2523?page=all ]

Alexey A. Ivanov updated HARMONY-2523:
--------------------------------------

    Attachment: H2523-JFormattedTextFieldTest.patch

Regression test

> [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2523
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2523
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: H2523-JFormattedTextFieldTest.patch
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2523) [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2523?page=comments#action_12456434 ] 
            
Alexey A. Ivanov commented on HARMONY-2523:
-------------------------------------------

The following code throws NPE on Harmony:

===============================
import javax.swing.JFormattedTextField;

public class HTest2523 {
    public static void main(String[] args) {
        final Object obj= new Object() {
            @Override
            public String toString() {
                return null;
            }
        };
        final JFormattedTextField ftf = new JFormattedTextField(obj);
        System.out.println("'" + ftf.getText() + "'");
    }
}
===============================


The expected output is:
''

That is getText() returns empty string.

> [classlib][swing] j.s.text.JFormattedTextField(Object) throws NPE when Object.toString() == null
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2523
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2523
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira