Bug 43146 [misc] Assertion failed in LinkedPositionManager.getPositions when using surrounding with try-catch
OSX 10.2.6 Eclipse I20030916 Doing a surround with try catch: !ENTRY org.eclipse.jdt.ui 4 10004 Sep 16, 2003 15:13:55.722 !MESSAGE Unrecoverable error occurred while performing the refactoring. !STACK 0 ChangeAbortException: org.eclipse.jdt.internal.corext.refactoring.base.ChangeAbortException at org.eclipse.jdt.internal.ui.refactoring.changes.AbortChangeExceptionHandler.handle(AbortChangeExcept ionHandler.java:28) at org.eclipse.jdt.internal.corext.refactoring.base.Change.handleException(Change.java:108) at org.eclipse.jdt.internal.corext.refactoring.changes.AbstractTextChange.perform(AbstractTextChange.jav a:201) at org.eclipse.jdt.internal.corext.refactoring.changes.TextFileChange.perform(TextFileChange.java:208) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation$1.run(PerformChangeOperation.java:173 ) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:34) at org.eclipse.jdt.internal.core.JavaModelOperation.execute(JavaModelOperation.java:366) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:705) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1571) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1588) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:2963) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.executeChange(PerformChangeOperation .java:183) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:151) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.internalRun(BusyIndicatorRu nnableContext.java:113) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.run(BusyIndicatorRunnableC ontext.java:80) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext.run(BusyIndicatorRunnableContext.java:126 ) at org.eclipse.jdt.ui.actions.SurroundWithTryCatchAction.run(SurroundWithTryCatchAction.java:127) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:196) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:172) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:529) at org.eclipse.jface.action.ActionContributionItem.access$4(ActionContributionItem.java:482) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:454) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1027) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2180) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1878) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2037) at org.eclipse.ui.internal.Workbench.run(Workbench.java:2020) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) 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:295) at org.eclipse.core.launcher.Main.run(Main.java:751) at org.eclipse.core.launcher.Main.main(Main.java:587) Exception wrapped by ChangeAbortException: org.eclipse.jface.text.Assert$AssertionFailedException: Assertion failed: at org.eclipse.jface.text.Assert.isTrue(Assert.java:175) at org.eclipse.jface.text.Assert.isTrue(Assert.java:160) at org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager.getPositions(LinkedPositionManager.java:427) at org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager.documentAboutToBeChanged(LinkedPosition Manager.java:477) at org.eclipse.jface.text.AbstractDocument.fireDocumentAboutToBeChanged(AbstractDocument.java:549) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:956) at org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument.replace(PartiallySynchronizedDocum ent.java:61) at org.eclipse.jdt.internal.corext.textmanipulation.TextEdit.performReplace(TextEdit.java:401) at org.eclipse.jdt.internal.corext.textmanipulation.SimpleTextEdit.perform(SimpleTextEdit.java:80) at org.eclipse.jdt.internal.corext.textmanipulation.EditProcessor.execute(EditProcessor.java:183) at org.eclipse.jdt.internal.corext.textmanipulation.EditProcessor.execute(EditProcessor.java:178) at org.eclipse.jdt.internal.corext.textmanipulation.EditProcessor.execute(EditProcessor.java:178) at org.eclipse.jdt.internal.corext.textmanipulation.EditProcessor.execute(EditProcessor.java:178) at org.eclipse.jdt.internal.corext.textmanipulation.EditProcessor.executeDo(EditProcessor.java:163) at org.eclipse.jdt.internal.corext.textmanipulation.EditProcessor.performEdits(EditProcessor.java:121) at org.eclipse.jdt.internal.corext.textmanipulation.TextBufferEditor.performEdits(TextBufferEditor.java:55) at org.eclipse.jdt.internal.corext.refactoring.changes.AbstractTextChange.perform(AbstractTextChange.jav a:199) at org.eclipse.jdt.internal.corext.refactoring.changes.TextFileChange.perform(TextFileChange.java:208) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation$1.run(PerformChangeOperation.java:173 ) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:34) at org.eclipse.jdt.internal.core.JavaModelOperation.execute(JavaModelOperation.java:366) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:705) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1571) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1588) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:2963) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.executeChange(PerformChangeOperation .java:183) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:151) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.internalRun(BusyIndicatorRu nnableContext.java:113) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.run(BusyIndicatorRunnableC ontext.java:80) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext.run(BusyIndicatorRunnableContext.java:126 ) at org.eclipse.jdt.ui.actions.SurroundWithTryCatchAction.run(SurroundWithTryCatchAction.java:127) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:196) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:172) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:529) at org.eclipse.jface.action.ActionContributionItem.access$4(ActionContributionItem.java:482) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:454) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1027) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2180) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1878) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2037) at org.eclipse.ui.internal.Workbench.run(Workbench.java:2020) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) 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:295) at org.eclipse.core.launcher.Main.run(Main.java:751) at org.eclipse.core.launcher.Main.main(Main.java:587)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/link/LinkedPositionManager.java
}		
			
			fDocument.removePositionCategory(fPositionCategoryName);
		} catch (BadLocationException e) {
			JavaPlugin.log(e);
			Assert.isTrue(false);
		} catch (BadPositionCategoryException e) {
			JavaPlugin.log(e);
			Assert.isTrue(false);
		} finally {
			fDocument.removePositionUpdater(this);		
			fgActiveManagers.remove(fDocument);		
		}
	}
	/**
	 * Returns the position at the given offset, <code>null</code> if there is no position.
	 * @since 2.1
	 */
	public Position getPosition(int offset) {
		Position[] positions= getPositions(fDocument);		
		if (positions == null)
			return null;
		for (int i= positions.length - 1; i >= 0; i--) {
			Position position= positions[i];
			if (offset >= position.getOffset() && offset <= position.getOffset() + position.getLength())
				return positions[i];
		}
		
		return null;
	}