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)
Submitted | kpouer - 2006-09-13 - 14:26:16z | Assigned | nobody |
---|---|---|---|
Priority | 5 | Category | editor core |
Status | Open | Group | None |
Resolution | None | Visibility | No |
2008-02-27 - 21:58:22z kpouer |
Logged In: YES user_id=285591 Originator: YES It never happened again |
---|---|
2009-12-29 - 14:34:45z kpouer |
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) |
2009-12-29 - 19:57:04z ezust |
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. |
2009-12-29 - 19:57:37z ezust |
oops. scratch that. I will post a separate ticket, I had a different stack trace |
2009-12-29 - 20:21:40z shlomy |
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. |
2009-12-29 - 20:56:10z shlomy |
Sorry, my mistake. I was looking at the wrong version of the source code. |
2009-12-29 - 21:20:28z shlomy |
Do you know if the file you opened was previously opened in jEdit in the same session? |
2009-12-30 - 05:14:04z shlomy |
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. |
2009-12-30 - 07:57:44z shlomy |
I think that it doesn't have to be a plugin. Some background tasks initiated by the
core (e.g. Search and Replace in files) can also change the selection, while in the
GUI thread it might try to load the caret info for them. I think that making the selection manager synchronized can solve this issue. I don't know if it will visibly affect performance. |