if (input != null) { final Document document= getCachedDocument(path, input); final NodeList list= document.getElementsByTagName(IRefactoringSerializationConstants.ELEMENT_REFACTORING); final int length= list.getLength(); for (int offset= 0; offset < length; offset++) { final Node node= list.item(offset); final NamedNodeMap attributes= node.getAttributes(); if (attributes != null) { final Node item= attributes.getNamedItem(IRefactoringSerializationConstants.ATTRIBUTE_STAMP); if (item != null) { final String value= item.getNodeValue(); if (String.valueOf(stamp).equals(value)) { node.getParentNode().removeChild(node); if (input != null) { try { input.close(); input= null; } catch (IOException exception) {  } } if (length == 1) removeIndexTree(folder, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)); else { addHistoryEntry(history, document, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)); removeIndexEntry(index, stamp, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)); } break;
final Document document= getCachedDocument(path, input); final NodeList list= document.getElementsByTagName(IRefactoringSerializationConstants.ELEMENT_REFACTORING); final int length= list.getLength(); for (int offset= 0; offset < length; offset++) { final Node node= list.item(offset); final NamedNodeMap attributes= node.getAttributes(); if (attributes != null) { final Node item= attributes.getNamedItem(IRefactoringSerializationConstants.ATTRIBUTE_STAMP); if (item != null) { final String value= item.getNodeValue(); if (String.valueOf(stamp).equals(value)) { node.getParentNode().removeChild(node); try { input.close(); input= null; } catch (IOException exception) {
	void removeRefactoringDescriptor(final long stamp, final IProgressMonitor monitor) throws CoreException {		try {			monitor.beginTask(RefactoringCoreMessages.RefactoringHistoryService_updating_history, 6);			final IPath path= stampToPath(stamp);			final IFileStore folder= fHistoryStore.getChild(path);			if (folder != null) {				final IFileStore history= folder.getChild(RefactoringHistoryService.NAME_HISTORY_FILE);				final IFileStore index= folder.getChild(RefactoringHistoryService.NAME_INDEX_FILE);				if (history != null && index != null && history.fetchInfo(EFS.NONE, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).exists() && index.fetchInfo(EFS.NONE, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).exists()) {					InputStream input= null;					try {						input= new BufferedInputStream(history.openInputStream(EFS.NONE, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));						if (input != null) {							final Document document= getCachedDocument(path, input);							final NodeList list= document.getElementsByTagName(IRefactoringSerializationConstants.ELEMENT_REFACTORING);							final int length= list.getLength();							for (int offset= 0; offset < length; offset++) {								final Node node= list.item(offset);								final NamedNodeMap attributes= node.getAttributes();								if (attributes != null) {									final Node item= attributes.getNamedItem(IRefactoringSerializationConstants.ATTRIBUTE_STAMP);									if (item != null) {										final String value= item.getNodeValue();										if (String.valueOf(stamp).equals(value)) {											node.getParentNode().removeChild(node);											if (input != null) {												try {													input.close();													input= null;												} catch (IOException exception) {													// Do nothing												}											}											if (length == 1)												removeIndexTree(folder, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));											else {												addHistoryEntry(history, document, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));												removeIndexEntry(index, stamp, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));											}											break;										}									}								}							}						}					} catch (ParserConfigurationException exception) {						new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), 0, exception.getLocalizedMessage(), null));					} catch (IOException exception) {						new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), 0, exception.getLocalizedMessage(), null));					} catch (SAXException exception) {						new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), 0, exception.getLocalizedMessage(), null));					} finally {						if (input != null) {							try {								input.close();							} catch (IOException exception) {								// Do nothing							}						}					}				}			}		} finally {			monitor.done();		}	}