History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1370
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Tom Schneider
Reporter: Konstantin Pribluda
Votes: 0
Watchers: 1
Operations

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

PicoObjectFactory produces singleton instances of validators & other stuff

Created: 20/Oct/06 07:41 AM   Updated: 06/Feb/07 11:13 PM
Component/s: Dispatch
Affects Version/s: 2.2.4
Fix Version/s: 2.2.5

Environment: Any


 Description  « Hide
( not sure this is in correct component )

There is a bug in PicoObjectFactory in buildBean().

Registering not found action/object in the container returned by actionsContaienrFactory is wrong, because
this object remains there for the whole request, and is reused when object of same class is being requested.

This leads to problems with (at least) validators - there will be only one instace for all fields which is quite wrong.

Patch is pretty easy:

if (action == null) {
            // The action wasn't registered. Attempt to instantiate it.
            MutablePicoContainer container = new DefaultPicoContainer(actionsContainer);
            container.registerComponentImplementation(actionClass);
            action = container.getComponentInstance(actionClass);
        }

( create subcontainer just for instantiation of this one object )

This error was taken over from nanocontainer ( I will fix it there too, as I have commit
privileges )




 All   Comments   Change History      Sort Order:
Konstantin Pribluda - [20/Oct/06 08:11 AM ]
While we are at it, actionContainerFactory returns mutable pico container,
though this should be vanilla one. ( but this bug is in nanowar - so mine )

Rule of thumb is: if it is not your container, do not touch it but
create subcontainer ;)


Tom Schneider - [06/Feb/07 11:13 PM ]
I have applied the changes outlined in this issue.