Bug 10489 - Indention a template results in NPE
Summary: Indention a template results in NPE
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows NT
: P1 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Claude Knaus CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-28 11:24 EST by Martin Möbius CLA
Modified: 2002-03-08 09:54 EST (History)
0 users

See Also:


Attachments
____ (42.08 KB, image/jpeg)
2002-03-08 06:29 EST, Martin Möbius CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Möbius CLA 2002-02-28 11:24:19 EST
Below super in construtor type swi'ctr+space' and choose switch from the 
templates. Select the whole statment to ident it to left. Shift+space. An NPE 
occurs. 
Seems that the insertion of a template is different from normal typing or 
pasting code.

public class IndentTest {

	public IndentTest() {
		super();

	}

	public void test() {
		return;
	}

}

java.lang.NullPointerException
	at 
org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager.documentAboutToBeCha
nged(LinkedPositionManager.java:317)
	at org.eclipse.jface.text.AbstractDocument.fireDocumentAboutToBeChanged
(AbstractDocument.java:444)
	at org.eclipse.jface.text.AbstractDocument.replace
(AbstractDocument.java:772)
	at org.eclipse.jface.text.TextViewer.shiftLeft(TextViewer.java:2230)
	at org.eclipse.jface.text.TextViewer.shift(TextViewer.java:2128)
	at org.eclipse.jface.text.TextViewer.doOperation(TextViewer.java:1939)
	at org.eclipse.jface.text.source.SourceViewer.doOperation
(SourceViewer.java:398)
	at org.eclipse.ui.texteditor.TextOperationAction.run
(TextOperationAction.java:61)
	at 
org.eclipse.ui.texteditor.AbstractTextEditor$ActivationCodeTrigger.verifyKey
(AbstractTextEditor.java:299)
	at org.eclipse.swt.custom.StyledTextListener.handleEvent
(StyledTextListener.java:49)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:74)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637)
	at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5050)
	at org.eclipse.swt.custom.StyledText$8.handleEvent(StyledText.java:4812)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:74)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1413)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1205)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:788)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:771)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:777)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:502)
	at org.eclipse.core.launcher.Main.main(Main.java:362)
Comment 1 Claude Knaus CLA 2002-03-08 04:40:19 EST
Martin,

What build did this occur on? I don't see anything which could produce an NPE 
on line 317 of that file. I couldn't reproduce the bug either.
Comment 2 Martin Möbius CLA 2002-03-08 06:27:28 EST
Ah, forgot the version again, build 20021402.
As i can reproduce it without any problems here may steps again.

package test;
public class IndentTest {

	public IndentTest() {
		swi*
	}
}
*
ctrl+space, choose switch, now don't do anything else, just select the whole 
switch statement.
Now shift+tab(space was wrong) or in the context menu Shift left. The npe 
occurs. Perhaps a screenshot helps, attaching later.
Comment 3 Martin Möbius CLA 2002-03-08 06:29:01 EST
Created attachment 446 [details]
____
Comment 4 Claude Knaus CLA 2002-03-08 08:57:55 EST
ok, I managed to reproduce it.
Comment 5 Claude Knaus CLA 2002-03-08 09:54:15 EST
fixed. will be likely in I-20020312