private static void _dumpDecrypted (@Nonnull final byte [] aPayload) { // Ensure a unique filename File aDestinationFile; int nIndex = 0; do { aDestinationFile = new File (s_aDumpDecryptedDirectory, "as2-decrypted-" + Long.toString (PDTFactory.getCurrentMillis ()) + "-" + nIndex + ".part"); nIndex++; } while (aDestinationFile.exists ()); LOGGER.info ("Dumping decrypted MIME part to file " + aDestinationFile.getAbsolutePath ()); try (final OutputStream aOS = FileHelper.getOutputStream (aDestinationFile)) { // Add payload aOS.write (aPayload); } catch (final IOException ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Failed to dump decrypted MIME part to file " + aDestinationFile.getAbsolutePath (), ex); } }
/** * This method is called if recovery from the WAL file (partially) failed an * analysis might be needed. */ final void _maintainWALFileAfterProcessing (@Nonnull @Nonempty final String sWALFilename) { ValueEnforcer.notEmpty (sWALFilename, "WALFilename"); final File aWALFile = m_aIO.getFile (sWALFilename); final File aNewFile = new File (aWALFile.getParentFile (), aWALFile.getName () + "." + PDTFactory.getCurrentMillis () + ".bup"); if (FileOperationManager.INSTANCE.renameFile (aWALFile, aNewFile).isFailure ()) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Failed to rename WAL file '" + aWALFile.getAbsolutePath () + "' to '" + aNewFile.getAbsolutePath () + "'"); } else { if (LOGGER.isInfoEnabled ()) LOGGER.info ("Maintained WAL file '" + aWALFile.getAbsolutePath () + "' as '" + aNewFile.getAbsolutePath () + "' for debugging purposes"); } }