maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1170465 - in /maven/wagon/trunk/wagon-providers: wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java wagon-http-shared4/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java
Date Wed, 14 Sep 2011 07:58:04 GMT
Author: olamy
Date: Wed Sep 14 07:58:04 2011
New Revision: 1170465

URL: http://svn.apache.org/viewvc?rev=1170465&view=rev
Log:
more generics

Modified:
    maven/wagon/trunk/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java
    maven/wagon/trunk/wagon-providers/wagon-http-shared4/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java

Modified: maven/wagon/trunk/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java?rev=1170465&r1=1170464&r2=1170465&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java
Wed Sep 14 07:58:04 2011
@@ -19,6 +19,16 @@ package org.apache.maven.wagon.shared.ht
  * under the License.
  */
 
+import org.apache.maven.wagon.TransferFailedException;
+import org.apache.xerces.xni.Augmentations;
+import org.apache.xerces.xni.QName;
+import org.apache.xerces.xni.XMLAttributes;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.apache.xerces.xni.parser.XMLParserConfiguration;
+import org.codehaus.plexus.util.StringUtils;
+import org.cyberneko.html.HTMLConfiguration;
+import org.cyberneko.html.filters.DefaultFilter;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
@@ -31,16 +41,6 @@ import java.util.List;
 import java.util.Set;
 import java.util.regex.Pattern;
 
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.xerces.xni.Augmentations;
-import org.apache.xerces.xni.QName;
-import org.apache.xerces.xni.XMLAttributes;
-import org.apache.xerces.xni.parser.XMLInputSource;
-import org.apache.xerces.xni.parser.XMLParserConfiguration;
-import org.codehaus.plexus.util.StringUtils;
-import org.cyberneko.html.HTMLConfiguration;
-import org.cyberneko.html.filters.DefaultFilter;
-
 /**
  * Html File List Parser.
  */
@@ -48,12 +48,11 @@ public class HtmlFileListParser
 {
     /**
      * Fetches a raw HTML from a provided InputStream, parses it, and returns the file list.
-     * 
-     * @param is the input stream.
+     *
      * @return the file list.
      * @throws TransferFailedException if there was a problem fetching the raw html.
      */
-    public static List/* <String> */parseFileList( String baseurl, InputStream stream
)
+    public static List<String> parseFileList( String baseurl, InputStream stream )
         throws TransferFailedException
     {
         try
@@ -70,7 +69,7 @@ public class HtmlFileListParser
             parser.setProperty( "http://cyberneko.org/html/properties/names/attrs", "upper"
);
             parser.parse( new XMLInputSource( null, baseurl, baseURI.toString(), stream,
"UTF-8" ) );
 
-            return new ArrayList( handler.getLinks() );
+            return new ArrayList<String>( handler.getLinks() );
 
         }
         catch ( URISyntaxException e )
@@ -99,9 +98,9 @@ public class HtmlFileListParser
         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
};
-        
-        private Set links = new HashSet();
+            new Pattern[]{ APACHE_INDEX_SKIP, URLS_WITH_PATHS, URLS_TO_PARENT, MAILTO_URLS
};
+
+        private Set<String> links = new HashSet<String>();
 
         private URI baseURI;
 
@@ -110,7 +109,7 @@ public class HtmlFileListParser
             this.baseURI = baseURI.normalize();
         }
 
-        public Set getLinks()
+        public Set<String> getLinks()
         {
             return links;
         }

Modified: maven/wagon/trunk/wagon-providers/wagon-http-shared4/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http-shared4/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java?rev=1170465&r1=1170464&r2=1170465&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http-shared4/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-http-shared4/src/main/java/org/apache/maven/wagon/shared/http/HtmlFileListParser.java
Wed Sep 14 07:58:04 2011
@@ -19,6 +19,14 @@ package org.apache.maven.wagon.shared.ht
  * under the License.
  */
 
+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;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
@@ -31,14 +39,6 @@ import java.util.List;
 import java.util.Set;
 import java.util.regex.Pattern;
 
-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;
-
 /**
  * Html File List Parser.
  */
@@ -56,12 +56,12 @@ public class HtmlFileListParser
     // 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 };
+    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.
-     * 
+     *
      * @param stream the input stream.
      * @return the file list.
      * @throws TransferFailedException if there was a problem fetching the raw html.
@@ -85,10 +85,10 @@ public class HtmlFileListParser
                  * The abs:href loses directories, so we deal with absolute paths ourselves
below in cleanLink
                  */
                 String target = link.attr( "href" );
-                if ( target != null)
+                if ( target != null )
                 {
                     String clean = cleanLink( baseURI, target );
-                    if ( isAcceptableLink( clean )) 
+                    if ( isAcceptableLink( clean ) )
                     {
                         results.add( clean );
                     }
@@ -96,7 +96,7 @@ public class HtmlFileListParser
 
             }
 
-            return new ArrayList<String>(results);
+            return new ArrayList<String>( results );
         }
         catch ( URISyntaxException e )
         {
@@ -120,9 +120,9 @@ public class HtmlFileListParser
         try
         {
             URI linkuri = new URI( ret );
-            if ( link.startsWith( "/" )) 
+            if ( link.startsWith( "/" ) )
             {
-                linkuri =  baseURI.resolve( linkuri );
+                linkuri = baseURI.resolve( linkuri );
             }
             URI relativeURI = baseURI.relativize( linkuri ).normalize();
             ret = relativeURI.toASCIIString();



Mime
View raw message