Bug 31134 NPE when no default JRE [code manipulation]
I created a project when there were no defined JREs, and got the following NPE: !ENTRY org.eclipse.jdt.ui 4 10001 Feb 06, 2003 12:34:15.392 !MESSAGE Internal Error !STACK 0 java.lang.reflect.InvocationTargetException: java.lang.NullPointerException Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(Ljava/lang/String;)V org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.<init> (Lorg/eclipse/jdt/core/IJavaProject;ILorg/eclipse/core/runtime/IPath;Lorg/eclips e/core/resources/IResource;)V org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.createFromExisting (Lorg/eclipse/jdt/core/IClasspathEntry;Lorg/eclipse/jdt/core/IJavaProject;) Lorg/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement; org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.getExistingEntrie s([Lorg/eclipse/jdt/core/IClasspathEntry;)Ljava/util/ArrayList; org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.getDefaultClassPa th(Lorg/eclipse/jdt/core/IJavaProject;)Ljava/util/List; org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.init (Lorg/eclipse/jdt/core/IJavaProject;Lorg/eclipse/core/runtime/IPath; [Lorg/eclipse/jdt/core/IClasspathEntry;)V org/eclipse/jdt/ui/wizards/JavaCapabilityConfigurationPage.init (Lorg/eclipse/jdt/core/IJavaProject;Lorg/eclipse/core/runtime/IPath; [Lorg/eclipse/jdt/core/IClasspathEntry;Z)V org/eclipse/jdt/internal/ui/wizards/NewProjectCreationWizardPage.updateProject (ZLorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/jdt/internal/ui/wizards/NewProjectCreationWizardPage.performFinish (Lorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/jdt/internal/ui/wizards/NewProjectCreationWizard.finishPage (Lorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/jdt/internal/ui/wizards/NewElementWizard$2.run (Lorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/jdt/internal/core/BatchOperation.executeOperation()V org/eclipse/jdt/internal/core/JavaModelOperation.execute()V org/eclipse/jdt/internal/core/JavaModelOperation.run (Lorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/core/internal/resources/Workspace.run (Lorg/eclipse/core/resources/IWorkspaceRunnable;Lorg/eclipse/core/runtime/IProgr essMonitor;)V org/eclipse/jdt/core/JavaCore.run (Lorg/eclipse/core/resources/IWorkspaceRunnable;Lorg/eclipse/core/runtime/IProgr essMonitor;)V org/eclipse/jdt/internal/ui/actions/WorkbenchRunnableAdapter.run (Lorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/jface/operation/ModalContext.runInCurrentThread (Lorg/eclipse/jface/operation/IRunnableWithProgress;Lorg/eclipse/core/runtime/IP rogressMonitor;)V org/eclipse/jface/operation/ModalContext.run (Lorg/eclipse/jface/operation/IRunnableWithProgress;ZLorg/eclipse/core/runtime/I ProgressMonitor;Lorg/eclipse/swt/widgets/Display;)V org/eclipse/jface/wizard/WizardDialog.run (ZZLorg/eclipse/jface/operation/IRunnableWithProgress;)V org/eclipse/jdt/internal/ui/wizards/NewElementWizard.performFinish()Z org/eclipse/jface/wizard/WizardDialog.finishPressed()V org/eclipse/jface/wizard/WizardDialog.buttonPressed(I)V org/eclipse/jface/dialogs/Dialog$1.widgetSelected (Lorg/eclipse/swt/events/SelectionEvent;)V org/eclipse/swt/widgets/TypedListener.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/swt/widgets/Widget.sendEvent(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/jface/window/Window.runEventLoop(Lorg/eclipse/swt/widgets/Shell;) V org/eclipse/jface/window/Window.open()I org/eclipse/jdt/internal/ui/wizards/AbstractOpenWizardAction.run()V org/eclipse/jdt/internal/ui/wizards/AbstractOpenWizardAction.run (Lorg/eclipse/jface/action/IAction;)V org/eclipse/ui/internal/PluginAction.runWithEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/ui/internal/WWinPluginAction.runWithEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.access$0 (Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event ;)V org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/swt/widgets/Widget.sendEvent(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/ui/internal/Workbench.runEventLoop (Lorg/eclipse/jface/window/Window$IExceptionHandler;)V org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object; org/eclipse/core/internal/boot/InternalBootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String; [Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object; org/eclipse/core/boot/BootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String; [Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object; java/lang/reflect/AccessibleObject.invokeImpl(Ljava/lang/Object; [Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; java/lang/reflect/AccessibleObject.invokeL(Ljava/lang/Object; [Ljava/lang/Object;)Ljava/lang/Object; java/lang/reflect/Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;) Ljava/lang/Object; org/eclipse/core/launcher/Main.basicRun([Ljava/lang/String;) Ljava/lang/Object; org/eclipse/core/launcher/Main.run([Ljava/lang/String;)Ljava/lang/Object; org/eclipse/core/launcher/Main.main([Ljava/lang/String;)V
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java
break;
			case IClasspathEntry.CPE_PROJECT:
				break;
			case IClasspathEntry.CPE_CONTAINER:
				try {
					IClasspathContainer container= JavaCore.getClasspathContainer(fPath, fProject);
					IClasspathEntry[] entries= container.getClasspathEntries();
					for (int i= 0; i < entries.length; i++) {
						CPListElement curr= createFromExisting(entries[i], fProject);
						curr.setParentContainer(this);
						fChildren.add(curr);
					}
				} catch (JavaModelException e) {
				}			
				break;
			default:
		}
	}
	
	public IClasspathEntry getClasspathEntry() {
		if (fCachedEntry == null) {
			fCachedEntry= newClasspathEntry();
		}
		return fCachedEntry;
	}
	
	private IClasspathEntry newClasspathEntry() {
		switch (fEntryKind) {
			case IClasspathEntry.CPE_SOURCE:
				IPath outputLocation= (IPath) getAttribute(OUTPUT);