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 Priority: Minor 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]