[jcifs] Bug in jcifs.netbios.NameServiceClient

Michael B Allen mba2000 at ioplex.com
Fri Feb 11 00:36:37 GMT 2005


Applied. Except instead of hunting down the NAE I stuck with the try/catch
but put it outside the while loop. The key is that the catch block will
call tryClose(). That will setup the client to reestablish the datagram
socket with subsequent requests. So if anything goes wrong (not just NAE)
it will log the exception and close the datagram socket so the client will
start fresh.

TBRRSN,
Mike

Michael B Allen said:
> Steve Herndon said:
>> Here is the diff:
>>
>> $ diff -c jcifs_1.1.6/src/jcifs/netbios/NameServiceClient.java
> <snip>
>> !                 synchronized( response ) {
>> !                     try {
>> !                         response.readWireFormat( rcv_buf, 0 );
>> !                     }
>> !                     catch (NegativeArraySizeException ex) {
>> !                         // Malformed packet. Ignore it
>> !                         continue;
>> !                     }
>> !                     response.received = true;
>
> So if you get a crappy packet it quits? Ok. I'll look at this. But I think
> it might be a shade wiser for readWireFormat not to throw a
> NegativeArraySizeException in the first place.
>
> Mike
>
>



More information about the jcifs mailing list