[jira] Created: (EMAIL-71) Email.getHostName() throws NullPointerException

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (EMAIL-71) Email.getHostName() throws NullPointerException

ASF GitHub Bot (Jira)
Email.getHostName() throws NullPointerException
-----------------------------------------------

                 Key: EMAIL-71
                 URL: https://issues.apache.org/jira/browse/EMAIL-71
             Project: Commons Email
          Issue Type: Bug
    Affects Versions: 1.1
            Reporter: Teemu Lång
            Priority: Minor


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 for getSmtpPort() and getSslSmtpPort().

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (EMAIL-71) Email.getHostName() throws NullPointerException

ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/EMAIL-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Teemu Lång updated EMAIL-71:
----------------------------

    Description:
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().

  was:
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 for getSmtpPort() and getSslSmtpPort().


> Email.getHostName() throws NullPointerException
> -----------------------------------------------
>
>                 Key: EMAIL-71
>                 URL: https://issues.apache.org/jira/browse/EMAIL-71
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Teemu Lång
>            Priority: Minor
>
> 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().

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (EMAIL-71) Email.getHostName() throws NullPointerException

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/EMAIL-71?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555264#action_12555264 ]

Henri Yandell commented on EMAIL-71:
------------------------------------

Confirmed - question being, return null or throw an IllegalStateException?

> Email.getHostName() throws NullPointerException
> -----------------------------------------------
>
>                 Key: EMAIL-71
>                 URL: https://issues.apache.org/jira/browse/EMAIL-71
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Teemu Lång
>            Priority: Minor
>
> 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().

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (EMAIL-71) Email.getHostName() throws NullPointerException

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/EMAIL-71?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614399#action_12614399 ]

Carsten Ziegeler commented on EMAIL-71:
---------------------------------------

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.

> Email.getHostName() throws NullPointerException
> -----------------------------------------------
>
>                 Key: EMAIL-71
>                 URL: https://issues.apache.org/jira/browse/EMAIL-71
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Teemu Lång
>            Priority: Minor
>
> 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().

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (EMAIL-71) Email.getHostName() throws NullPointerException

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/EMAIL-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Corey Scott updated EMAIL-71:
-----------------------------

    Attachment: EMAIL-71-patch.txt

> Email.getHostName() throws NullPointerException
> -----------------------------------------------
>
>                 Key: EMAIL-71
>                 URL: https://issues.apache.org/jira/browse/EMAIL-71
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Teemu Lång
>            Priority: Minor
>         Attachments: EMAIL-71-patch.txt
>
>
> 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().

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (EMAIL-71) Email.getHostName() throws NullPointerException

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/EMAIL-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Siegfried Goeschl updated EMAIL-71:
-----------------------------------

    Fix Version/s: 1.2

> Email.getHostName() throws NullPointerException
> -----------------------------------------------
>
>                 Key: EMAIL-71
>                 URL: https://issues.apache.org/jira/browse/EMAIL-71
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Teemu Lång
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>             Fix For: 1.2
>
>         Attachments: EMAIL-71-patch.txt
>
>
> 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().

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (EMAIL-71) Email.getHostName() throws NullPointerException

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/EMAIL-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Siegfried Goeschl resolved EMAIL-71.
------------------------------------

    Resolution: Fixed

Reviews and applied the patch - thanks to Corey Scott again ...

> Email.getHostName() throws NullPointerException
> -----------------------------------------------
>
>                 Key: EMAIL-71
>                 URL: https://issues.apache.org/jira/browse/EMAIL-71
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Teemu Lång
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>             Fix For: 1.2
>
>         Attachments: EMAIL-71-patch.txt
>
>
> 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().

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.