You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Anton Luht (JIRA)" <ji...@apache.org> on 2006/12/12 17:51:22 UTC

[jira] Commented: (HARMONY-2613) [classlib][swing][plaf] javax.swing.plaf.basic.BasicTableUI methods throw unspecified NPE if UI is not attached to a table

    [ http://issues.apache.org/jira/browse/HARMONY-2613?page=comments#action_12457791 ] 
            
Anton Luht commented on HARMONY-2613:
-------------------------------------

similar problem with BasicTableHeaderUI:

import javax.swing.plaf.basic.*;
import javax.swing.table.*;

class lBasicTableHeaderUI extends BasicTableHeaderUI {
    public lBasicTableHeaderUI() {
            super();
    }
    public void uninstallDefaults() {
            super.uninstallDefaults();
    }
}

public class Test  
{
        public static void main(String args[]) {
                lBasicTableHeaderUI localBasicTableHeaderUI = new
lBasicTableHeaderUI();
                 //localBasicTableHeaderUI.installUI(new JTableHeader()); 
                try {
                        localBasicTableHeaderUI.uninstallDefaults();
                        System.out.println("uninstallDefaults work silenly");
                } catch (NullPointerException e) {
                        e.printStackTrace();
                        System.out.println("Got NullPointerException");
                }
        }
}



> [classlib][swing][plaf] javax.swing.plaf.basic.BasicTableUI methods throw unspecified NPE if UI is not attached to a table
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2613
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2613
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Luht
>            Priority: Minor
>
> If BasicTableUI  is not attached to a JTable (for example, using installUI), calling some methods on it cause NPE. Please see the code below for example, but the code inspection shows that there are many methods that can cause similar effect (direct calling methods of member 'table' without checking it for null) . If you uncomment line with 'installUI', the test will work on Harmony as well as on RI
> Code to reproduce:
> import javax.swing.plaf.basic.*;
> import javax.swing.*;
> import java.awt.*;
> import java.awt.event.MouseWheelEvent;
> public class Test   
> {
>         public static MouseWheelEvent getEvent() {
>                 Label l = new Label();
>                 return new MouseWheelEvent(l, 0, 0, 0, 0, 0, 0, false, 0,
> MouseWheelEvent.WHEEL_UNIT_SCROLL, 0);
>         }
>         public static void main(String args[]) {
>                 BasicTableUI localBasicTableUI = new BasicTableUI();
>                 //localBasicTableUI.installUI(new JTable());
>                 BasicTableUI.MouseInputHandler
> localBasicTableUI$MouseInputHandler = localBasicTableUI.new
> MouseInputHandler();
>                 MouseWheelEvent localMouseWheelEvent = getEvent();
>                 try {
>                        
> localBasicTableUI$MouseInputHandler.mousePressed(localMouseWheelEvent);
>                         System.out.println("mousePressed work silently");
>                 } catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got NullPointerException");
>                 }
>         }
> }
> output in RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> mousePressed work silently
> Output in Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundatio
> n or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r485537, (Dec 11 2006), Windows/ia32/msvc 1310, debug build
> http://incubator.apache.org/harmony
> java.lang.NullPointerException
>         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mousePressed(Ba
> sicTableUI.java:122)
>         at Test.main(Test.java:20)
> Got NullPointerException

-- 
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