Projects >> maven-wagon >>cc025b7091410c9fa98ce8c88cd2920e7c36ea40

Chunk
Conflicting content
import java.util.Set;
import java.util.regex.Pattern;

<<<<<<< HEAD
=======
import org.apache.commons.io.IOUtils;
import org.apache.maven.wagon.TransferFailedException;
import org.codehaus.plexus.util.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

>>>>>>> 0c5be5f7e9c75cb40225aab5320a29ad384adc9d
/**
 * Html File List Parser.
 */
Solution content
import java.util.Set;
import java.util.regex.Pattern;

/**
 * Html File List Parser.
 */
File
HtmlFileListParser.java
Developer's decision
Version 1
Kind of conflict
Other
Chunk
Conflicting content
    // mailto urls
    private static final Pattern MAILTO_URLS = Pattern.compile( "mailto:.*" );

<<<<<<< HEAD
    private static final Pattern[] SKIPS =
        new Pattern[]{ APACHE_INDEX_SKIP, URLS_WITH_PATHS, URLS_TO_PARENT, MAILTO_URLS };
=======
    private static final Pattern[] SKIPS = new Pattern[] { APACHE_INDEX_SKIP, URLS_WITH_PATHS, URLS_TO_PARENT,
        MAILTO_URLS };
>>>>>>> 0c5be5f7e9c75cb40225aab5320a29ad384adc9d

    /**
     * Fetches a raw HTML from a provided InputStream, parses it, and returns the file list.
Solution content
    // mailto urls
    private static final Pattern MAILTO_URLS = Pattern.compile( "mailto:.*" );

    private static final Pattern[] SKIPS =
        new Pattern[]{ APACHE_INDEX_SKIP, URLS_WITH_PATHS, URLS_TO_PARENT, MAILTO_URLS };

    /**
     * Fetches a raw HTML from a provided InputStream, parses it, and returns the file list.
File
HtmlFileListParser.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
            // assumption.
            String content = IOUtils.toString( stream, "utf-8" );
            Document doc = Jsoup.parse( content, baseurl );
<<<<<<< HEAD
            Elements links = doc.select("a[href]");
            Set results = new HashSet();
            for ( Element link : links )
            {
=======
            Elements links = doc.getElementsByTag( "a" );
            Set results = new HashSet();
            for ( int lx = 0; lx < links.size(); lx++ )
            {
                Element link = links.get( lx );
>>>>>>> 0c5be5f7e9c75cb40225aab5320a29ad384adc9d
                /*
                 * The abs:href loses directories, so we deal with absolute paths ourselves below in cleanLink
                 */
Solution content
            // assumption.
            String content = IOUtils.toString( stream, "utf-8" );
            Document doc = Jsoup.parse( content, baseurl );
            Elements links = doc.select("a[href]");
            Set results = new HashSet();
            for ( Element link : links )
            {
                /*
                 * The abs:href loses directories, so we deal with absolute paths ourselves below in cleanLink
                 */
File
HtmlFileListParser.java
Developer's decision
Version 1
Kind of conflict
For statement
Method invocation
Variable
Chunk
Conflicting content
                 * The abs:href loses directories, so we deal with absolute paths ourselves below in cleanLink
                 */
                String target = link.attr( "href" );
<<<<<<< HEAD
                if ( target != null )
                {
                    String clean = cleanLink( baseURI, target );
                    if ( isAcceptableLink( clean ) )
=======
                if ( target != null)
                {
                    String clean = cleanLink( baseURI, target );
                    if ( isAcceptableLink( clean )) 
>>>>>>> 0c5be5f7e9c75cb40225aab5320a29ad384adc9d
                    {
                        results.add( clean );
                    }
Solution content
                 * The abs:href loses directories, so we deal with absolute paths ourselves below in cleanLink
                 */
                String target = link.attr( "href" );
                if ( target != null )
                {
                    String clean = cleanLink( baseURI, target );
                    if ( isAcceptableLink( clean ) )
                    {
                        results.add( clean );
                    }
File
HtmlFileListParser.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
<<<<<<< HEAD
            return new ArrayList( results );

            }

        }
        catch ( URISyntaxException e )
        {
            throw new TransferFailedException( "Unable to parse as base URI: " + baseurl, e );
=======
            ArrayList resultsAsList = new ArrayList();
            resultsAsList.addAll( results );
            return resultsAsList;
        }
        catch ( URISyntaxException e )
        {
            throw new TransferFailedException( "Unable to parse as base URI: " + baseurl );
>>>>>>> 0c5be5f7e9c75cb40225aab5320a29ad384adc9d
        }
        catch ( IOException e )
        {
Solution content
            }

            return new ArrayList( results );
        }
        catch ( URISyntaxException e )
        {
            throw new TransferFailedException( "Unable to parse as base URI: " + baseurl, e );
        }
        catch ( IOException e )
        {
File
HtmlFileListParser.java
Developer's decision
Version 1
Kind of conflict
Catch clause
Method invocation
Return statement
Throw statement
Chunk
Conflicting content
        try
        {
            URI linkuri = new URI( ret );
<<<<<<< HEAD
            if ( link.startsWith( "/" ) )
            {
                linkuri = baseURI.resolve( linkuri );
=======
            if ( link.startsWith( "/" )) 
            {
                linkuri =  baseURI.resolve( linkuri );
>>>>>>> 0c5be5f7e9c75cb40225aab5320a29ad384adc9d
            }
            URI relativeURI = baseURI.relativize( linkuri ).normalize();
            ret = relativeURI.toASCIIString();
Solution content
        try
        {
            URI linkuri = new URI( ret );
            if ( link.startsWith( "/" ) )
            {
                linkuri = baseURI.resolve( linkuri );
            }
            URI relativeURI = baseURI.relativize( linkuri ).normalize();
            ret = relativeURI.toASCIIString();
File
HtmlFileListParser.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
            return false;
        }

<<<<<<< HEAD
        for ( Pattern pattern : SKIPS )
        {
            if ( pattern.matcher( link ).find() )
=======
        for ( int i = 0; i < SKIPS.length; i++ )
        {
            if ( SKIPS[i].matcher( link ).find() )
>>>>>>> 0c5be5f7e9c75cb40225aab5320a29ad384adc9d
            {
                return false;
            }
Solution content
            return false;
        }

        for ( Pattern pattern : SKIPS )
        {
            if ( pattern.matcher( link ).find() )
            {
                return false;
            }
File
HtmlFileListParser.java
Developer's decision
Version 1
Kind of conflict
For statement
If statement
Chunk
Conflicting content
        return true;
    }

<<<<<<< HEAD
}
=======
}
>>>>>>> 0c5be5f7e9c75cb40225aab5320a29ad384adc9d
Solution content
        return true;
    }

}
File
HtmlFileListParser.java
Developer's decision
Version 1
Kind of conflict
Other