Project: JDT
Bug 50971 Extract temp: index out of bounds error [refactoring]
Reported: 2004-01-30 10:23:45 | Status: resolved fixed

I20040129 Trying to extract a local from entries[i].getPluginId() caused an exception. private MultiStatus createMultiStatus() { MultiStatus status= new MultiStatus( JavaPlugin.getPluginId(), IStatus.ERROR, RefactoringMessages.getString ("UndoManagerAction.validation_failed"), //$NON-NLS-1$ null); RefactoringStatusEntry[] entries= fPreflightStatus.getEntries (); for (int i= 0; i < entries.length; i++) { status.merge(new Status( IStatus.ERROR, entries[i].getPluginId() != null ? entries [i].getPluginId() : JavaPlugin.getPluginId(), IStatus.ERROR, entries[i].getMessage(), null)); } return status; } Caused by: java.lang.ArrayIndexOutOfBoundsException: 10 at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.allArra ysEqual(ExtractTempRefactoring.java:647) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.getLong estArrayPrefix(ExtractTempRefactoring.java:634) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.findDee pestCommonSuperNodePathForReplacedNodes(ExtractTempRefactoring.java:619) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.getNode ToInsertTempDeclarationBefore(ExtractTempRefactoring.java:595) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.createA ndInsertTempDeclaration(ExtractTempRefactoring.java:525) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.createT empDeclarationEdit(ExtractTempRefactoring.java:515) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.getAllE dits(ExtractTempRefactoring.java:500) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.checkIn put(ExtractTempRefactoring.java:368) at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run (CheckConditionsOperation.java:64) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:99) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:166) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:302)

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractTemp/canExtract/A_test78_in.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractTemp/canExtract/A_test78_out.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractTempTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractTempRefactoring.java