You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Steve Ulrich (JIRA)" <ji...@apache.org> on 2009/03/17 11:10:50 UTC

[jira] Created: (DIRMINA-676) ObjectMBean throws NullPointerException when accessing non-existing attributes

ObjectMBean throws NullPointerException when accessing non-existing attributes
------------------------------------------------------------------------------

                 Key: DIRMINA-676
                 URL: https://issues.apache.org/jira/browse/DIRMINA-676
             Project: MINA
          Issue Type: Bug
          Components: Integration
    Affects Versions: 2.0.0-M4
            Reporter: Steve Ulrich
            Priority: Trivial


Currently when someone tries to access an attribute via JMX that doesn't exist, the ObjectMBean throws a NullPointerException.
It would be better to precheck if the attribute exists and throw an AttributeNotFoundException with a short info, like "Attribute <XYZ> doesn't not exist".

Stacktrace:
java.lang.NullPointerException
	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
	at MyTestClass.main(MyTestClass.java:12)
Exception in thread "main" javax.management.MBeanException
	at org.apache.mina.integration.jmx.ObjectMBean.throwMBeanException(ObjectMBean.java:849)
	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:173)
	at MyTestClass.main(MyTestClass.java:12)
Caused by: java.lang.NullPointerException
	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
	... 1 more


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


[jira] Commented: (DIRMINA-676) ObjectMBean throws NullPointerException when accessing non-existing attributes

Posted by "Ashish Paliwal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682965#action_12682965 ] 

Ashish Paliwal commented on DIRMINA-676:
----------------------------------------

Thanks for the patch Steve. Have added the error handling similar to setAttribute(), for consistency.

> ObjectMBean throws NullPointerException when accessing non-existing attributes
> ------------------------------------------------------------------------------
>
>                 Key: DIRMINA-676
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-676
>             Project: MINA
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.0.0-M4
>            Reporter: Steve Ulrich
>            Assignee: Ashish Paliwal
>            Priority: Trivial
>         Attachments: ObjectMBean.java.patch
>
>
> Currently when someone tries to access an attribute via JMX that doesn't exist, the ObjectMBean throws a NullPointerException.
> It would be better to precheck if the attribute exists and throw an AttributeNotFoundException with a short info, like "Attribute <XYZ> doesn't not exist".
> Stacktrace:
> java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	at MyTestClass.main(MyTestClass.java:12)
> Exception in thread "main" javax.management.MBeanException
> 	at org.apache.mina.integration.jmx.ObjectMBean.throwMBeanException(ObjectMBean.java:849)
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:173)
> 	at MyTestClass.main(MyTestClass.java:12)
> Caused by: java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	... 1 more

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


[jira] Updated: (DIRMINA-676) ObjectMBean throws NullPointerException when accessing non-existing attributes

Posted by "Steve Ulrich (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ulrich updated DIRMINA-676:
---------------------------------

    Attachment: ObjectMBean.java.patch

Patch (relative to integration-jmx project) added.

> ObjectMBean throws NullPointerException when accessing non-existing attributes
> ------------------------------------------------------------------------------
>
>                 Key: DIRMINA-676
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-676
>             Project: MINA
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.0.0-M4
>            Reporter: Steve Ulrich
>            Assignee: Ashish Paliwal
>            Priority: Trivial
>         Attachments: ObjectMBean.java.patch
>
>
> Currently when someone tries to access an attribute via JMX that doesn't exist, the ObjectMBean throws a NullPointerException.
> It would be better to precheck if the attribute exists and throw an AttributeNotFoundException with a short info, like "Attribute <XYZ> doesn't not exist".
> Stacktrace:
> java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	at MyTestClass.main(MyTestClass.java:12)
> Exception in thread "main" javax.management.MBeanException
> 	at org.apache.mina.integration.jmx.ObjectMBean.throwMBeanException(ObjectMBean.java:849)
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:173)
> 	at MyTestClass.main(MyTestClass.java:12)
> Caused by: java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	... 1 more

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


