protected void addWhitelistedResource ( final Resource resource , final ScanSpecPathMatch parentMatchStatus , final LogNode log ) { final String path = resource . getPath ( ) ; final boolean isClassFile = FileUtils . isClassfile ( path ) ; boolean isWhitelisted = false ; if ( isClassFile ) { // Check classfile scanning is enabled, and classfile is not specifically blacklisted if ( scanSpec . enableClassInfo && ! scanSpec . classfilePathWhiteBlackList . isBlacklisted ( path ) ) { // ClassInfo is enabled, and found a whitelisted classfile whitelistedClassfileResources . add ( resource ) ; isWhitelisted = true ; } } else { // Resources are always whitelisted if found in whitelisted directories isWhitelisted = true ; } // Add resource to whitelistedResources, whether for a classfile or non-classfile resource whitelistedResources . add ( resource ) ; // Write to log if enabled, and as long as classfile scanning is not disabled, and this is not // a blacklisted classfile if ( log != null && isWhitelisted ) { final String type = isClassFile ? "classfile" : "resource" ; String logStr ; switch ( parentMatchStatus ) { case HAS_WHITELISTED_PATH_PREFIX : logStr = "Found " + type + " within subpackage of whitelisted package: " ; break ; case AT_WHITELISTED_PATH : logStr = "Found " + type + " within whitelisted package: " ; break ; case AT_WHITELISTED_CLASS_PACKAGE : logStr = "Found specifically-whitelisted " + type + ": " ; break ; default : logStr = "Found whitelisted " + type + ": " ; break ; } // Precede log entry sort key with "0:file:" so that file entries come before dir entries for // ClasspathElementDir classpath elements resource . scanLog = log . log ( "0:" + path , logStr + path + ( path . equals ( resource . getPathRelativeToClasspathElement ( ) ) ? "" : " ; full path: " + resource . getPathRelativeToClasspathElement ( ) ) ) ; } }
Add a resource discovered during the scan .