private void checkURL()

in src/main/java/org/apache/maven/plugin/docck/AbstractCheckDocumentationMojo.java [465:512]


    private void checkURL( String url, String description, DocumentationReporter reporter )
    {
        try
        {
            String protocol = getURLProtocol( url );

            if ( protocol.startsWith( "http" ) )
            {
                if ( offline )
                {
                    reporter.warn( "Cannot verify " + description + " in offline mode with URL: \'" + url + "\'." );
                }
                else if ( !validUrls.contains( url ) )
                {
                    HttpHead headMethod = new HttpHead( url );

                    try ( CloseableHttpResponse response = httpClient.execute( headMethod ) )
                    {
                        getLog().debug( "Verifying http url: " + url );
                        if ( response.getCode() != HTTP_STATUS_200 )
                        {
                            reporter.error( "Cannot reach " + description + " with URL: \'" + url + "\'." );
                        }
                        else
                        {
                            validUrls.add( url );
                        }
                    }
                    catch ( IOException e )
                    {
                        reporter.error( "Cannot reach " + description + " with URL: \'" + url + "\'.\nError: "
                            + e.getMessage() );
                    }
                }
            }
            else
            {
                reporter.warn( "Non-HTTP " + description + " URL not verified." );
            }
        }
        catch ( MalformedURLException e )
        {
            reporter.warn( "The " + description + " appears to have an invalid URL \'" + url + "\'."
                + " Message: \'" + e.getMessage() + "\'. Trying to access it as a file instead." );

            checkFile( url, description, reporter );
        }
    }