private IdentificationResultCollection handleContainer(
     IdentificationRequest request, IdentificationResultCollection results) throws IOException {
   // process a container format (ole2, odf, ooxml etc)
   String containerFormat = getContainerFormat(results);
   try {
     if (containerFormatResolver != null && containerFormat != null) {
       ContainerIdentifier containerIdentifier =
           containerIdentifierFactory.getIdentifier(containerFormat);
       containerIdentifier.setMaxBytesToScan(maxBytesToScan);
       IdentificationResultCollection containerResults = containerIdentifier.submit(request);
       droidCore.removeLowerPriorityHits(containerResults);
       droidCore.checkForExtensionsMismatches(containerResults, request.getExtension());
       containerResults.setFileLength(request.size());
       containerResults.setRequestMetaData(request.getRequestMetaData());
       return containerResults.getResults().isEmpty() ? null : containerResults;
     }
     // CHECKSTYLE:OFF - rules say don't catch this, but other code keeps on throwing them.
     // Don't prejudice any results so far because other code isn't following 'the rules'.
   } catch (Exception e) {
     // CHECKSTYLE:ON
     String causeMessage = "";
     if (e.getCause() != null) {
       causeMessage = e.getCause().getMessage();
     }
     final String message =
         String.format(
             CONTAINER_ERROR,
             containerFormat,
             request.getIdentifier().getUri().toString(),
             e.getMessage(),
             causeMessage);
     log.warn(message);
   }
   return null;
 }
 private void generateHash(IdentificationRequest request) throws IOException {
   if (generateHash) {
     try {
       InputStream in = request.getSourceInputStream();
       try {
         String hash = hashGenerator.hash(in);
         request.getRequestMetaData().setHash(hash);
       } finally {
         if (in != null) {
           in.close();
         }
       }
       // CHECKSTYLE:OFF - generating a hash can't prejudice any other results
     } catch (Exception e) {
       log.error(e);
     }
     // CHECKSTYLE:ON
   }
 }