Arnauld/jbehave-eclipse-plugin — Issue #32: java.lang.NullPointerException with Meta
Author: dschneller
Created: 2012-02-06 07:37:19+00:00
State: open

If a story file begins with the following lines:

Scenario: Something something

Meta:

Then hitting Return after the `Meta:` line will throw an exception for every subsequent keypress. See stack trace 1 below.

Once that has happened, deleting the meta section and typing e. g. `Given` at the beginning of a line will cause more exceptions. Some editor state seems to get corrupted, because after that, there is no way to recover the editor, except closing it and reopening.

Probably related: A file with the following contents will cause the editor to not open, but display an error

Unable to create editor ID org.technbolts.jbehave.eclipse.editors.story.StoryEditor: An unexpected exception was thrown.

File contents:

Scenario: blablabla

Meta:
@dev true

!-- Comment
Given die Ausgangslage

See stacktrace 2 for that.

Stacktrace 1
------
org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
at org.eclipse.jface.text.Position.setLength(Position.java:185)
at org.eclipse.jface.text.rules.FastPartitioner.computePartitioning(FastPartitioner.java:634)
at org.eclipse.jface.text.AbstractDocument.computePartitioning(AbstractDocument.java:1430)
at org.eclipse.jface.text.TextUtilities.computePartitioning(TextUtilities.java:431)
at org.eclipse.jface.text.presentation.PresentationReconciler.createPresentation(PresentationReconciler.java:448)
at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:566)
at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:564)
at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(PresentationReconciler.java:225)
at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2824)
at org.eclipse.jface.text.TextViewer$VisibleDocumentListener.documentChanged(TextViewer.java:403)
at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:769)
at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:736)
at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:721)
at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:796)
at org.technbolts.jbehave.eclipse.editors.story.StoryDocument.fireDocumentChanged(StoryDocument.java:17)
at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1191)
at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1210)
at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:248)
at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7180)
at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7994)
at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456)
at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5911)
at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5941)

Stacktrace 2
------------
java.lang.NullPointerException
at org.technbolts.jbehave.eclipse.editors.story.scanner.AbstractStoryPartBasedScanner.emit(AbstractStoryPartBasedScanner.java:175)
at org.technbolts.jbehave.eclipse.editors.story.scanner.AbstractStoryPartBasedScanner$5.token(AbstractStoryPartBasedScanner.java:223)
at org.technbolts.jbehave.parser.Constants.tokenize(Constants.java:52)
at org.technbolts.jbehave.parser.Constants.splitLine(Constants.java:42)
at org.technbolts.jbehave.eclipse.editors.story.scanner.AbstractStoryPartBasedScanner.emitCommentAware(AbstractStoryPartBasedScanner.java:219)
at org.technbolts.jbehave.eclipse.editors.story.scanner.MiscScanner.emitPart(MiscScanner.java:67)
at org.technbolts.jbehave.eclipse.editors.story.scanner.AbstractStoryPartBasedScanner$2.visit(AbstractStoryPartBasedScanner.java:131)
at org.technbolts.jbehave.eclipse.editors.story.StoryDocument.traverseStoryParts(StoryDocument.java:33)
at org.technbolts.jbehave.eclipse.util.StoryPartDocumentUtils.traverseStoryParts(StoryPartDocumentUtils.java:25)
at org.technbolts.jbehave.eclipse.editors.story.scanner.AbstractStoryPartBasedScanner.evaluateFragments(AbstractStoryPartBasedScanner.java:134)
at org.technbolts.jbehave.eclipse.editors.story.scanner.AbstractStoryPartBasedScanner.nextToken(AbstractStoryPartBasedScanner.java:118)
at org.eclipse.jface.text.rules.DefaultDamagerRepairer.createPresentation(DefaultDamagerRepairer.java:175)
at org.eclipse.jface.text.presentation.PresentationReconciler.createPresentation(PresentationReconciler.java:453)
at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:566)
at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:564)
at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.inputDocumentChanged(PresentationReconciler.java:119)
at org.eclipse.jface.text.TextViewer.fireInputDocumentChanged(TextViewer.java:2888)
at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2937)
at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:640)
at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:588)
at org.eclipse.ui.texteditor.AbstractTextEditor.initializeSourceViewer(AbstractTextEditor.java:4030)
at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3558)
at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:54)
at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:440)
at org.technbolts.jbehave.eclipse.editors.story.StoryEditor.createPartControl(StoryEditor.java:109)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)