Issue Details (XML | Word | Printable)

Key: CHAIN-35
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Niall Pemberton
Reporter: Alonso Dominguez
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Chain

PathInfoMapper command can not obtain the current catalog instance

Created: 24/Apr/07 04:53 PM   Updated: 02/Jan/08 07:01 AM
Return to search
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

Environment: Simple web application using the org.apache.commons.chain.web.servlet.ChainProcessor servlet with the PathInfoMapper. No configuration parameters differ from defaults.

Resolution Date: 27/Apr/07 04:09 AM


 Description  « Hide
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.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.