2.0.2 and Gutter leads to null pointer exception

Questions on using RSyntaxTextArea should go here.

Moderator: robert

2.0.2 and Gutter leads to null pointer exception

Postby preditcon » Tue Mar 13, 2012 9:02 am

Hi, I just tried to migrate from a probably archaic rsyntaxtextarea release (unsure which but it contained a bug which prevented me from being able to show description windows next to autocomplete popups because of a typo in a package name with icons) to the latest 2.0.2 and am now unable to use org.fife.ui.rtextarea.RTextScrollPane zero argument constructor (setViewportView is called later though this is irrelevant) in order to display the gutter. See the stacktrace for more info.

Code: Select all
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at org.fife.ui.rtextarea.Gutter.setTextArea(Gutter.java:637)
        at org.fife.ui.rtextarea.Gutter.<init>(Gutter.java:107)
        at org.fife.ui.rtextarea.RTextScrollPane.<init>(RTextScrollPane.java:97)
        at org.fife.ui.rtextarea.RTextScrollPane.<init>(RTextScrollPane.java:73)
        at org.fife.ui.rtextarea.RTextScrollPane.<init>(RTextScrollPane.java:47)
        // call to zero argument RTextScrollPane constructor and other obfuscated calls follow


Not sure that this is supposed to happen (and is also easily fixable as far as I can see).

Thumbs up for changing the licensing of your great gui component.
preditcon
 
Posts: 27
Joined: Wed Jan 25, 2012 10:09 am

Re: 2.0.2 and Gutter leads to null pointer exception

Postby robert » Tue Mar 13, 2012 1:19 pm

Sigh, this kind of stuff always happens! At least it sounds like you're still OK creating your RTextScrollPane using the constructor taking a parameter?

Thanks for the bug report, you're right that it should be an easy fix. I should get it into SVN shortly.
User avatar
robert
 
Posts: 798
Joined: Sat May 10, 2008 5:16 pm

Re: 2.0.2 and Gutter leads to null pointer exception

Postby preditcon » Tue Mar 13, 2012 1:39 pm

Actually I went with 2.0.1. I cannot use the other constructor since I'm using Netbeans visual gui builder and stuff needs to be created in a certain order for it to be satisfied. I could bypass all that an not rely on the builder but I am reluctant to do so, especially because it simply works with the previous version.

I haven't tested it with the non-zero argument constructor for that reason but I think it should be okay as long as the argument to it is non-null. You forgot to do a null check in your new code.
preditcon
 
Posts: 27
Joined: Wed Jan 25, 2012 10:09 am

Re: 2.0.2 and Gutter leads to null pointer exception

Postby robert » Sun Mar 18, 2012 10:10 pm

I think I've fixed the NPE, but can't seem to get the NetBeans visual editor to be happy importing RTextScrollPane as a component. Not sure if this is because I'm doing something wrong, or there's still something wrong, since I don't use NetBeans In Real Life (TM). Try it out and let me know if things are better.

And also let me know if there's some sort of NetBeans equivalent to the Eclipse Errors view. When I tried to add RSyntaxTextArea and RTextScrollPane to the Palette Manager, it suddenly displayed nothing, not even the standard components. I don't see an Error View so I can't tell if some sort of exception was thrown.
User avatar
robert
 
Posts: 798
Joined: Sat May 10, 2008 5:16 pm

Re: 2.0.2 and Gutter leads to null pointer exception

Postby Guest » Wed Mar 28, 2012 7:15 am

The only requirement to use a component with Netbeans GUI editor is that you have a compiled class which respresents it on classpath and that it has a zero argument constructor. This has always allowed me to import components into Netbeans so far (with Choose Bean). The actual importing was never an issue for me with RSystaxTextArea.

It there a prebuilt jar available with this fix or do I have to build it from SVN code myself? I'm going test this anyways just to make sure (do note that I'm not using the latest version of NB though, mine is 6.9.1 and the latest should be 7+ I think).
Guest
 

Re: 2.0.2 and Gutter leads to null pointer exception

Postby robert » Thu Mar 29, 2012 12:54 pm

Right now it's SVN only. It may be a couple of weeks before I release another pre-built RSTA jar.
User avatar
robert
 
Posts: 798
Joined: Sat May 10, 2008 5:16 pm

Re: 2.0.2 and Gutter leads to null pointer exception

Postby preditcon » Mon Apr 16, 2012 7:29 am

