[jcifs] jcifs-0.6b6 Compiler Error and listFiles() bug

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Wed Jan 9 14:37:20 EST 2002


For some reason this wasn't caught by whatever version of javac I am using at home but I'm getting a compiler error now with 0.6b6:

    [javac] jcifs_0.6b6/src/jcifs/smb/SmbFile.java:393: Exception java.lang.Exception must be caught,
or it must be declared in the throws clause of this constructor.
    [javac]          uncPath = URLDecoder.decode( canonicalPath.replace( '/', '\\' ));

So decode() throws Exception. Change the end of the last SmbFile constructor to.

    390         if( canonicalPath == null ) {
    391             uncPath = "\\";
    392         } else {
    393             try {
    394                 uncPath = URLDecoder.decode( canonicalPath.replace( '/', '\\' ));
    395             } catch( Exception e ) {
    396                 throw new MalformedURLException( "URL decoding failed: " + canonicalPath );
    397             }
    398         }
    399     }

There's also a major problem with using listFiles() with a workgroup URL like listFiles( "smb://mygroup" ). Because the SmbFile constructor results in a name service query, jCIFS's trys to resolve
every hostname in the group which is pretty slow not to mention stupid. This renders listFiles() on a workgroup names pretty much useless (small workgroups should be ok for now).

Coupled with the null pointer exception and 1.1 issue's I'd say 0.6b6 is pretty much a dud :~(

Mike





More information about the jcifs mailing list