Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2662 [4.3] NPE when loading caret infos

open
nobody
5
2009-12-29
2006-09-13
No

Hi, I opened a file and got this exception

It seems that one Selection in the Selection[] array is
null but I cannot understand how it is possible, if
anyone has an idea ...

[error] WorkThread: Exception in AWT thread:
[error] WorkThread: java.lang.NullPointerException
[error] WorkThread: at
org.gjt.sp.jedit.EditPane.loadCaretInfo(EditPane.java:367)
[error] WorkThread: at
org.gjt.sp.jedit.EditPane$2.run(EditPane.java:164)
[error] WorkThread: at
org.gjt.sp.util.WorkThreadPool.doAWTRequest(WorkThreadPool.java:392)
[error] WorkThread: at
org.gjt.sp.util.WorkThreadPool.doAWTRequests(WorkThreadPool.java:380)
[error] WorkThread: at
org.gjt.sp.util.WorkThreadPool.access$200(WorkThreadPool.java:37)
[error] WorkThread: at
org.gjt.sp.util.WorkThreadPool$RunRequestsInAWTThread.run(WorkThreadPool.java:477)
[error] WorkThread: at
java.awt.event.InvocationEvent.dispatch(Unknown Source)
[error] WorkThread: at
java.awt.EventQueue.dispatchEvent(Unknown Source)
[error] WorkThread: at
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)
[error] WorkThread: at
java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
Source)
[error] WorkThread: at
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
[error] WorkThread: at
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
[error] WorkThread: at
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
[error] WorkThread: at
java.awt.EventDispatchThread.run(Unknown Source)

Discussion

1 2 > >> (Page 1 of 2)
    • status: open --> closed-works-for-me
     
  • Logged In: YES
    user_id=285591
    Originator: YES

    It never happened again

     
  • Oh it happened again when I opened a file, still no hint about it, on 4.3 final

    java.lang.NullPointerException
    at org.gjt.sp.jedit.EditPane.loadCaretInfo(EditPane.java:416)
    at org.gjt.sp.jedit.EditPane$2.run(EditPane.java:216)
    at org.gjt.sp.util.WorkThreadPool.doAWTRequest(WorkThreadPool.java:398)
    at org.gjt.sp.util.WorkThreadPool.doAWTRequests(WorkThreadPool.java:383)
    at org.gjt.sp.util.WorkThreadPool.access$200(WorkThreadPool.java:37)
    at org.gjt.sp.util.WorkThreadPool$RunRequestsInAWTThread.run(WorkThreadPool.java:483)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    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)

     
    • labels: --> editor core
    • summary: NPE when loading caret infos --> [4.3] NPE when loading caret infos
    • status: closed-works-for-me --> open
     
  • Alan Ezust
    Alan Ezust
    2009-12-29

    I just saw it happen a couple of times today.
    It seems to happen at startup, and it depends on what files/positions it is trying to restore from the perspective, I think.

     
  • Alan Ezust
    Alan Ezust
    2009-12-29

    oops. scratch that. I will post a separate ticket, I had a different stack trace

     
  • This is a threading issue. The NPE is caused by the EditPane's 'buffer' field being null, where a few lines before the one causing the exception the 'buffer' field was used and was not null.
    I will try to find it out, but it has nothing to do with the specific buffer / position.

     
  • Sorry, my mistake. I was looking at the wrong version of the source code.

     
  • Do you know if the file you opened was previously opened in jEdit in the same session?

     
  • I have some crazy idea. The SelectionManager is not a synchronized class, and its correctness relies on the fact that all changes to it are made from the GUI thread. Can there be any background threads that were created by plugins as a response to opening the file and that may change the selection? Then, possibly between the time the local selection array is created and the time it is filled, one of the selections may become null.

     
1 2 > >> (Page 1 of 2)