kamalchopra / jsyntaxpane

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

NPE on LineNumbersRuler #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Launch JSyntaxPaneTest
2. set content type "text/c"
3. press ENTER

What is the expected output? What do you see instead?
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at jsyntaxpane.components.LineNumbersRuler.updateSize(LineNumbersRuler.java:98)

Proposed patch:
Container parent = getParent();
if(parent!=null)
{
        parent.doLayout();
}

Original issue reported on code.google.com by fcolasuo...@gmail.com on 9 Jan 2009 at 5:04

GoogleCodeExporter commented 9 years ago

Original comment by ayman.al...@gmail.com on 11 Jan 2009 at 5:10

GoogleCodeExporter commented 9 years ago
This uncovers a design flaw that I'm currently working on.  
The above patch hides the symptom, but the actual problem is that when the
contentType is changed, we end up with TWO LineNumberRuler instances (one for 
old and
one for new document).  Both get the Document events, but the old one does not 
have a
parent.  We should not have two instances.

Original comment by ayman.al...@gmail.com on 11 Jan 2009 at 7:04

GoogleCodeExporter commented 9 years ago
Fixed in r68.

Original comment by ayman.al...@gmail.com on 11 Jan 2009 at 9:11