Bug 43116 - NPE copy and pasting a method
Summary: NPE copy and pasting a method
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-15 14:00 EDT by Tod Creasey CLA
Modified: 2003-10-14 08:07 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2003-09-15 14:00:59 EDT
20030909

When I copied a method from one class and tried to copy into another I got the 
exception below.

STEPS
1) Create a new class
2) Load org.eclipse.ui.tests
3) Copy the method UIPreferences.getPreferenceDialog(String) using copy from 
the outline view
4) Select the outline view of your new class and paste. You will get the error 
below:


!SESSION Sep 15, 2003 13:56:59.251 --------------------------------------------
-
java.version=1.4.2
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86 -debug -install 
file:D:/R30/0909/eclipse/
!ENTRY org.eclipse.jdt.ui 4 10001 Sep 15, 2003 13:56:59.251
!MESSAGE Internal Error
!STACK 0
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:313)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run
(ProgressMonitorDialog.java:357)
	at 
org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper.perform
(RefactoringExecutionHelper.java:131)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgCopyStarter.run
(ReorgCopyStarter.java:70)
	at 
org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$JavaElementAndResourc
ePaster.paste(PasteAction.java:400)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction.run
(PasteAction.java:187)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun
(SelectionDispatchAction.java:194)
	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.sendEvent(Widget.java:847)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2188)
	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)
Caused by: java.lang.NullPointerException
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:750)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations
(ASTConverter.java:244)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:183)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:81)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:818)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:369)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247)
	at 
org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory$CopySubCuE
lementsPolicy.createChange(ReorgPolicyFactory.java:889)
	at 
org.eclipse.jdt.internal.corext.refactoring.reorg.CopyRefactoring.createChange
(CopyRefactoring.java:109)
	at 
org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.ru
n(RefactoringExecutionHelper.java:76)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:302)
	... 27 more
Comment 1 Olivier Thomann CLA 2003-09-15 15:02:16 EDT
The problem seems to be in the ASTConverter. I will investigate.
Comment 2 Olivier Thomann CLA 2003-09-15 15:05:12 EDT
Change milestone.
Comment 3 Olivier Thomann CLA 2003-09-15 15:33:50 EDT
Impossible to reproduce so far.
If you get it again, please let me know immediately.
Comment 4 Olivier Thomann CLA 2003-09-15 15:48:22 EDT
The iteration on the problems array should be till problemsCount and not
problems.length.
I don't have a test case to reproduce this one, but this looks like a bug.
Fixed and released in HEAD.
Comment 5 David Audel CLA 2003-10-14 08:07:18 EDT
Verified.