You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2007/04/27 06:10:15 UTC

[jira] Resolved: (CHAIN-35) PathInfoMapper command can not obtain the current catalog instance

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

Niall Pemberton resolved CHAIN-35.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2
         Assignee: Niall Pemberton

Fixed by the solution to CHAIN-4 - PathInfoMapper (and RequestParamterMapper / ServletInfoMapper) now inherit from LookupCommand - which provides the ability to specify a "catalogName" attribute:

   http://svn.apache.org/viewvc?view=rev&revision=532951

Also added an example webapp for the three mapper commands (CHAIN-36):

  http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/apps/example/

> PathInfoMapper command can not obtain the current catalog instance
> ------------------------------------------------------------------
>
>                 Key: CHAIN-35
>                 URL: https://issues.apache.org/jira/browse/CHAIN-35
>             Project: Commons Chain
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: Simple web application using the org.apache.commons.chain.web.servlet.ChainProcessor servlet with the PathInfoMapper. No configuration parameters differ from defaults.
>            Reporter: Alonso Dominguez
>         Assigned To: Niall Pemberton
>            Priority: Minor
>             Fix For: 1.2
>
>
> I found a NPE in your implementation of the PathInfoMapper command.
> The exception is thrown when the PathInfoMapper tries to invoke the command he received from the request's pathInfo. This happens at following code:
> // Map to the Command specified by the extra path info
> Catalog catalog = (Catalog) context.get(getCatalogKey());
> Command command = catalog.getCommand(pathInfo);
> As you can see, the command tries to obtain the catalog using the "get" method from the context. The 'catalogKey' is defined to be the same as the one used by the ChainProcessor servlet:
> private String catalogKey = ChainProcessor.CATALOG_DEFAULT;
> The problem is that the catalog instance is set in the request scope, not inside the context instance. This is the piece of code from ChainProcessor that does that:
> if (attribute == null) {
>      request.setAttribute(CATALOG_DEFAULT, theCatalog);
> }
> So, the PathInfoMapper always obtains a null reference from the command's context when it tries to obtain a catalog instance. 

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


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