[jcifs] SmbFile.listFiles with encoded Password

Doug Ward doug_ward at comcast.net
Wed Oct 20 00:04:04 GMT 2004


When I create a SmbFile with regular text username and password, the call 
SmbFile.listFiles() works fine, but when I have a password with encoded 
characters I get the SmbException "Network 
Error: //username:password at server/share

My code looks something like this

{
  SmbFile[] subDirs = null;
  String uName = "user";
  String password = "pass%word";
  String path = "server/share/";


  SmbFile f = new SmbFile("smb://" + URLEncoder.encode(uname) + ":" +   
URLEncoder.encode(password) + "@" + path);

  subDirs = f.listFiles();  // Exception thrown here

  ... 
}

Can anybody help me?

Doug Ward




More information about the jcifs mailing list