public void loadCache()

in src/main/java/org/apache/maven/doxia/linkcheck/validation/LinkValidatorManager.java [183:225]


    public void loadCache( File cacheFile )
        throws IOException
    {
        if ( cacheFile == null )
        {
            LOG.debug( "No cache file specified! Ignoring request to load." );
            return;
        }

        if ( !cacheFile.exists() )
        {
            LOG.debug( "Specified cache file does not exist! Ignoring request to load." );
            return;
        }

        if ( cacheFile.isDirectory() )
        {
            LOG.debug( "Cache file is a directory! Ignoring request to load." );
            return;
        }

        
        try ( ObjectInputStream is = new ObjectInputStream( new FileInputStream( cacheFile ) ) )
        {
            this.cache = (Map<Object, LinkValidationResult>) is.readObject();

            if ( LOG.isDebugEnabled() )
            {
                LOG.debug( "Cache file loaded: " + cacheFile.getAbsolutePath() );
            }
        }
        catch ( InvalidClassException e )
        {
            LOG.warn( "Your cache is incompatible with this version of linkcheck. It will be recreated." );
        }
        catch ( ClassNotFoundException e )
        {
            if ( LOG.isErrorEnabled() )
            {
                LOG.error( "Unable to load the cache: " + cacheFile.getAbsolutePath(), e );
            }
        }
    }