Project: JDT
Bug 63313 String index error creating template
Reported: 2004-05-20 16:25:43 | Status: resolved fixed

I0520 noon build - go to the Java - Editor - Templates preference page - press New... - enter 'j' (no quotes) into the Pattern text entry and will get the following exception !ENTRY org.eclipse.ui 4 4 May 20, 2004 16:10:27.299 !MESSAGE Unhandled event loop exception !ENTRY org.eclipse.ui 4 0 May 20, 2004 16:10:27.299 !MESSAGE String index out of range: -3 !STACK 0 java.lang.StringIndexOutOfBoundsException: String index out of range: -3 at java.lang.String.substring(String.java:1444) at org.eclipse.jdt.internal.ui.preferences.EditTemplateDialog.doSourceChanged (EditTemplateDialog.java:313) at org.eclipse.jdt.internal.ui.preferences.EditTemplateDialog$3.textChanged (EditTemplateDialog.java:382) at org.eclipse.jface.text.TextViewer.updateTextListeners (TextViewer.java:2235) at org.eclipse.jface.text.TextViewer$VisibleDocumentListener.documentChanged (TextViewer.java:301) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2 (AbstractDocument.java:673) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged (AbstractDocument.java:638) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged (AbstractDocument.java:623) at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged (AbstractDocument.java:698) at org.eclipse.jface.text.projection.ProjectionDocument.fireDocumentChanged (ProjectionDocument.java:696) at org.eclipse.jface.text.AbstractDocument.replace (AbstractDocument.java:989) at org.eclipse.jface.text.projection.ProjectionDocument.replace (ProjectionDocument.java:481) at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange (DefaultDocumentAdapter.java:208) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:5565) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6405) at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2535) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:4963) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:4986) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4731) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1724) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1720) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3048) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2951) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3282) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1475) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2380) at org.eclipse.jface.window.Window.runEventLoop(Window.java:668) at org.eclipse.jface.window.Window.open(Window.java:648) at org.eclipse.ui.texteditor.templates.TemplatePreferencePage.add (TemplatePreferencePage.java:557) at org.eclipse.ui.texteditor.templates.TemplatePreferencePage.access$3 (TemplatePreferencePage.java:549) at org.eclipse.ui.texteditor.templates.TemplatePreferencePage$5.handleEvent (TemplatePreferencePage.java:300) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2716) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2382) at org.eclipse.jface.window.Window.runEventLoop(Window.java:668) at org.eclipse.jface.window.Window.open(Window.java:648) at org.eclipse.ui.internal.OpenPreferencesAction.run (OpenPreferencesAction.java:72) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:899) at org.eclipse.jface.action.ActionContributionItem.access$2 (ActionContributionItem.java:850) at org.eclipse.jface.action.ActionContributionItem$7.handleEvent (ActionContributionItem.java:769) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2716) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2382) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:97) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:305) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:256) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:127) 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:184) at org.eclipse.core.launcher.Main.run(Main.java:637) at org.eclipse.core.launcher.Main.main(Main.java:621)

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/EditTemplateDialog.java