You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Christian Schneider (JIRA)" <ji...@apache.org> on 2012/05/04 15:16:47 UTC

[jira] [Created] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Christian Schneider created ARIES-847:
-----------------------------------------

             Summary: Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
                 Key: ARIES-847
                 URL: https://issues.apache.org/jira/browse/ARIES-847
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
    Affects Versions: 0.4
            Reporter: Christian Schneider
             Fix For: 0.4


If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269721#comment-13269721 ] 

Sergey Beryozkin edited comment on ARIES-847 at 5/7/12 4:00 PM:
----------------------------------------------------------------

Check for 'null' is redundant. Instanceof will always return false if a left operand is null. I don't have a reference to the relevant JVM section to prove it :-), but it is true. Similarly, the string concatenation would convert a null object to 'null'.
                
      was (Author: sergey_beryozkin):
    Check for 'null' is redundant. Instanceof will always return false if a left operand is null. I don't have a reference to the relevant JVM section to prove it :-), but it is true. Similarly, the string concatenation would convert a null object to 'null.
                  
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

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

Christian Schneider updated ARIES-847:
--------------------------------------

    Attachment: aries-847-1.patch

Added Patch with check for null and also instanceof
                
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269751#comment-13269751 ] 

Sergey Beryozkin commented on ARIES-847:
----------------------------------------

Hi Christian, I think I'd stick to your original patch idea, i.e., return if the object is not of the expected type, both 'null' & diff type confitions seem to deserve the warning.
Throwing the exception looks reasonable too, but looking at the source of BeanRecipe.destroy suggests that the policy is to log and let the process the continue. 
I'm not familiar well enough with Aries yet so I'd be concerned that throwing an exception could affect the overall destroy process somehow... 
                
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

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

Sergey Beryozkin reassigned ARIES-847:
--------------------------------------

    Assignee: Sergey Beryozkin
    
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Posted by "Christian Schneider (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269717#comment-13269717 ] 

Christian Schneider commented on ARIES-847:
-------------------------------------------

Hi Sergey,

you did not include the check for null. How does the code behave if obj is null? Have you tested with a blueprint file that has errors? 


Christian

                
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Posted by "Christian Schneider (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269729#comment-13269729 ] 

Christian Schneider commented on ARIES-847:
-------------------------------------------

Sounds good. I am not sure if a warning is necessary in the null case though. I assume the obj is null in my case as the creation was not successful so the really interesting thing is the exception that is then thrown. The warning might rather confuse people in this case. Perhaps we could do the following:

if (obj == null) {
   return;
}

if (!(obj instanceof UnwrapperedBeanHolder)) {
  throw new IllegalArgumentException("Object to be destroyed is not an instance of UnwrapperedBeanHolder, type: " + obj.getClass());
}

So in case of null we do no warning as there is an exception anyway. In the case of a wrong type we could throw an exception as this really should not happen.

What do you think?

Christian
                
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269721#comment-13269721 ] 

Sergey Beryozkin commented on ARIES-847:
----------------------------------------

Check for 'null' is redundant. Instanceof will always return false if a left operand is null. I don't have a reference to the relevant JVM section to prove it :-), but it is true. Similarly, the string concatenation would convert a null object to 'null.
                
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Posted by "Christian Schneider (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269761#comment-13269761 ] 

Christian Schneider commented on ARIES-847:
-------------------------------------------

I agree
                
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

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

Sergey Beryozkin resolved ARIES-847.
------------------------------------

    Resolution: Fixed

Patch has been applied, thanks.
                
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269751#comment-13269751 ] 

Sergey Beryozkin edited comment on ARIES-847 at 5/7/12 4:32 PM:
----------------------------------------------------------------

Hi Christian, I think I'd stick to your original patch idea, i.e., return if the object is not of the expected type, both 'null' & diff type conditions seem to deserve the warning.
Throwing the exception looks reasonable too, but looking at the source of BeanRecipe.destroy suggests that the policy is to log and let the process the continue. 
I'm not familiar well enough with Aries yet so I'd be concerned that throwing an exception could affect the overall destroy process somehow... 
                
      was (Author: sergey_beryozkin):
    Hi Christian, I think I'd stick to your original patch idea, i.e., return if the object is not of the expected type, both 'null' & diff type confitions seem to deserve the warning.
Throwing the exception looks reasonable too, but looking at the source of BeanRecipe.destroy suggests that the policy is to log and let the process the continue. 
I'm not familiar well enough with Aries yet so I'd be concerned that throwing an exception could affect the overall destroy process somehow... 
                  
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ARIES-847) Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy

Posted by "Andreas Pieber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269498#comment-13269498 ] 

Andreas Pieber commented on ARIES-847:
--------------------------------------

I'm definitely +1 for this patch. It shows the hidden exceptions for me too.
                
> Nullpointer exception in org.apache.aries.blueprint.container.BeanRecipe.destroy
> --------------------------------------------------------------------------------
>
>                 Key: ARIES-847
>                 URL: https://issues.apache.org/jira/browse/ARIES-847
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 0.4
>            Reporter: Christian Schneider
>            Assignee: Sergey Beryozkin
>             Fix For: 0.4
>
>         Attachments: aries-847-1.patch
>
>
> If the blueprint file contains an error the obj given to destroy may be null. Currently this is not handled. The big problem in this case is that the user does not get a good error message about his error in the context.
> I will add a patch with the check.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira