class StripAttachment extends GenericMailet {

    @VisibleForTesting String getFilename(BodyPart bodyPart) {
        try {
            String fileName = bodyPart.getFileName();
            if (fileName != null) {
                return renameWithConfigurationPattern(decodeFilename(fileName));
            }
        } catch (Exception e) {
            LOGGER.warn("Unparsable filename, using a random filename instead.", e);
        }
        return randomFilename();
    }

}