public static String getSafeExtension(final String filename) {
        // extension does not include period (.)
        final String extension = FilenameUtils.getExtension(filename);
        return isSafeExtension(extension) ? "." + extension : StringUtils.EMPTY;
    }
public static String getSafeExtension ( final String filename ) { final String extension = FilenameUtils . getExtension ( filename ) ; return isSafeExtension ( extension ) ? "." + extension : StringUtils . EMPTY ; }
Returns the extension of the given file (including period), if the extension is considered
safe, e.g. not an extension for an executable file or script language.

@param filename
filename

@return extension of the given file (including period)