[jcifs] jcifs bug -- null ptr if jcifs.properties missing

Mark Barton mbarton73 at gmail.com
Fri May 30 21:09:27 GMT 2008


I think that I encountered a bug in jcifs/Config.java, version 1.2.20 and I
don't know where else to report it.  My apologies if this is the wrong
forum.

In jcifs/Config.java, if the jcifs.properties file doesn't exist, then “in”
remains null, and a null pointer error is thrown below when in.close() is
attempted, or perhaps the line before that.  As a jCIFS newbie trying out a
simple Hello World program using a simple web.xml file for SSO
authentication, this had me stuck for a while.  The code snippet is below. 
The suggested fix is to test if in==null before executing these two lines: 
Config.load( in );
in.close();

Thanks,
Mark Barton

Here's the existing jcfis/Config.java, starting at line 61:

FileInputStream in = null;
log = LogStream.getInstance();

try {
    filename = System.getProperty( "jcifs.properties" );
    if( filename != null && filename.length() > 1 ) {
        in = new FileInputStream( filename );
    }
    Config.load( in );
    in.close();
} catch( IOException ioe ) {
   if( log.level > 0 )
        ioe.printStackTrace( log );
}

 


-- 
View this message in context: http://www.nabble.com/jcifs-bug----null-ptr-if-jcifs.properties-missing-tp17567993p17567993.html
Sent from the Samba - jcifs mailing list archive at Nabble.com.



More information about the jcifs mailing list