Sorry for the delay. I built the latest source from SVN with ant and importing RSyntaxTextArea as a bean into Netbeans 6.9.1 works without problems.
preditcon
 
Posts: 27
Joined: Wed Jan 25, 2012 10:09 am

Re: 2.0.2 and Gutter leads to null pointer exception

Postby robert » Mon Apr 16, 2012 9:59 pm

Excellent, thanks for verifying that. I hope to have a 2.0.3 release out soonish that will include this fix.
User avatar
robert
 
Posts: 798
Joined: Sat May 10, 2008 5:16 pm

Re: 2.0.2 and Gutter leads to null pointer exception

Postby CoffeeNerd » Tue Jun 26, 2012 8:50 pm

Hi Robert,

I see that others have found this issue fixed in 2.0.3 but I'm still having trouble with RTextSrollPane generating a NPE, and also a window indicating that "The component cannot be instantiated. Please make sure it is a JavaBeans component", in NetBeans GUI designer using the precompiled 2.0.3 jar or a jar compiled from the 2.0.3 source. I've tested and had the same result in all of Netbeans 7.1.1, 7.1.2 and 7.2 Beta. Is there anything I can do to make this work or is there any chance you're still looking into the issue?

I'm upgrading from 1.5.2. This is an incredibly useful work you've created, thank you very much for your effort!

Here is the stack trace:

Code: Select all
INFO [org.netbeans.modules.form.BeanSupport]: Cannot create default instance of: org.fife.ui.rtextarea.RTextScrollPane
java.lang.NullPointerException
   at org.fife.ui.rtextarea.Gutter.setLineNumberFont(Gutter.java:580)
   at org.fife.ui.rtextarea.RTextScrollPane.<init>(RTextScrollPane.java:98)
   at org.fife.ui.rtextarea.RTextScrollPane.<init>(RTextScrollPane.java:73)
   at org.fife.ui.rtextarea.RTextScrollPane.<init>(RTextScrollPane.java:47)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
   at java.lang.Class.newInstance0(Class.java:372)
   at java.lang.Class.newInstance(Class.java:325)
   at org.netbeans.modules.form.CreationFactory.createDefaultInstance(CreationFactory.java:178)
[catch] at org.netbeans.modules.form.BeanSupport.createBeanInstance(BeanSupport.java:83)
   at org.netbeans.modules.form.BeanSupport.getDefaultInstance(BeanSupport.java:109)
   at org.netbeans.modules.form.GandalfPersistenceManager.restoreComponent(GandalfPersistenceManager.java:718)
   at org.netbeans.modules.form.GandalfPersistenceManager.loadComponent(GandalfPersistenceManager.java:956)
   at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:528)
   at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:312)
   at org.netbeans.modules.form.FormEditor$2.run(FormEditor.java:343)
   at org.netbeans.modules.form.FormLAF$2.run(FormLAF.java:286)
   at org.openide.util.Mutex.doEventAccess(Mutex.java:1363)
   at org.openide.util.Mutex.readAccess(Mutex.java:322)
   at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:269)
   at org.netbeans.modules.form.FormEditor.loadFormData(FormEditor.java:340)
   at org.netbeans.modules.nbform.FormEditorSupport.loadOpeningForm(FormEditorSupport.java:455)
   at org.netbeans.modules.nbform.FormDesignerTC.loadForm(FormDesignerTC.java:274)
   at org.netbeans.modules.nbform.FormDesignerTC.access$300(FormDesignerTC.java:86)
   at org.netbeans.modules.nbform.FormDesignerTC$PreLoadTask$1.run(FormDesignerTC.java:263)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701)
   at java.awt.EventQueue.access$000(EventQueue.java:102)
   at java.awt.EventQueue$3.run(EventQueue.java:662)
   at java.awt.EventQueue$3.run(EventQueue.java:660)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:671)
   at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
CoffeeNerd
 
Posts: 2
Joined: Tue Jun 26, 2012 8:37 pm

Re: 2.0.2 and Gutter leads to null pointer exception

Postby robert » Wed Jun 27, 2012 2:13 am

It seems like no matter how many times I think I fix this, it always stays broken! I just patched the problem indicated by your stack trace; could you check out the latest from SVN and verify that it works for you?
User avatar
robert
 
Posts: 798
Joined: Sat May 10, 2008 5:16 pm

Next

Return to Help

Who is online

Users browsing this forum: No registered users and 5 guests

cron