Bug 105926 [Formatter] Exporting Unnamed profile fails silently
When attempting to export an "Unnamed Profile" from the Project Preferences > Java Code Style > Formatter it will fail silently when it gets to ProfileStore.writeProfilesToStream(): for(final Iterator iter= profiles.iterator(); iter.hasNext();) { final Profile profile= (Profile)iter.next(); if (profile.isProfileToSave()) { final Element profileElement= createProfileElement(profile, document); rootElement.appendChild(profileElement); } } Since the unnamed profile is considered a shared profile and will write an xml file with the content. <?xml version="1.0" encoding="UTF-8"?> <profiles version="8"/> Instead of silently generating an xml file with no content it should rather throw up an error/warning or force a rename dialog. I'll try working on a patch to this respect.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java
Collection profiles= null;
			try {
				profiles= ProfileStore.readProfilesFromFile(file);
			} catch (CoreException e) {
				final String title= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_title; 
				final String message= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_message; 
				ExceptionHandler.handle(e, fComposite.getShell(), title, message);
			}
			if (profiles == null || profiles.isEmpty())
				return;
			
			final CustomProfile profile= (CustomProfile)profiles.iterator().next();
			
			if (ProfileVersioner.getVersionStatus(profile) > 0) {
				final String title= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_too_new_title; 
				final String message= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_too_new_message; 
			    MessageDialog.openWarning(fComposite.getShell(), title, message);
			}
			
			if (fProfileManager.containsName(profile.getName())) {
				final AlreadyExistsDialog aeDialog= new AlreadyExistsDialog(fComposite.getShell(), profile, fProfileManager);
				if (aeDialog.open() != Window.OK) 
					return;
			}
			ProfileVersioner.updateAndComplete(profile);
			fProfileManager.addProfile(profile);
		}
	}
	
	private class PreviewController implements Observer {