Bug 7444 surround try/catch: NPE
i had code like: public static int getTabSize() { return Integer.parseInt(getIntValue((String) JavaCore.getOption().get (PREF_TAB_SIZE), 4)); } and tried to surroung the returned expression. could not reproduce on a smaller test case 4 org.eclipse.ui 0 java.lang.NullPointerException java.lang.NullPointerException at org.eclipse.jdt.internal.corext.refactoring.util.NewSelectionAnalyzer.visit (NewSelectionAnalyzer.java:460) at org.eclipse.jdt.internal.corext.refactoring.util.ASTParentTrackingAdapter.visit (ASTParentTrackingAdapter.java:707) at org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse (MessageSend.java:261) at org.eclipse.jdt.internal.compiler.ast.ReturnStatement.traverse (ReturnStatement.java:235) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse (MethodDeclaration.java(Compiled Code)) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse (TypeDeclaration.java:851) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse (CompilationUnitDeclaration.java:228) at org.eclipse.jdt.internal.corext.refactoring.util.AST.accept (AST.java:70) at org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefacto ring.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(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java (Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:798) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:821) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.Main.main(Main.java:362)
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/A.java
class A {
	void f() {
		int i= 0;
		int j= 1;
		switch (j) {
			case 1 :
				
				i= 1; 
				break;
			default :
				i= -1;
				break;
		}
		System.out.println(i);
	}
}