[jcifs] Having problem with simply connecting with release 1.2.9

Thomas Bley thomas.bley at simple-groupware.de
Wed May 10 05:03:21 GMT 2006


Hi,

I also had this Exception with listFiles() (no OutputStream).
When running with JRE, Cp850 is not supported and the 
NullpointerException comes up.
I'm using this code to decide the right encoding for jCIFS:

if (java.nio.charset.Charset.isSupported("IBM850")) { // JDK
  jcifs.Config.setProperty( "jcifs.encoding", "Cp850" );
} else { // JRE
  jcifs.Config.setProperty( "jcifs.encoding", "Cp1252" );
}

Using Cp1252 the German Umlaute are not working in shares names, but 
that's not so bad.

Best regards,
Thomas Bley


Michael B Allen wrote:
> On Mon, 24 Apr 2006 10:24:04 -0500
> "Dalton, Tim" <Daltontf at AGEDWARDS.com> wrote:
>
>   
>> The following beanshell code works just fine with 1.2.7:
>>
>> import jcifs.smb.*; 
>> import java.io.*;
>>
>> file = new SmbFile("smb://HOME;daltontf:xxxxxxx@tdms1.agedwards.com/root/home/daltontf/testsmb.txt");
>> smbout = new PrintStream(new SmbFileOutputStream(file, true));
>> smbout.println("This is a test - " + new java.util.Date().toString());
>> smbout.close();
>>
>> But with release 1.2.9, I get:
>>
>> java.lang.NullPointerException
>>         at jcifs.smb.SmbComSessionSetupAndX.writeParameterWordsWireFormat(SmbComSessionSetupAndX.java:58)
>>         at jcifs.smb.AndXServerMessageBlock.writeAndXWireFormat(AndXServerMessageBlock.java:94)
>>         at jcifs.smb.AndXServerMessageBlock.encode(AndXServerMessageBlock.java:65)
>>         at jcifs.smb.SmbTransport.doSend(SmbTransport.java:402)
>>         at jcifs.util.transport.Transport.sendrecv(Transport.java:70)
>>         at jcifs.smb.SmbTransport.send(SmbTransport.java:602)
>>         at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:269)
>>         at jcifs.smb.SmbSession.send(SmbSession.java:225)
>>         at jcifs.smb.SmbTree.treeConnect(SmbTree.java:147)
>>         at jcifs.smb.SmbFile.connect(SmbFile.java:791)
>>         at jcifs.smb.SmbFile.connect0(SmbFile.java:761)
>>         at jcifs.smb.SmbFile.queryPath(SmbFile.java:1167)
>>         at jcifs.smb.SmbFile.length(SmbFile.java:2160)
>>         at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:129)
>>         at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:97)
>>
>> Am I doing something fundamentally wrong ?
>>     
>
> No. The client should never throw a NullPointerException (except perhaps
> if an inappropriate null parameter is passed to a method). So there's a
> bug somewhere.
>
> The place where the exception is occuring indicates that
> NtlmPasswordAuthentication.accountPassword is null. Given the example
> code and the claim that this does not occur in 1.2.7 the only change
> that I think could have an impact is the jcifs.encoding default being
> changed to Cp850. But even then I don't see how this can happen. I could
> not reproduce the error using the attached example program.
>
> 1) Crank up jcifs.loglevel and see if there are any other exceptions
> 2) Try setting jcifs.encoding=ASCII or jcifs.encoding=Cp1252
>
> Otherwise, I can only guess that your report is inaccurate and that you
> are in fact setting other properties and/or the environemnt has changed
> and that the bug actually exists in 1.2.7 as well. In this case you will
> need to reanalyze and resubmit your issue.
>
> Also, is DFS somehow involved?
>
> Mike
>   



More information about the jcifs mailing list