private void closeAndDeleteTempFile() throws IOException { // one way or the other, temporary file should be deleted. try { close(); } finally { Files.deleteIfExists(tmpPath); } }
public void commit() throws IOException { close(); try {
try { XMLUtils.safeTransform(source, new StreamResult(out)); out.close(); } catch (TransformerException | SAXException e) { throw new IOException("Failed to persist config.xml", e);
/** * When the write operation failed, call this method to * leave the original file intact and remove the temporary file. * This method can be safely invoked from the "finally" block, even after * the {@link #commit()} is called, to simplify coding. */ public void abort() throws IOException { close(); tmpFile.delete(); }
/** * When the write operation failed, call this method to * leave the original file intact and remove the temporary file. * This method can be safely invoked from the "finally" block, even after * the {@link #commit()} is called, to simplify coding. */ public void abort() throws IOException { close(); tmpFile.delete(); }
@Override protected void finalize() throws Throwable { // one way or the other, temporary file should be deleted. close(); tmpFile.delete(); }
/** * When the write operation failed, call this method to * leave the original file intact and remove the temporary file. * This method can be safely invoked from the "finally" block, even after * the {@link #commit()} is called, to simplify coding. */ public void abort() throws IOException { close(); tmpFile.delete(); }
/** * When the write operation failed, call this method to * leave the original file intact and remove the temporary file. * This method can be safely invoked from the "finally" block, even after * the {@link #commit()} is called, to simplify coding. */ public void abort() throws IOException { close(); tmpFile.delete(); }
/** * When the write operation failed, call this method to leave the original * file intact and remove the temporary file. This method can be safely * invoked from the "finally" block, even after the {@link #commit()} is * called, to simplify coding. */ public void abort() throws IOException { close(); tmpFile.delete(); }
public void commit() throws IOException { close(); if(destFile.exists() && !destFile.delete()) { tmpFile.delete(); throw new IOException("Unable to delete "+destFile); } tmpFile.renameTo(destFile); }
public void commit() throws IOException { close(); if (destFile.exists() && !destFile.delete()) { tmpFile.delete(); throw new IOException("Unable to delete " + destFile); } tmpFile.renameTo(destFile); }
public void commit() throws IOException { close(); if(destFile.exists() && !destFile.delete()) { tmpFile.delete(); throw new IOException("Unable to delete "+destFile); } tmpFile.renameTo(destFile); }
public void commit() throws IOException { close(); if(destFile.exists() && !destFile.delete()) { tmpFile.delete(); throw new IOException("Unable to delete "+destFile); } tmpFile.renameTo(destFile); }
public void commit() throws IOException { close(); if (destFile.exists()) { try { Util.deleteFile(destFile); } catch (IOException x) { tmpFile.delete(); throw x; } } tmpFile.renameTo(destFile); }
try { XMLUtils.safeTransform(source, new StreamResult(out)); out.close(); } catch (TransformerException | SAXException e) { throw new IOException("Failed to persist config.xml", e);
t.transform(source, new StreamResult(out)); out.close(); } catch (TransformerException e) { throw new IOException2("Failed to persist configuration.xml", e);
t.transform(new StreamSource(req.getReader()), new StreamResult(out)); out.close(); } catch (TransformerException e) { throw new IOException2("Failed to persist configuration.xml", e);
t.transform(new StreamSource(req.getReader()), new StreamResult(out)); out.close(); } catch (TransformerException e) { throw new IOException2("Failed to persist configuration.xml", e);
t.transform(new StreamSource(req.getReader()), new StreamResult(out)); out.close(); } catch (TransformerException e) { throw new IOException2("Failed to persist configuration.xml", e);
t.transform(new StreamSource(req.getReader()), new StreamResult(out)); out.close(); } catch (TransformerException e) { throw new IOException2("Failed to persist configuration.xml", e);