You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Marcos Sanz/Denic <sa...@denic.de> on 2003/01/06 16:33:50 UTC

NullPointerException in org.apache.james.smtpserver.SMTPHandler

Hi,

I have some NullPointerExceptions in my log file because of this line:

final String readCommandLine() throws IOException {
      return inReader.readLine().trim();
}

Wouldn't it be much smarter:

final String readCommandLine() throws IOException {
      String line = inReader.readLine();
      if (null == line)
            return null
      else
            return line.trim();
}

I don't think it breaks any code this way.

Regards,
Marcos Sanz
DENIC eG



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: NullPointerException in org.apache.james.smtpserver.SMTPHandler

Posted by Serge Knystautas <se...@lokitech.com>.
----- Original Message -----
From: "Marcos Sanz/Denic" <sa...@denic.de>


> Hi,
>
> I have some NullPointerExceptions in my log file because of this line:
>
> final String readCommandLine() throws IOException {
>       return inReader.readLine().trim();
> }
>
> Wouldn't it be much smarter:
>
> final String readCommandLine() throws IOException {
>       String line = inReader.readLine();
>       if (null == line)
>             return null
>       else
>             return line.trim();
> }
>
> I don't think it breaks any code this way.

Marcos,

Thanks, can you file this as a bug in bugzilla?

I'm planning to remove the use of the Reader since it creates a buffering
issue.  This will hopefully obviate the null pointer check.

Serge Knystautas
Loki Technologies
http://www.lokitech.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>