Bug 77641 Exception in pick out string [quick assist]
M3 test candidate !ENTRY org.eclipse.jdt.ui 4 10001 2004-11-03 15:33:53.254 !MESSAGE Internal Error !STACK 0 java.lang.StringIndexOutOfBoundsException: String index out of range: 18 at java.lang.String.substring(Unknown Source) at org.eclipse.jdt.internal.ui.text.correction.AdvancedQuickAssistProcessor.getPickOutStringProposals(AdvancedQuickAssistProcessor.java:1458) at org.eclipse.jdt.internal.ui.text.correction.AdvancedQuickAssistProcessor.getAssists(AdvancedQuickAssistProcessor.java:100) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectAssists(JavaCorrectionProcessor.java:260) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.processAnnotations(JavaCorrectionProcessor.java:210) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.computeCompletionProposals(JavaCorrectionProcessor.java:177) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1472) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:251) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$7(CompletionProposalPopup.java:247) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$1.run(CompletionProposalPopup.java:206) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:201) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1320) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant.showPossibleCompletions(JavaCorrectionAssistant.java:159) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:186) at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:122) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:120) at org.eclipse.jface.action.Action.runWithEvent(Action.java:988) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:188) at org.eclipse.ui.internal.commands.Command.execute(Command.java:130) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:422) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:696) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:739) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:508) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:456) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:221) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:748) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:799) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:824) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:809) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:837) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:833) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1096) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3077) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2987) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3361) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1502) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2446) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1527) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1498) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:276) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:704) at org.eclipse.core.launcher.Main.main(Main.java:688) Not sure what I did. I tested String s= "Eclipse"; and picked out lip.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/AdvancedQuickAssistProcessor.java
rewrite.replace(ifStatement.getExpression(), outerCondition, null);
				
				String label = CorrectionMessages.getString("AdvancedQuickAssistProcessor.exchangeInnerAndOuterIfConditions.description"); 
				Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_LOCAL);
				ASTRewriteCorrectionProposal proposal = new ASTRewriteCorrectionProposal(label,
						context.getCompilationUnit(), rewrite, 1, image);
				resultingCollections.add(proposal);
				result = true;
			}
		}
		
		{
			IfStatement innerIf = null;
			if (ifStatement.getThenStatement() instanceof IfStatement) {
				innerIf = (IfStatement) ifStatement.getThenStatement();
			} else if (ifStatement.getThenStatement() instanceof Block) {
				Block block = (Block) ifStatement.getThenStatement();
				if ((block.statements().size() == 1) && (block.statements().get(0) instanceof IfStatement)) {
					innerIf = (IfStatement) block.statements().get(0);
				}
			}
			if ((innerIf != null) && (innerIf.getElseStatement() == null)) {
				if (resultingCollections == null) {
					return true;
				}
				
				AST ast = statement.getAST();
				ASTRewrite rewrite = ASTRewrite.create(ast);
				
				Expression innerCondition = (Expression) rewrite.createCopyTarget(innerIf.getExpression());