Bug 22260 Internal Error during creation of class using New Class Wizard [code manipulation]
When trying to create the class "URLs" by means of New Class Wizard I get the error "Invalid Contents specified.". Source file is created with only package statement. So far I've figured out that it happens if second letter of the class is uppercased. After that Error Log contains the Internal Error: Java Model Exception: Java Model Status [Invalid contents specified.] at org.eclipse.jdt.internal.core.JavaModelOperation.execute (JavaModelOperation.java:307) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperation.java:513) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1361) at org.eclipse.jdt.internal.core.JavaModelManager.runOperation (JavaModelManager.java:1212) at org.eclipse.jdt.internal.core.JavaElement.runOperation (JavaElement.java:574) at org.eclipse.jdt.internal.core.CompilationUnit.createType (CompilationUnit.java:203) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType (NewTypeWizardPage.java:1335) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage$1.run (NewTypeWizardPage.java:1637) at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute (WorkspaceModifyDelegatingOperation.java:39) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run (WorkspaceModifyOperation.java:64) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1361) at org.eclipse.ui.actions.WorkspaceModifyOperation.run (WorkspaceModifyOperation.java:78) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:299) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:720) at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.finishPage (NewElementWizard.java:66) at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.performFinish (NewClassCreationWizard.java:42) at org.eclipse.jface.wizard.WizardDialog.finishPressed (WizardDialog.java:577) at org.eclipse.jface.wizard.WizardDialog.buttonPressed (WizardDialog.java:312) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:398) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291) at org.eclipse.jface.window.Window.runEventLoop(Window.java:557) at org.eclipse.jface.window.Window.open(Window.java:537) at org.eclipse.ui.internal.NewWizardShortcutAction.run (NewWizardShortcutAction.java:88) at org.eclipse.jface.action.Action.runWithEvent(Action.java:749) 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:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:775) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:248) at org.eclipse.core.launcher.Main.run(Main.java:698) at org.eclipse.core.launcher.Main.main(Main.java:534)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
IType member= type.getType(typeName);
				if (member.exists()) {
					status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.TypeNameExists")); 
					return status;
				}
			}
		}
		return status;
	}
	
	/**
	 * Hook method that gets called when the superclass name has changed. The method 
	 * validates the superclass name and returns the status of the validation.
	 * <p>
	 * Subclasses may extend this method to perform their own validation.
	 * </p>
	 * 
	 * @return the status of the validation
	 */
	protected IStatus superClassChanged() {
		StatusInfo status= new StatusInfo();
		IPackageFragmentRoot root= getPackageFragmentRoot();
		fSuperClassDialogField.enableButton(root != null);
		
		fSuperClass= null;
		
		String sclassName= getSuperClass();
		if (sclassName.length() == 0) {
			
			return status;