You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Herve Boutemy (JIRA)" <ji...@codehaus.org> on 2010/04/30 18:22:12 UTC

[jira] Updated: (MPMD-121) Download of PMD ruleset from URL fails if URL contains characters not valid in file name

     [ http://jira.codehaus.org/browse/MPMD-121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MPMD-121:
-------------------------------

    Description: 
{code:java}
    private String getLocationTemp( String name )
    {
        String loc = name;
        if ( loc.indexOf( '/' ) != -1 )
        {
            loc = loc.substring( loc.lastIndexOf( '/' ) + 1 );
        }
        if ( loc.indexOf( '\\' ) != -1 )
        {
            loc = loc.substring( loc.lastIndexOf( '\\' ) + 1 );
        }
        getLog().debug( "Before: " + name + " After: " + loc );
        return loc;
    }
{code}
should encode the URL, so that characters such as ? or & do not prevent creating a local file

Fix suggestion: add following code line before log output:
{code:java}
loc = URLEncoder.encode(loc, "UTF-8");
{code}

  was:


    private String getLocationTemp( String name )
    {
        String loc = name;
        if ( loc.indexOf( '/' ) != -1 )
        {
            loc = loc.substring( loc.lastIndexOf( '/' ) + 1 );
        }
        if ( loc.indexOf( '\\' ) != -1 )
        {
            loc = loc.substring( loc.lastIndexOf( '\\' ) + 1 );
        }
        getLog().debug( "Before: " + name + " After: " + loc );
        return loc;
    }

should encode the URL, so that characters such as ? or & do not prevent creating a local file

Fix suggestion: add following code line before log output:

loc = URLEncoder.encode(loc, "UTF-8");



> Download of PMD ruleset from URL fails if URL contains characters not valid in file name
> ----------------------------------------------------------------------------------------
>
>                 Key: MPMD-121
>                 URL: http://jira.codehaus.org/browse/MPMD-121
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: win32
>            Reporter: Hartmut Obendorf
>
> {code:java}
>     private String getLocationTemp( String name )
>     {
>         String loc = name;
>         if ( loc.indexOf( '/' ) != -1 )
>         {
>             loc = loc.substring( loc.lastIndexOf( '/' ) + 1 );
>         }
>         if ( loc.indexOf( '\\' ) != -1 )
>         {
>             loc = loc.substring( loc.lastIndexOf( '\\' ) + 1 );
>         }
>         getLog().debug( "Before: " + name + " After: " + loc );
>         return loc;
>     }
> {code}
> should encode the URL, so that characters such as ? or & do not prevent creating a local file
> Fix suggestion: add following code line before log output:
> {code:java}
> loc = URLEncoder.encode(loc, "UTF-8");
> {code}

-- 
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