[jcifs] NullPointerException

eglass1 at comcast.net eglass1 at comcast.net
Fri Jun 4 09:30:14 GMT 2004


> Dear all,
> I am new to the jcifs, to the point that I have not managed running even 
> the examples:
> 
> java -Djcifs.properties=jcifs.prp -classpath ..\jcifs-0.9.1.jar;. FileInfo 
> O:\SQLNET\TNSNAMES.ORA 1
>            toURL: o:\SQLNET\TNSNAMES.ORA
> Exception in thread "main" java.lang.NullPointerException
>         at jcifs.smb.SmbFile.getName(SmbFile.java:884)
>         at FileInfo.main(FileInfo.java:49)
> 
> java -Djcifs.properties=jcifs.prp -  -classpath ..\jcifs-0.9.1.jar;. 
> FileInfo "\\server\my folder\my programs\SQLNET\TNSNAMES.ORA" 1
> Exception in thread "main" java.net.MalformedURLException: no protocol: 
> \\server\my folder\my programs\SQLNET\TNSNAMES.ORA
>         at java.net.URL.<init>(URL.java:579)
>         at jcifs.smb.SmbFile.<init>(SmbFile.java:436)
>         at FileInfo.main(FileInfo.java:33)
> 

The file would be specified as an "smb:" URL.  For example:

    smb://server/share/my folder/my programs/SQLNEt/TNSNAMES.ORA

As a side note, it might be useful to have the SmbFile constructor check
for a leading "\\" in the string argument; if present, convert:

    \\server\share\dir\file

to

    smb://server/share/dir/file

This would provide a more direct "drop-in" replacement (as java.io.File allows
UNC names on Windows).


Eric




More information about the jcifs mailing list