[jcifs] Null pointer exception in ServerMessageBlock.java

Jake Goulding goulding at vivisimo.com
Wed Jun 21 14:19:28 GMT 2006


I think I have figured this out, and I believe it has to do with the 
discrepancy of URL and URI and how things get encoded...

My password has a hash (#) in it. To see what happens, use this test 
program:

URL a = new URL("http://alpha;beta:gamma#@delta/foo/bar");
System.out.println("user " + a.getUserInfo());
System.out.println("host " + a.getHost());
System.out.println("path " + a.getPath());
System.out.println("ref " + a.getRef());

The results are:
user alpha;beta:gamma#
host delta
path
ref @delta/foo/bar

What is really strange is the fact that when I run my JCIFS stuff in a 
debugger, I do get a path, but it starts with the hash. For the above 
url, the path would look like "#@delta/foo/bar".

Obviously, this is not right... the question is where does this need to 
be fixed? Do I need to make sure that the user/domain/password are 
encoded before passing them off to JCIFS? Does JCIFS need to better 
support this? Am I not "allowed" to have a hash in my password?

Thanks!

Michael B Allen wrote:
> On Tue, 20 Jun 2006 17:24:48 -0400
> Jake Goulding <goulding at vivisimo.com> wrote:
>
>   
>> Thanks for the tip...
>>
>> I traced the null String back to line 828 of SmbFile.java:
>>
>> send( new SmbComNTCreateAndX( unc, flags, access, shareAccess, attrs, 
>> options, null ), response );
>>
>> unc is null here, so I added a call to getUncPath0() directly before the 
>> if statement. Tracing into the call to getUncPath0(), I see that the if( 
>> in[i] != '/' ) on line 986 is true, causing the function to return null. 
>> Looking at the url given, I see the path is "#@pdc/IPC$/lsarpc". The 
>>     
>
> That's not a valid path. The unc path should look like
> \\server\IPC$\lsarpc. The SMB url should look like
> smb://server/IPC$/lsarpc.
>
>   

-- 
Jake Goulding
Software Engineer
Vivísimo, Inc.

"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."



More information about the jcifs mailing list