public void performVirusScan(UploadedFile file) throws VirusException {
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Performing virus scan...");
        }

        // ServiceLoader is not thread-safe so it cannot be cached:
        // https://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html
        Iterator<VirusScanner> scanners = ServiceLoader.load(VirusScanner.class, classLoader).iterator();
        while (scanners.hasNext()) {
            try {
                VirusScanner scanner = scanners.next();
                String clazz = scanner.getClass().getName();
                if (!scanner.isEnabled()) {
                    if (LOGGER.isLoggable(Level.FINE)) {
                        LOGGER.fine(String.format("Skipping virus scan with %s provider since it is disabled", clazz));
                    }
                    continue;
                }
                if (LOGGER.isLoggable(Level.FINE)) {
                    LOGGER.fine(String.format("Performing virus scan with %s provider", clazz));
                }
                scanner.scan(file);
                if (LOGGER.isLoggable(Level.FINE)) {
                    LOGGER.fine(String.format("No virus detected with %s provider", clazz));
                }
            }
            catch (VirusException ex) {
                if (LOGGER.isLoggable(Level.SEVERE)) {
                    LOGGER.severe("Detected a virus");
                }
                throw ex;
            }
        }
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("No virus detected");
        }
    }
Perform virus scan and throw exception if at least one registered {@link VirusScanner} provider has detected a virus.
@param file input stream to perform virus scan on
@throws VirusException if at least one {@link VirusScanner} provider has detected a virus
primefaces/src/main/java/org/primefaces/virusscan/VirusScannerService.java