Exception in PsiViewer, 2.10 build 4 20021123
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
IntelliJ IDEA 3.0 Build #682
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
JDK: 1.4.1_01
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
VM: Java HotSpot(TM) Client VM
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
Vendor: Sun Microsystems Inc.
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
OS: Windows XP
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
Last Action: EditorNextWord
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
Current Command: Move to Next Word
2002-11-25 23:33:47,881 ERROR - mand.impl.CommandProcessorImpl -
java.lang.NullPointerException
at com.intellij.psi.a.b.f.q.a(q.java:391)
at com.intellij.psi.a.b.f.c.a(c.java:6)
at com.intellij.psi.a.b.f.c.a(c.java:56)
at com.intellij.psi.a.b.f.c.a(c.java:24)
at com.intellij.psi.a.b.i.a(i.java:39)
at com.intellij.psi.a.b.i.getChildren(i.java:169)
at
idea.plugin.psiviewer.model.PsiViewerTreeModel.getFilteredChildren(PsiViewer
TreeModel.java:76)
at
idea.plugin.psiviewer.model.PsiViewerTreeModel.getIndexOfChild(PsiViewerTree
Model.java:97)
at javax.swing.tree.VariableHeightLayoutCache.getNodeForPath(Unknown
Source)
at javax.swing.tree.VariableHeightLayoutCache.getRowForPath(Unknown
Source)
at javax.swing.plaf.basic.BasicTreeUI.getRowForPath(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI.updateLeadRow(Unknown Source)
at
javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(Unknown Source)
at
javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(Unknown
Source)
at javax.swing.JTree.fireTreeExpanded(Unknown Source)
at javax.swing.JTree.setExpandedState(Unknown Source)
at javax.swing.JTree.expandPath(Unknown Source)
at javax.swing.JTree.makeVisible(Unknown Source)
at javax.swing.JTree.scrollPathToVisible(Unknown Source)
at
idea.plugin.psiviewer.view.PsiViewerPanel.changeTreeSelection(PsiViewerPanel
.java:237)
at
idea.plugin.psiviewer.view.PsiViewerPanel.setSelectedElement(PsiViewerPanel.
java:214)
at
idea.plugin.psiviewer.view.PsiViewerPanel.selectElementAtCaret(PsiViewerPane
l.java:284)
at
idea.plugin.psiviewer.controller.project.EditorListener.caretPositionChanged
(EditorListener.java:69)
at com.intellij.openapi.editor.c.n.moveToLogicalPosition(n.java:78)
at com.intellij.openapi.editor.c.n.moveToOffset(n.java:21)
at com.intellij.openapi.editor.a.cq.e(cq.java:296)
at com.intellij.openapi.editor.a.fk.execute(fk.java:3)
at
com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.jav
a:2)
at com.intellij.openapi.command.b.b.executeCommand(b.java:19)
at
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
Action.java:10)
at
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
Action.java:11)
at com.intellij.openapi.a.a.e.a(e.java:54)
at com.intellij.openapi.a.a.e.b(e.java:55)
at com.intellij.openapi.a.a.e.a(e.java:29)
at com.intellij.ide.q.dispatchEvent(q.java:11)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Please sign in to leave a comment.
Well as the stack trace indicates it bombs inside a
PsiElement.getChildren(). Since the plugin doesn't change any PsiElement
whatsoever it is rather puzzling. So it would be helpful to know the context
of the NPE (type of element, type of children).
The only explanation I can extract from my old (and sleepy brain) is that
you changed the Psi tree and especially that location before navigating (I
assume the action resulting in the NPE is a NextWord, right?). Is there any
chance the NPE could be caused by invoking getChildren on a stale
PsiElement? As I said in the plugin page, the plugin doesn't listen to
PsiTree changes yet and for now it is recommended to turn off at least
Autoscroll from source while editing. The tree could hold references to
discarded elements. If you get it again try to refresh the view
(Ctrl-Shift-Q) and let me know if it disappears.
Jacques
"Eugene Belyaev" <beg@intellij.com> wrote in message
news:aru8j6$f6g$1@is.intellij.net...
mand.impl.CommandProcessorImpl -
mand.impl.CommandProcessorImpl -
mand.impl.CommandProcessorImpl -
mand.impl.CommandProcessorImpl -
mand.impl.CommandProcessorImpl -
mand.impl.CommandProcessorImpl -
mand.impl.CommandProcessorImpl -
mand.impl.CommandProcessorImpl -
mand.impl.CommandProcessorImpl -
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getFilteredChildren(PsiViewer
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getIndexOfChild(PsiViewerTree
javax.swing.tree.VariableHeightLayoutCache.getNodeForPath(Unknown
javax.swing.tree.VariableHeightLayoutCache.getRowForPath(Unknown
Source)
Source)
Source)
>
javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(Unknown
>
idea.plugin.psiviewer.view.PsiViewerPanel.changeTreeSelection(PsiViewerPanel
>
idea.plugin.psiviewer.view.PsiViewerPanel.setSelectedElement(PsiViewerPanel.
>
idea.plugin.psiviewer.view.PsiViewerPanel.selectElementAtCaret(PsiViewerPane
>
idea.plugin.psiviewer.controller.project.EditorListener.caretPositionChanged
com.intellij.openapi.editor.c.n.moveToLogicalPosition(n.java:78)
>
com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.jav
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
>
>
I know I had some incorrect code I just typed and the sync from text was on
in PsiViewer.
Eugene
"Jacques Morel" <jacmorel@yahoo.com> wrote in message
news:arv5b0$mpr$1@is.intellij.net...
context
any
>
>
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getFilteredChildren(PsiViewer
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getIndexOfChild(PsiViewerTree
>
javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(Unknown
>
idea.plugin.psiviewer.view.PsiViewerPanel.changeTreeSelection(PsiViewerPanel
>
idea.plugin.psiviewer.view.PsiViewerPanel.setSelectedElement(PsiViewerPanel.
>
idea.plugin.psiviewer.view.PsiViewerPanel.selectElementAtCaret(PsiViewerPane
>
idea.plugin.psiviewer.controller.project.EditorListener.caretPositionChanged
>
com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.jav
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
>
Whaoo I am flaggergasted! incorrect code written by a JetBrains people,
Eugene Belyaev no less! I thought you guys only coded correct code from the
start, that incorrect code was for us, poor ungifted souls, that have to
write test first or slave our way through the debugger...
;)
"Eugene Belyaev" <beg@intellij.com> wrote in message
news:arvs4a$qu6$1@is.intellij.net...
on
>
>
>
that
(I
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getFilteredChildren(PsiViewer
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getIndexOfChild(PsiViewerTree
>
javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(Unknown
>
idea.plugin.psiviewer.view.PsiViewerPanel.changeTreeSelection(PsiViewerPanel
>
idea.plugin.psiviewer.view.PsiViewerPanel.setSelectedElement(PsiViewerPanel.
>
idea.plugin.psiviewer.view.PsiViewerPanel.selectElementAtCaret(PsiViewerPane
>
idea.plugin.psiviewer.controller.project.EditorListener.caretPositionChanged
>
com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.jav
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
>
>
Well, you know you can use a variable before it has been declared and then
use an intention action to create it. Until then the code is broken, the
variable is red :)
Eugene
"Jacques Morel" <jacmorel@yahoo.com> wrote in message
news:arvtic$us3$1@is.intellij.net...
the
>
>
PsiElement
navigating
there
to
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getFilteredChildren(PsiViewer
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getIndexOfChild(PsiViewerTree
>
javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(Unknown
>
idea.plugin.psiviewer.view.PsiViewerPanel.changeTreeSelection(PsiViewerPanel
>
idea.plugin.psiviewer.view.PsiViewerPanel.setSelectedElement(PsiViewerPanel.
>
idea.plugin.psiviewer.view.PsiViewerPanel.selectElementAtCaret(PsiViewerPane
>
idea.plugin.psiviewer.controller.project.EditorListener.caretPositionChanged
>
com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.jav
com.intellij.openapi.command.b.b.executeCommand(b.java:19)
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
>
>
I investigated the stack trace and it indicates that you invoked
PsiElement.getChildren() for non-valid element (PsiElement.isValid() returns
false).
Note that only isValid(), equals(), hashCode(), putUserData() and
getUserData() methods are allowed to be called on an invalid PsiElement.
Invocation of any other method for such element may produce unspecified
results (in this particular case, exception somewhere inside PSI
implementation).
There is no explicit assertion with clear indication of the problem due to
performance problems (asserting PsiElement.isValid() in each getChildren()
and similar calls would be too cost).
Invalid PSI elements may appear due to modification of PSI structure, in
particular, on editing of the Document and further commiting changes to PSI.
I don't know the semanics of your code (and, in particular, how do you fetch
PsiElement in the line of code causing the incorrect call) so you have to
investigate it further. If you need any assitance, please ask.
--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"
"Jacques Morel" <jacmorel@yahoo.com> wrote in message
news:arv5b0$mpr$1@is.intellij.net...
context
any
>
>
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getFilteredChildren(PsiViewer
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getIndexOfChild(PsiViewerTree
>
javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(Unknown
>
idea.plugin.psiviewer.view.PsiViewerPanel.changeTreeSelection(PsiViewerPanel
>
idea.plugin.psiviewer.view.PsiViewerPanel.setSelectedElement(PsiViewerPanel.
>
idea.plugin.psiviewer.view.PsiViewerPanel.selectElementAtCaret(PsiViewerPane
>
idea.plugin.psiviewer.controller.project.EditorListener.caretPositionChanged
>
com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.jav
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
>
Thanks Valentin, it confirms the diagnostic I gave to Eugene in this
thread. Right now the plugin doesn't listen to the tree changes, so the tree
will become stale when you modify the document and subsquent navigation in
the tree will cause errors.
To workaround just switch off the AutoScroll from Source.
I am working on the test plugin right now but if this is a real problem I
will fix it right now.
Let me know
Jacques
"Valentin Kipiatkov" <valentin@intellij.com> wrote in message
news:as4ugf$tis$1@is.intellij.net...
returns
PSI.
fetch
>
>
that
(I
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getFilteredChildren(PsiViewer
>
idea.plugin.psiviewer.model.PsiViewerTreeModel.getIndexOfChild(PsiViewerTree
>
javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(Unknown
>
idea.plugin.psiviewer.view.PsiViewerPanel.changeTreeSelection(PsiViewerPanel
>
idea.plugin.psiviewer.view.PsiViewerPanel.setSelectedElement(PsiViewerPanel.
>
idea.plugin.psiviewer.view.PsiViewerPanel.selectElementAtCaret(PsiViewerPane
>
idea.plugin.psiviewer.controller.project.EditorListener.caretPositionChanged
>
com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.jav
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
>
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
>
>