[jcifs] there is a mistake in jcifs-1.2.9.jar about SmbFile constructor

Paul Ling drpaulling at msn.com
Sat Dec 9 01:08:24 GMT 2006


I think there is a mistake in jcifs-1.2.9.jar about SmbFile Constructor that 
accept a parent SmbFile and sub name as parameter, if the parent SmbFile has 
user password and the password include the charactors "%,?, 

The reason is at jcifs.smb.Handler.parseURL(), Line 94:
        try {
            userinfo = unescape( userinfo );
        } catch( UnsupportedEncodingException uee ) {

The userInfo of java.net.URL has been unescaped. it should not be unescape 
here again. BTW, the userInfo of java.net.URI is escaped.

Code Example:

URI uri = new URI("smb", "administrator:%?$ ;\\,./:#@*&!^()-+_=|~<>`", 
"", -1, "/record", null, null);
SmbFile smbfile = new SmbFile(uri.toASCIIString());
SmbFile subfile = new SmbFile(smbfile, "write.txt");

you will get the following exception:
java.net.MalformedURLException: For input string: "?$"
	at java.net.URL.<init>(URL.java:601)
	at jcifs.smb.SmbFile.<init>(SmbFile.java:457)

Paul Ling

FREE pop-up blocking with the new MSN Toolbar - get it now! 

More information about the jcifs mailing list