You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by lt...@apache.org on 2008/05/23 15:42:30 UTC

svn commit: r659539 - /maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptUtils.java

Author: ltheussl
Date: Fri May 23 06:42:30 2008
New Revision: 659539

URL: http://svn.apache.org/viewvc?rev=659539&view=rev
Log:
Forward isExternalLink() to DoxiaUtils to avoid code duplication.

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptUtils.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptUtils.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptUtils.java?rev=659539&r1=659538&r2=659539&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptUtils.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptUtils.java Fri May 23 06:42:30 2008
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-import java.util.Locale;
+import org.apache.maven.doxia.util.DoxiaUtils;
 
 /**
  * A collection of utility methods for dealing with APT documents.
@@ -55,13 +55,11 @@
     /**
      * Checks if the given string corresponds to an external URI,
      * ie is not a link within the same document nor a link to another
-     * document on the same filesystem.
+     * document within the same site. This forwards to
+     * {@link org.apache.maven.doxia.util.DoxiaUtils#isExternalLink(String)}.
      *
      * @param link The link to check.
-     * @return True if the link (ignoring case) starts with either "http:/",
-     * "https:/", "ftp:/", "mailto:", "file:/", or contains the string "://".
-     * Note that Windows style separators "\" are not allowed
-     * for URIs, see  http://www.ietf.org/rfc/rfc2396.txt , section 2.4.3.
+     * @return True if DoxiaUtils.isExternalLink(link) returns true.
      *
      * @see org.apache.maven.doxia.util.DoxiaUtils#isExternalLink(String)
      * @see #isInternalLink(String)
@@ -69,11 +67,7 @@
      */
     public static boolean isExternalLink( String link )
     {
-        String text = link.toLowerCase( Locale.ENGLISH );
-
-        return ( text.indexOf( "http:/" ) == 0 || text.indexOf( "https:/" ) == 0
-            || text.indexOf( "ftp:/" ) == 0 || text.indexOf( "mailto:" ) == 0
-            || text.indexOf( "file:/" ) == 0 || text.indexOf( "://" ) != -1 );
+        return DoxiaUtils.isExternalLink( link );
     }
 
     /**