[jira] Assigned: (DIRMINA-676) ObjectMBean throws NullPointerException when accessing non-existing attributes

Posted by "Ashish Paliwal (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashish Paliwal reassigned DIRMINA-676:
--------------------------------------

    Assignee: Ashish Paliwal

> ObjectMBean throws NullPointerException when accessing non-existing attributes
> ------------------------------------------------------------------------------
>
>                 Key: DIRMINA-676
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-676
>             Project: MINA
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.0.0-M4
>            Reporter: Steve Ulrich
>            Assignee: Ashish Paliwal
>            Priority: Trivial
>
> Currently when someone tries to access an attribute via JMX that doesn't exist, the ObjectMBean throws a NullPointerException.
> It would be better to precheck if the attribute exists and throw an AttributeNotFoundException with a short info, like "Attribute <XYZ> doesn't not exist".
> Stacktrace:
> java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	at MyTestClass.main(MyTestClass.java:12)
> Exception in thread "main" javax.management.MBeanException
> 	at org.apache.mina.integration.jmx.ObjectMBean.throwMBeanException(ObjectMBean.java:849)
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:173)
> 	at MyTestClass.main(MyTestClass.java:12)
> Caused by: java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	... 1 more

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


[jira] Closed: (DIRMINA-676) ObjectMBean throws NullPointerException when accessing non-existing attributes

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny closed DIRMINA-676.
-------------------------------------


> ObjectMBean throws NullPointerException when accessing non-existing attributes
> ------------------------------------------------------------------------------
>
>                 Key: DIRMINA-676
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-676
>             Project: MINA
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.0.0-M4
>            Reporter: Steve Ulrich
>            Assignee: Ashish Paliwal
>            Priority: Trivial
>             Fix For: 2.0.0-M5
>
>         Attachments: ObjectMBean.java.patch
>
>
> Currently when someone tries to access an attribute via JMX that doesn't exist, the ObjectMBean throws a NullPointerException.
> It would be better to precheck if the attribute exists and throw an AttributeNotFoundException with a short info, like "Attribute <XYZ> doesn't not exist".
> Stacktrace:
> java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	at MyTestClass.main(MyTestClass.java:12)
> Exception in thread "main" javax.management.MBeanException
> 	at org.apache.mina.integration.jmx.ObjectMBean.throwMBeanException(ObjectMBean.java:849)
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:173)
> 	at MyTestClass.main(MyTestClass.java:12)
> Caused by: java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	... 1 more

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


[jira] Resolved: (DIRMINA-676) ObjectMBean throws NullPointerException when accessing non-existing attributes

Posted by "Ashish Paliwal (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashish Paliwal resolved DIRMINA-676.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0-RC1

Added check for unknown attribute, to avoid null pointer exception. The code checks if the attribute exist, if not an exception is thrown.

Files Modified
org.apache.mina.integration.jmx.ObjectMBean.java


> ObjectMBean throws NullPointerException when accessing non-existing attributes
> ------------------------------------------------------------------------------
>
>                 Key: DIRMINA-676
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-676
>             Project: MINA
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.0.0-M4
>            Reporter: Steve Ulrich
>            Assignee: Ashish Paliwal
>            Priority: Trivial
>             Fix For: 2.0.0-RC1
>
>         Attachments: ObjectMBean.java.patch
>
>
> Currently when someone tries to access an attribute via JMX that doesn't exist, the ObjectMBean throws a NullPointerException.
> It would be better to precheck if the attribute exists and throw an AttributeNotFoundException with a short info, like "Attribute <XYZ> doesn't not exist".
> Stacktrace:
> java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	at MyTestClass.main(MyTestClass.java:12)
> Exception in thread "main" javax.management.MBeanException
> 	at org.apache.mina.integration.jmx.ObjectMBean.throwMBeanException(ObjectMBean.java:849)
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:173)
> 	at MyTestClass.main(MyTestClass.java:12)
> Caused by: java.lang.NullPointerException
> 	at org.apache.mina.integration.jmx.ObjectMBean.getAttribute(ObjectMBean.java:168)
> 	... 1 more

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