Issue Details (XML | Word | Printable)

Key: EMAIL-71
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Siegfried Goeschl
Reporter: Teemu Lång
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Email

Email.getHostName() throws NullPointerException

Created: 16/Dec/07 12:08 AM   Updated: 24/Feb/09 10:22 PM
Return to search
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works EMAIL-71-patch.txt 2008-11-24 09:51 AM Corey Scott 1 kB

Resolution Date: 24/Feb/09 10:22 PM


 Description  « Hide
If setHostName() has not been called, getHostName() tries to return this.session.getProperty(MAIL_HOST). If mail session has not been created yet, this will throw a NullPointerException. getHostName() should check that this.session is not null before trying to access it.

The same applies to getSmtpPort() and getSslSmtpPort().



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henri Yandell added a comment - 02/Jan/08 08:00 AM
Confirmed - question being, return null or throw an IllegalStateException?

Carsten Ziegeler added a comment - 17/Jul/08 03:41 PM
I ran into the same problem today I think it should return null as it's just a getter method.
I wanted to use this method to check, if someone else has already set the host name and if not apply a default.

Siegfried Goeschl added a comment - 24/Feb/09 10:22 PM
Reviews and applied the patch - thanks to Corey Scott again ...