JDK-5023525 : Regression: IntelliJ IDEA 4.0 throws NPE when run on 1.5
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-03-30
  • Updated: 2004-04-24
  • Resolved: 2004-04-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
5.0 beta2Fixed
Related Reports
Relates :  
Description
We've tried to run IntelliJ IDEA 4 on 1.5-b45, and found that the
following exception is thrown whenever any button in the gui is
clicked, so the ide is, unfortunately, unusable.

A quick investigation revealed that the exception first appeared
in tiger b24.

The exception:
java.lang.NullPointerException
        at com.intellij.openapi.editor.c.m.C(m.java:600)
        at com.intellij.openapi.editor.c.m.J(m.java:568)
        at com.intellij.openapi.editor.c.ba.getPreferredSize(ba.java:59)
        at javax.swing.JViewport.getViewSize(JViewport.java:988)
        at javax.swing.plaf.basic.BasicScrollPaneUI.syncScrollPaneWithViewport(BasicScrollPaneUI.java:264)
        at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.viewportStateChanged(BasicScrollPaneUI.java:855)
        at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(BasicScrollPaneUI.java:797)
        at javax.swing.JViewport.fireStateChanged(JViewport.java:1342)
        at javax.swing.JViewport.setView(JViewport.java:965)
        at javax.swing.JScrollPane.setViewportView(JScrollPane.java:993)
        at com.intellij.openapi.editor.c.m.y(m.java:1325)
        at com.intellij.openapi.editor.c.m.<init>(m.java:987)
        at com.intellij.openapi.editor.c.d.a(d.java)
        at com.intellij.openapi.editor.c.d.createEditor(d.java:20)
        at com.intellij.openapi.fileEditor.b.a.d.g(d.java:28)
        at com.intellij.openapi.fileEditor.b.a.d.<init>(d.java:47)
        at com.intellij.openapi.fileEditor.b.a.a.<init>(a.java:53)
        at com.intellij.openapi.fileEditor.b.a.b.createEditor(b.java:43)
        at com.intellij.openapi.fileEditor.b.f.b(f.java:544)
        at com.intellij.openapi.fileEditor.b.f.access$900(f.java:10)
        at com.intellij.openapi.fileEditor.b.f$3.run(f$3.java:1)
        at com.intellij.openapi.command.impl.a.executeCommand(a.java:75)
        at com.intellij.openapi.fileEditor.b.f.a(f.java:309)
        at com.intellij.openapi.fileEditor.b.f.openFile(f.java:300)
        at com.intellij.openapi.fileEditor.b.f$1.run(f$1.java:8)
        at com.intellij.openapi.command.impl.a.executeCommand(a.java:58)
        at com.intellij.openapi.fileEditor.b.f.openTextEditor(f.java:525)
        at com.intellij.ide.util.EditorHelper.openFileAskingType(EditorHelper.java:11)
        at com.intellij.util.EditSourceOnDoubleClickHandler$1.mouseClicked(EditSourceOnDoubleClickHandler.java:5)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:211)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:211)
        at java.awt.Component.processMouseEvent(Component.java:5421)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:2920)
        at java.awt.Component.processEvent(Component.java:5215)
        at java.awt.Container.processEvent(Container.java:1904)
        at java.awt.Component.dispatchEventImpl(Component.java:3919)
        at java.awt.Container.dispatchEventImpl(Container.java:1962)
        at java.awt.Component.dispatchEvent(Component.java:3770)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3921)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3645)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3566)
        at java.awt.Container.dispatchEventImpl(Container.java:1948)
        at java.awt.Window.dispatchEventImpl(Window.java:1729)
        at java.awt.Component.dispatchEvent(Component.java:3770)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
        at com.intellij.ide.q.b(q.java:86)
        at com.intellij.ide.q.a(q.java:132)
        at com.intellij.ide.q.dispatchEvent(q.java:61)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:214)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
