You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@excalibur.apache.org by "Kazimierz Pogoda (JIRA)" <de...@excalibur.apache.org> on 2005/01/27 10:04:19 UTC

[jira] Created: (FORTRESS-14) FortressServiceSelector throws NullPointerException

FortressServiceSelector throws NullPointerException
---------------------------------------------------

         Key: FORTRESS-14
         URL: http://issues.apache.org/jira/browse/FORTRESS-14
     Project: Excalibur Fortress
        Type: Bug
  Components: Runtime  
 Environment: avalon-fortress-container-1.1.jar
    Reporter: Kazimierz Pogoda
    Priority: Minor


The select(Object) method of FortressServiceSelector throws NullPointerException if the specified hint object is null.

It looks like the orginal intent of this code was, to throw the ServiceException in such case. The private getHandler(Object) method throws IllegalArgumentException if the hint is null. Then it is cauth as general Exception, in the select(Object) method to throw specific ServiceException, but before that, in concatenation of name string, hint.toString() method is called and hint is null.

What is the rationale of explicitly called hint.toString() method in such situation? In described case avoiding toString() would prevent from this NullPointerException bug.

Here is my stack trace:
java.lang.NullPointerException
at org.apache.avalon.fortress.impl.lookup.FortressServiceSelector.select(FortressServiceSelector.java:82)
at pl.ncdc.avalon.service.DefaultExtendedServiceSelector.select(DefaultExtendedServiceSelector.java:68)
at pl.ncdc.pcm.service.DefaultActionExecutor.execute(DefaultActionExecutor.java:331)
at pl.ncdc.pcm.service.DefaultActionExecutor.access$700(DefaultActionExecutor.java:50)
at pl.ncdc.pcm.service.DefaultActionExecutor$Worker.run(DefaultActionExecutor.java:299)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org


[jira] Resolved: (FORTRESS-14) FortressServiceSelector throws NullPointerException

Posted by "Berin Loritsch (JIRA)" <de...@excalibur.apache.org>.
     [ http://issues.apache.org/jira/browse/FORTRESS-14?page=history ]
     
Berin Loritsch resolved FORTRESS-14:
------------------------------------

      Assign To: Berin Loritsch
     Resolution: Fixed
    Fix Version: 1.2

By changing the call "hint.toString()" to "String.valueOf(hint)", I was able to ensure the process of throwing an exception doesn't result in a NullPointerException

> FortressServiceSelector throws NullPointerException
> ---------------------------------------------------
>
>          Key: FORTRESS-14
>          URL: http://issues.apache.org/jira/browse/FORTRESS-14
>      Project: Excalibur Fortress
>         Type: Bug
>   Components: Runtime
>  Environment: avalon-fortress-container-1.1.jar
>     Reporter: Kazimierz Pogoda
>     Assignee: Berin Loritsch
>     Priority: Minor
>      Fix For: 1.2

>
> The select(Object) method of FortressServiceSelector throws NullPointerException if the specified hint object is null.
> It looks like the orginal intent of this code was, to throw the ServiceException in such case. The private getHandler(Object) method throws IllegalArgumentException if the hint is null. Then it is cauth as general Exception, in the select(Object) method to throw specific ServiceException, but before that, in concatenation of name string, hint.toString() method is called and hint is null.
> What is the rationale of explicitly called hint.toString() method in such situation? In described case avoiding toString() would prevent from this NullPointerException bug.
> Here is my stack trace:
> java.lang.NullPointerException
> at org.apache.avalon.fortress.impl.lookup.FortressServiceSelector.select(FortressServiceSelector.java:82)
> at pl.ncdc.avalon.service.DefaultExtendedServiceSelector.select(DefaultExtendedServiceSelector.java:68)
> at pl.ncdc.pcm.service.DefaultActionExecutor.execute(DefaultActionExecutor.java:331)
> at pl.ncdc.pcm.service.DefaultActionExecutor.access$700(DefaultActionExecutor.java:50)
> at pl.ncdc.pcm.service.DefaultActionExecutor$Worker.run(DefaultActionExecutor.java:299)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org