Bug 7229 - surround try/catch block throws NPE
Summary: surround try/catch block throws NPE
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC All
: P2 major (vote)
Target Milestone: 2.0 M3   Edit
Assignee: Dirk Baeumer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-03 06:54 EST by Claude Knaus CLA
Modified: 2002-01-15 13:30 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Claude Knaus CLA 2002-01-03 06:54:18 EST
Workspace version on Linux and Windows:

If the compilation unit has errors, it throws an NPE.

--
public class Foo {
    public static void main(String[] args) {
        System.out.println(""); // select this line and call surround try/catch
        a                       // syntax error
    }
}
--
4 org.eclipse.ui 0 java.lang.NullPointerException
java.lang.NullPointerException
	at org.eclipse.jdt.internal.corext.refactoring.util.AST.accept(AST.java:70)
	at
org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring.checkActivation(SurroundWithTryCatchRefactoring.java:102)
	at
org.eclipse.jdt.internal.ui.refactoring.actions.SurroundWithTryCatchAction.run(SurroundWithTryCatchAction.java:42)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:452)
	at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:407)
	at
org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:361)
	at
org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:352)
	at
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:489)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1569)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1423)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:815)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:798)
	at
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:820)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at SlimLauncher.main(SlimLauncher.java:14)
Comment 1 Dirk Baeumer CLA 2002-01-15 13:30:59 EST
Fixed in build > xI-20020115