You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "John Casey (JIRA)" <ji...@codehaus.org> on 2005/06/16 02:18:26 UTC

[jira] Commented: (MNG-473) m2 fails if user.home contains $ character

    [ http://jira.codehaus.org/browse/MNG-473?page=comments#action_41365 ] 

John Casey commented on MNG-473:
--------------------------------

added the proposed fix, for now.

This is sort of a hint that we need a better solution for this in general...not just a patch adding an additional layer of regexp. If this solves the immediate problem, we can revisit this as more of a design issue later, and come up with a replacement.

> m2 fails if user.home contains $ character
> ------------------------------------------
>
>          Key: MNG-473
>          URL: http://jira.codehaus.org/browse/MNG-473
>      Project: Maven 2
>         Type: Bug
>   Components: maven-core
>     Versions: 2.0-alpha-1
>  Environment: Windows XP
>     Reporter: Max Muermann
>     Assignee: John Casey

>
>
> If the user.home path contains the $ character at the end, the string replacement in org.apache.maven.settings.DefaultMavenSettingsBuilder.getSettingsFile() fails with a StringIndexOutOfBoundsException:
> java.lang.StringIndexOutOfBoundsException: String index out of range: 22
>         at java.lang.String.charAt(String.java:558)
>         at java.util.regex.Matcher.appendReplacement(Matcher.java:704)
>         at java.util.regex.Matcher.replaceAll(Matcher.java:806)
>         at java.lang.String.replaceAll(String.java:2000)
>         at org.apache.maven.settings.DefaultMavenSettingsBuilder.getSettingsFile(DefaultMavenSettingsBuilder.java:124)
> ...
> If the $ character occurs not at the end of the path, an IllegalArgumentException: Illegal Group Reference is thrown.
> proposed fix:
> add
> userHome = userHome.replaceAll("\\$", "\\\\\\$");
> to the getSettingsFile() before 
> path = path.replaceAll("\\$\\{user.home\\}", userHome);
> This results in $ characters being properly escaped.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org