[  18637]  ERROR - mand.impl.CommandProcessorImpl -
[  18637]  ERROR - mand.impl.CommandProcessorImpl - IntelliJ IDEA 4.0  Build #1178
[  18637]  ERROR - mand.impl.CommandProcessorImpl - JDK: 2d-jcg-linux-02-2003-09-02.tiger
[  18638]  ERROR - mand.impl.CommandProcessorImpl - VM: Java HotSpot(TM) Client VM
[  18639]  ERROR - mand.impl.CommandProcessorImpl - Vendor: Sun Microsystems Inc.
[  18639]  ERROR - mand.impl.CommandProcessorImpl - OS: Linux
[  18639]  ERROR - mand.impl.CommandProcessorImpl - Last Action:
[  18639]  ERROR - mand.impl.CommandProcessorImpl - Current Command:
[  18641]  ERROR - mand.impl.CommandProcessorImpl -
java.lang.NullPointerException
        at com.intellij.openapi.editor.c.m.C(m.java:600)
        at com.intellij.openapi.editor.c.m.J(m.java:568)
        at com.intellij.openapi.editor.c.ba.getPreferredSize(ba.java:59)
        at javax.swing.JViewport.getViewSize(JViewport.java:988)
        at javax.swing.plaf.basic.BasicScrollPaneUI.syncScrollPaneWithViewport(BasicScrollPaneUI.java:264)
        at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.viewportStateChanged(BasicScrollPaneUI.java:855)
        at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(BasicScrollPaneUI.java:797)
        at javax.swing.JViewport.fireStateChanged(JViewport.java:1342)
        at javax.swing.JViewport.setView(JViewport.java:965)
        at javax.swing.JScrollPane.setViewportView(JScrollPane.java:993)
        at com.intellij.openapi.editor.c.m.y(m.java:1325)
        at com.intellij.openapi.editor.c.m.<init>(m.java:987)
        at com.intellij.openapi.editor.c.d.a(d.java)
        at com.intellij.openapi.editor.c.d.createEditor(d.java:20)
        at com.intellij.openapi.fileEditor.b.a.d.g(d.java:28)
        at com.intellij.openapi.fileEditor.b.a.d.<init>(d.java:47)
        at com.intellij.openapi.fileEditor.b.a.a.<init>(a.java:53)
        at com.intellij.openapi.fileEditor.b.a.b.createEditor(b.java:43)
        at com.intellij.openapi.fileEditor.b.f.b(f.java:544)
        at com.intellij.openapi.fileEditor.b.f.access$900(f.java:10)
        at com.intellij.openapi.fileEditor.b.f$3.run(f$3.java:1)
        at com.intellij.openapi.command.impl.a.executeCommand(a.java:75)
        at com.intellij.openapi.fileEditor.b.f.a(f.java:309)
        at com.intellij.openapi.fileEditor.b.f.openFile(f.java:300)
        at com.intellij.openapi.fileEditor.b.f$1.run(f$1.java:8)
        at com.intellij.openapi.command.impl.a.executeCommand(a.java:58)
        at com.intellij.openapi.fileEditor.b.f.openTextEditor(f.java:525)
        at com.intellij.ide.util.EditorHelper.openFileAskingType(EditorHelper.java:11)
        at com.intellij.util.EditSourceOnDoubleClickHandler$1.mouseClicked(EditSourceOnDoubleClickHandler.java:5)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:211)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:211)
        at java.awt.Component.processMouseEvent(Component.java:5421)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:2920)
        at java.awt.Component.processEvent(Component.java:5215)
        at java.awt.Container.processEvent(Container.java:1904)
        at java.awt.Component.dispatchEventImpl(Component.java:3919)
        at java.awt.Container.dispatchEventImpl(Container.java:1962)
        at java.awt.Component.dispatchEvent(Component.java:3770)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3921)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3645)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3566)
        at java.awt.Container.dispatchEventImpl(Container.java:1948)
        at java.awt.Window.dispatchEventImpl(Window.java:1729)
        at java.awt.Component.dispatchEvent(Component.java:3770)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
        at com.intellij.ide.q.b(q.java:86)
        at com.intellij.ide.q.a(q.java:132)
        at com.intellij.ide.q.dispatchEvent(q.java:61)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:214)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
[vvs@surfcity:46] -- << ~ >>
#>


----- End forwarded message -----



Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-beta2
2004-08-24

EVALUATION Name: apR10133 Date: 04/01/2004 This problem really appeared due to the fix for 4546474. The problem was that scrollbar's size was out of syncronization with the view size in case we had replaced the view. The fix just made the JViewport.setView fire the state changed event to sync the sizes. The JViewport.getViewSize checks if the view is not null and then return either view size (if one has already been set) or preferred size. The stack trace below shows the NPE is thrown as a result of getPreferredSize call at some moment. java.lang.NullPointerException at com.intellij.openapi.editor.c.m.C(m.java:600) at com.intellij.openapi.editor.c.m.J(m.java:568) at com.intellij.openapi.editor.c.ba.getPreferredSize(ba.java:59) at javax.swing.JViewport.getViewSize(JViewport.java:988) But getPreferredSize() shouldn't throw the NPE whenever we call it. I don't think this is a Swing bug, but it is IDEA's one. ###@###.### ======================================================================
2004-08-24