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/18 17:09:21 UTC

[jira] Created: (HARMONY-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

[classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
---------------------------------------------------------------------------------

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


javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.

======= Code to Reproduce =======
import javax.swing.text.DefaultCaret;

public class Test {
    public static void main(String[] args) {
        new DefaultCaret().install(null);
        System.err.println("silent");
    }
}
======== end of code ======


------- Harmony -------
silent
------- end -------

------- RI -------
java.lang.NullPointerException
	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
	at Test.main(Test.java:5)
------- end -------

-- 
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-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

Mark Hindess commented on HARMONY-2782:
---------------------------------------

The regression test passes for me without applying either of the other to patches?


> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

-- 
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-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

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

    Attachment: H2782-DefaultCaretTest.patch

Regression test.

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: H2782-DefaultCaretTest.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

-- 
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-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

Alexey Petrenko resolved HARMONY-2782.
--------------------------------------

    Resolution: Fixed

The patch has been applied.
Please verify.

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>         Assigned To: Alexey Petrenko
>            Priority: Minor
>         Attachments: H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

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


[jira] Updated: (HARMONY-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

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

    Attachment: H2782-o.a.h.awt.text.TextCaret.patch
                H2782-javax.swing.text.patch

The fix: Removed check for null from the code. Modified TextCaret interface so that setComponent returns null. This modification cause several changes in swing classes.

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

-- 
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-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

Alexey Petrenko resolved HARMONY-2782.
--------------------------------------

    Resolution: Fixed

The patch has been applied. Please verify.

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>         Assigned To: Alexey Petrenko
>            Priority: Minor
>         Attachments: H2782-DefaultCaret-install.patch, H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch, H2782-swing-messages.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

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


[jira] Reopened: (HARMONY-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

Alexey A. Ivanov reopened HARMONY-2782:
---------------------------------------


Reopened to provide the patch to remove the ugly code from DefaultCaret:

if (c == null) {
    throw new NullPointerException();
} 

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>         Assigned To: Alexey Petrenko
>            Priority: Minor
>         Attachments: H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

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


[jira] Commented: (HARMONY-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

Alexey A. Ivanov commented on HARMONY-2782:
-------------------------------------------

Mark,

This bug is duplicate of HARMONY-1750. And the patches were already applied, that's why the regression test passes.

However I'd like this fix to be applied because it makes code more clear. And NPE is naturally thrown but not with
if (c == null) {
    throw new NullPointerException();
}

which I consider ugly.


The test patches are different in the approach:
* Mine adds a separate test case for this situation,
* Whereas in HARMONY-1750 a new assertion is added into testInstall() method.

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

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


[jira] Updated: (HARMONY-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

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

    Attachment: H2782-swing-messages.patch
                H2782-DefaultCaret-install.patch

H2782-DefaultCaret-install.patch simply removes the unnecessary code which explicitly throws NPE (however it provides some details).

H2782-swing-messages.patch removes the message which was used as parameter to NPE.

These patches became necessary because of HARMONY-1750 being applied.

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>         Assigned To: Alexey Petrenko
>            Priority: Minor
>         Attachments: H2782-DefaultCaret-install.patch, H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch, H2782-swing-messages.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

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


[jira] Closed: (HARMONY-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

Alexey A. Ivanov closed HARMONY-2782.
-------------------------------------


All's great!
Thank you, Alexey.

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>         Assigned To: Alexey Petrenko
>            Priority: Minor
>         Attachments: H2782-DefaultCaret-install.patch, H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch, H2782-swing-messages.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

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


[jira] Assigned: (HARMONY-2782) [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does

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

Alexey Petrenko reassigned HARMONY-2782:
----------------------------------------

    Assignee: Alexey Petrenko

> [classlib][swing] j.s.text.DefaultCaret.install doesn't throw NPE whereas RI does
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-2782
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2782
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>         Assigned To: Alexey Petrenko
>            Priority: Minor
>         Attachments: H2782-DefaultCaretTest.patch, H2782-javax.swing.text.patch, H2782-o.a.h.awt.text.TextCaret.patch
>
>
> javax.swing.text.DefaultCaret.install(null) works silently on Harmony whereas RI throws NullPointerException.
> ======= Code to Reproduce =======
> import javax.swing.text.DefaultCaret;
> public class Test {
>     public static void main(String[] args) {
>         new DefaultCaret().install(null);
>         System.err.println("silent");
>     }
> }
> ======== end of code ======
> ------- Harmony -------
> silent
> ------- end -------
> ------- RI -------
> java.lang.NullPointerException
> 	at javax.swing.text.DefaultCaret.install(DefaultCaret.java:659)
> 	at Test.main(Test.java:5)
> ------- end -------

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