@Nullable public static String getFilenameFromMessageID (@Nonnull final String sMessageID) { // Remove angle brackets manually String s = StringHelper.removeAll (sMessageID, '<'); s = StringHelper.removeAll (s, '>'); return FilenameHelper.getAsSecureValidASCIIFilename (s); } }
/** * Stores the content of the input {@link InputStream} in a temporary file (in * the system temporary directory. * * @param aIS * {@link InputStream} to read from * @param sName * name to use in the temporary file to link it to the delivered * message. May be null * @return The created {@link File} * @throws IOException * in case of IO error */ @Nonnull protected static File storeContentToTempFile (@Nonnull final InputStream aIS, @Nonnull final String sName) throws IOException { // create temp file and write steam content to it // name may contain ":" on Windows and that would fail the tests! final String sSuffix = FilenameHelper.getAsSecureValidASCIIFilename (sName != null ? sName : "tmp"); final File aDestFile = File.createTempFile ("AS2TempSharedFileIS", sSuffix); try (final FileOutputStream aOS = new FileOutputStream (aDestFile)) { final MutableLong aCount = new MutableLong (0); StreamHelper.copyInputStreamToOutputStream (aIS, aOS, aCount); if (LOGGER.isInfoEnabled ()) LOGGER.info (aCount.longValue () + " bytes copied to " + aDestFile.getAbsolutePath ()); } return aDestFile; }
LOGGER.debug ("Original MIC is '" + sMIC + "'" + aMsg.getLoggingText ()); final String sPendingFolder = FilenameHelper.getAsSecureValidASCIIFilename (getSession ().getMessageProcessor () .attrs () .getAsString (ATTR_PENDINGMDNINFO)); final String sMsgFilename = AS2IOHelper.getFilenameFromMessageID (aMsg.getMessageID ()); final String sPendingFilename = FilenameHelper.getAsSecureValidASCIIFilename (getSession ().getMessageProcessor () .attrs () .getAsString (ATTR_PENDINGMDN)) +