maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r644376 - /maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java
Date Thu, 03 Apr 2008 15:47:37 GMT
Author: jdcasey
Date: Thu Apr  3 08:47:36 2008
New Revision: 644376

URL: http://svn.apache.org/viewvc?rev=644376&view=rev
Log:
[MNG-3498] Fixing StringIndexOutOfBoundsException when path == '${basedir}'.

Modified:
    maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java

Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java?rev=644376&r1=644375&r2=644376&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java
(original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java
Thu Apr  3 08:47:36 2008
@@ -83,7 +83,7 @@
 
         if ( requiresBaseDirectoryAlignment( s ) )
         {
-            s = new File( basedir, s ).getAbsolutePath();
+            s = new File( new File( basedir, s ).toURI().normalize() ).getAbsolutePath();
         }
 
         return s;
@@ -91,14 +91,23 @@
 
     private String stripBasedirToken( String s )
     {
+        String basedirExpr = "${basedir}";
+
         if ( s != null )
         {
             s = s.trim();
 
-            if ( s.startsWith( "${basedir}" ) )
+            if ( s.startsWith( basedirExpr ) )
             {
-                // Take out ${basedir} and the leading slash
-                s = s.substring( 11 );
+                if ( s.length() > basedirExpr.length() )
+                {
+                    // Take out ${basedir} and the leading slash
+                    s = s.substring( basedirExpr.length() + 1 );
+                }
+                else
+                {
+                    s = ".";
+                }
             }
         }
 



Mime
View raw message