kamalchopra / jsyntaxpane

Automatically exported from code.google.com/p/jsyntaxpane
0 stars 0 forks source link

Compatibility error with org.jdesktop.swingx.JXErrorPane #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. install syntaxKit
2. execute JXErrorPane

What is the expected output? What do you see instead?
expected JXErrorPane dialog with error. I got exception instead

What version of the product are you using? On what operating system?
jsyntaxpane-0.9.5-b29.jar

Please provide any additional information below.
31.03.2010 17:36:16 jsyntaxpane.components.LineNumbersRuler install
WARNING: JEditorPane is not enclosed in JScrollPane, no LineNumbers will 
be displayed
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at jsyntaxpane.components.LineNumbersRuler.updateSize
(LineNumbersRuler.java:106)
    at jsyntaxpane.components.LineNumbersRuler.propertyChange
(LineNumbersRuler.java:185)
    at java.beans.PropertyChangeSupport.firePropertyChange
(PropertyChangeSupport.java:339)
    at java.beans.PropertyChangeSupport.firePropertyChange
(PropertyChangeSupport.java:276)
    at java.awt.Component.firePropertyChange(Component.java:8083)
    at javax.swing.text.JTextComponent.setDocument
(JTextComponent.java:437)
    at javax.swing.JEditorPane.setEditorKit(JEditorPane.java:1098)
    at javax.swing.JEditorPane.setContentType(JEditorPane.java:1021)
    at org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI
$ErrorPaneLayout.layoutContainer(BasicErrorPaneUI.java:1036)
    at java.awt.Container.layout(Container.java:1421)
    at java.awt.Container.doLayout(Container.java:1410)
    at 
org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI.setDetailsVisible
(BasicErrorPaneUI.java:570)
    at org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI.reinit
(BasicErrorPaneUI.java:592)
    at org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI
$ErrorPaneListener.propertyChange(BasicErrorPaneUI.java:954)
    at java.beans.PropertyChangeSupport.firePropertyChange
(PropertyChangeSupport.java:339)
    at java.beans.PropertyChangeSupport.firePropertyChange
(PropertyChangeSupport.java:276)
    at java.awt.Component.firePropertyChange(Component.java:8083)
    at org.jdesktop.swingx.JXErrorPane.setErrorInfo
(JXErrorPane.java:278)
    at org.jdesktop.swingx.JXErrorPane.showDialog(JXErrorPane.java:367)
    at core.gui.iframe.MDIAppFrame.handleException
(MDIAppFrame.java:150)
    at core.gui.actions.ActionToolWindow.doExecute
(ActionToolWindow.java:89)
    at core.gui.actions.ActionToolWindow.access
$100(ActionToolWindow.java:34)
    at core.gui.actions.ActionToolWindow$3.mouseClicked
(ActionToolWindow.java:119)
    at core.gui.util.DblClickMouseListener.mouseClicked
(DblClickMouseListener.java:22)
    at core.gui.util.LeftClickMouseListener.mouseClicked
(LeftClickMouseListener.java:22)
    at java.awt.AWTEventMulticaster.mouseClicked
(AWTEventMulticaster.java:253)
    at java.awt.Component.processMouseEvent(Component.java:6219)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5981)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4583)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4413)
    at java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:4556)
    at java.awt.LightweightDispatcher.processMouseEvent
(Container.java:4229)
    at java.awt.LightweightDispatcher.dispatchEvent
(Container.java:4150)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4413)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters
(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter
(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Original issue reported on code.google.com by Penkov.V...@gmail.com on 31 Mar 2010 at 1:40

GoogleCodeExporter commented 9 years ago
attached patch to get rid of NPE, now it complains: 
31.03.2010 18:03:05 jsyntaxpane.components.LineNumbersRuler install
WARNING: JEditorPane is not enclosed in JScrollPane, no LineNumbers will be 
displayed

every time I open any JEditorPane component.

Original comment by Penkov.V...@gmail.com on 31 Mar 2010 at 2:08

Attachments:

GoogleCodeExporter commented 9 years ago
That was opened before.  You need to create the editor inside a JScrollPane.  
Otherwise 
Line Numbering will not work properly. 
Let me know if you still need help, or you think that patch is needed.

Original comment by ayman.al...@gmail.com on 1 Apr 2010 at 4:53

GoogleCodeExporter commented 9 years ago
I do not want to create any JEditorPanes inside JScrollPane when I use 
JXErrorPane. 
Instead I want to just use JXErrorPane which contains JEditorPane. I guess, 
DefaultSyntaxKit.initKit(); installs JSyntaxPane support globally to any 
JEditopPane, 
even if it doesn't need it. 

Anyway, you still are able to get NPE without this patch (for example you 
forget to 
use JScrollPane, but it is not the reason to produce NPE).

Original comment by Penkov.V...@gmail.com on 1 Apr 2010 at 5:35

GoogleCodeExporter commented 9 years ago
also, you'll get NPE when using forms, designed by Jetbrains IDEA, 'cause it 
generates 
static code

Original comment by Penkov.V...@gmail.com on 1 Apr 2010 at 5:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Please reopen this issue.  The problem can be reproduced in the 0.9.6 branch.

The issue here is that JXErrorPane in SwingX (and, presumably, several other 
third-party UI libraries) uses a JEditorPane that is not contained in a 
JScrollPane.

I suggest two things to fix this issue:
1) Remove the call to DefaultSyntaxKit.initKit() from DefaultSyntaxKit's static 
initializer block.  Changing application behavior as a direct result of loading 
a utility class is the sort of thing you'd expect from malware, not a 
legitimate library.
2) Don't require a JEditorPane to be contained within a JScrollPane.  An 
application developer using a third-party UI library doesn't have control over 
whether or not the library will comply with this requirement.

Original comment by sworisbr...@gmail.com on 18 Nov 2010 at 5:51

GoogleCodeExporter commented 9 years ago
Attached is a patch for the 0.9.6 branch to address point 2 of my previous 
comment.

A suggestion for point 1 of my previous comment: It seems like the motivation 
for registering the syntax kit automatically is to make things easier for 
developers who wish to use jsyntaxpane.  It seems like a better solution than 
globally altering the behavior of JEditorPane would be to provide a subclass of 
JEditorPane with the syntax kit applied to it.  A developer could then use this 
UI component when they want the features provided by jsyntaxpane, without 
affecting the use of JEditorPane in third-party libraries.

Original comment by sworisbr...@gmail.com on 18 Nov 2010 at 6:10

Attachments: