commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Ivankovits (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (VFS-88) HostFileNameParser fails extracting user info
Date Tue, 03 Oct 2006 17:53:21 GMT
     [ http://issues.apache.org/jira/browse/VFS-88?page=all ]

Mario Ivankovits resolved VFS-88.
---------------------------------

    Resolution: Won't Fix

You have to - or you can - encode the @ character with %40

It should work then.

> HostFileNameParser fails extracting user info
> ---------------------------------------------
>
>                 Key: VFS-88
>                 URL: http://issues.apache.org/jira/browse/VFS-88
>             Project: Commons VFS
>          Issue Type: Bug
>         Environment: any
>            Reporter: Vincentas Vienozinskis
>            Priority: Trivial
>
> class org.apache.commons.vfs.provider.HostFileNameParser fails to extract user infomation
from uri such as :
> ftp://user@somecompany:userpassword@sompny.site.com
> Note that 
> User name : user@somecompany
> Password : userpassword
> As above uri is valid it should be parsed without exceptions. To fix this first ':' should
be found instead of looking for '@' sign:
> fixed method :
>     /**
>      * Extracts the user info from a URI.  The scheme:// part has been removed
>      * already.
>      */
>     protected String extractUserInfo(final StringBuffer name)
>     {
>         final int maxlen = name.length();
>         
>         // First look for user info separator ':' then for '@'
>         boolean separatorFound = false;
>         for (int pos = 0; pos < maxlen; pos++)
>         {
>             final char ch = name.charAt(pos);
>             if (ch == ':') {
>                 separatorFound = true;
>             }
>             
>             if (ch == '@' && separatorFound)
>             {
>                 // Found the end of the user info
>                 String userInfo = name.substring(0, pos);
>                 name.delete(0, pos + 1);
>                 return userInfo;
>             }
>             if (ch == '/' || ch == '?')
>             {
>                 // Not allowed in user info
>                 break;
>             }
>         }
>         // Not found
>         return null;
>     }

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

        

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


Mime
View raw message