[jcifs] NullPointerException]

Christopher R. Hertel crh at ubiqx.mn.org
Sat Jun 5 00:52:46 GMT 2004


Eric wrote:
> 
> >
> > I don't think we can do that. At least not consistently. Many of the
> > SmbFile constructors call the java.net.URL constructor in a way that would
> > make it difficult if not impossible to intercept this condition. I could
> > be wrong but I think it would probably introduce more trouble than it's
> > worth.
> >
> 
> It could be done fairly easily by replacing prior to passing the string
> to the URL constructor (see attached).  So you could do:
> 
>       SmbFile("\\\\server\\share\\dir\\file.txt");
> 
> or:
> 
>       SmbFile("\\\\user:password at server\\share\\");
> 
> or even "mix and match", i.e.:
> 
>       SmbFile("\\\\server\\", "share/dir/file.txt");
>       SmbFile("smb://server/share/", "dir\\file.txt");
> 
> Don't know if there is any actual real demand for any of this, though.

Side note:  the Samba smbclient tool also accepts UNC names of the form:
            //server/share/dir/file.txt

That rather nicely converts to an SMB URI simply by adding the "smb:" string
to the front end.  :)

I am of the opinion that we should be doing a little bit of work to "clean
up" SMB URI strings for the user, where possible.  As I understand it,
SmbFile() is closely tied to Sun's URI handling code, which doesn't make it
easy to do any sort of cleanup.

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the jcifs mailing list