public void storeCache ( ) { if ( cacheOk && cacheRes != null && isDirty ) { OutputStream out = null ; try { out = cacheRes . putStream ( ) ; PrintWriter writer = new PrintWriter ( new OutputStreamWriter ( out , "UTF-8" ) ) ; for ( SubsystemFeatureDefinitionImpl entry : cachedFeatures . values ( ) ) { ImmutableAttributes imAttrs = entry . getImmutableAttributes ( ) ; ProvisioningDetails provDetails = entry . getProvisioningDetails ( ) ; if ( imAttrs != null && provDetails != null ) { FeatureDefinitionUtils . writeAttributes ( imAttrs , provDetails , writer ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unable to write out " + entry . getFeatureName ( ) + " to cache because the provisioning " + "detail: " + provDetails + " or imAttrs: " + imAttrs + " is null" ) ; } } } writer . write ( "@=" ) ; writer . write ( toFeatureNameList ( installedFeatures ) ) ; writer . write ( FeatureDefinitionUtils . NL ) ; writer . write ( "-@" ) ; writer . write ( toFeatureNameList ( configuredFeatures ) ) ; writer . write ( FeatureDefinitionUtils . NL ) ; writer . write ( "-#" ) ; writer . write ( configurationError ? ' ' : ' ' ) ; writer . write ( FeatureDefinitionUtils . NL ) ; for ( Map . Entry < File , BadFeature > entry : knownBadFeatures . entrySet ( ) ) { writer . write ( "XX" ) ; writeBadManifestEntry ( writer , entry . getKey ( ) , entry . getValue ( ) ) ; writer . write ( FeatureDefinitionUtils . NL ) ; } writer . flush ( ) ; writer . close ( ) ; isDirty = false ; // mark cache as current after it has been saved } catch ( IOException e ) { cacheWarning ( e ) ; } finally { FeatureDefinitionUtils . tryToClose ( out ) ; } } }
Write the feature cache file