code: public static boolean isSafeExtension(final String extension) {
          return extension != null && VALID_EXTENSION.matcher(extension).matches()
                  && !DANGEROUS_EXTENSIONS.contains(extension);
      }
docs: Returns true if the given extension is considered "safe"; e.g. is not associated with
  executable or scripting files
  
  @param extension
  file extension
  @return true if given extension is not associated with executable code