<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
<span class="Apple-style-span" style="background-color: rgb(255, 255, 255); "><div style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; "><span class="Apple-style-span" style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; background-color: rgb(255, 255, 255); ">Hello,</span></div><div style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; "><span class="Apple-style-span" style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; background-color: rgb(255, 255, 255); "><br></span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 255); "><font class="Apple-style-span" color="#555555" face="arial, helvetica, clean, sans-serif" size="2"><span class="Apple-style-span" style="line-height: 18px; white-space: pre-wrap;">I hope this is the right way to report a bug, if not my apologies.</span></font></span></div><font class="Apple-style-span" color="#555555" face="arial, helvetica, clean, sans-serif" size="2"><span class="Apple-style-span" style="line-height: 18px; white-space: pre-wrap;">
The problem is related with the implementation of the string.indexOf('@') method on Android API.
In the function NtlmPasswordAuthentication in the jcifs.smb.NtlmPasswordAuthentication.java class. when creating and authentication without the username or password ( = null) then the indexOf was generating the NullPointerException.
To solve the following issue i included a simple check on the username against null.
If im not mistaking this is needed when a GUEST connection is needed to the server.
/**
* Create an <tt>NtlmPasswordAuthentication</tt> object from a
* domain, username, and password. Parameters that are <tt>null</tt>
* will be substituted with <tt>jcifs.smb.client.domain</tt>,
* <tt>jcifs.smb.client.username</tt>, <tt>jcifs.smb.client.password</tt>
* property values.
*/
public NtlmPasswordAuthentication( String domain, String username, String password ) {
int ci;
</span></font><strong style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; font-style: inherit; font-weight: bold; "> if(username != null){</strong><font class="Apple-style-span" color="#555555" face="arial, helvetica, clean, sans-serif" size="2"><span class="Apple-style-span" style="line-height: 18px; white-space: pre-wrap;">
ci = username.indexOf('@');
if (ci > 0) {
domain = username.substring(ci + 1);
username = username.substring(0, ci);
} else {
ci = username.indexOf('\\');
if (ci > 0) {
domain = username.substring(0, ci);
username = username.substring(ci + 1);
}
}
</span></font><strong style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; font-style: inherit; font-weight: bold; "> }</strong><font class="Apple-style-span" color="#555555" face="arial, helvetica, clean, sans-serif" size="2"><span class="Apple-style-span" style="line-height: 18px; white-space: pre-wrap;">
this.domain = domain;
this.username = username;
this.password = password;
initDefaults();
if( domain == null ) this.domain = DEFAULT_DOMAIN;
if( username == null ) this.username = DEFAULT_USERNAME;
if( password == null ) this.password = DEFAULT_PASSWORD;
}</span></font></span><div><span class="Apple-style-span" style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; background-color: rgb(255, 255, 255); "><br></span></div><div><span class="Apple-style-span" style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; background-color: rgb(255, 255, 255); "><br></span></div><div><span class="Apple-style-span" style="color: rgb(85, 85, 85); font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: pre-wrap; background-color: rgb(255, 255, 255); ">--Paulo Louro</span></div> </div></body>
</html>