You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Ilya A. Pimenov (JIRA)" <ji...@apache.org> on 2011/05/31 15:30:47 UTC
[jira] [Resolved] (OFBIZ-4280) Obsolete code in GenericDispatcher,
which leads to NullPointer when such Dispatcher was not created earlier
[ https://issues.apache.org/jira/browse/OFBIZ-4280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ilya A. Pimenov resolved OFBIZ-4280.
------------------------------------
Resolution: Fixed
Thank you!
> Obsolete code in GenericDispatcher, which leads to NullPointer when such Dispatcher was not created earlier
> -----------------------------------------------------------------------------------------------------------
>
> Key: OFBIZ-4280
> URL: https://issues.apache.org/jira/browse/OFBIZ-4280
> Project: OFBiz
> Issue Type: Bug
> Components: framework
> Affects Versions: SVN trunk
> Reporter: Ilya A. Pimenov
> Priority: Critical
>
> Please consider this method getLocalDispatcher(String.class, Delegator.class, Collection<URL>.class, ClassLoader.class, ServiceDispatcher.class).
> And take a look at this piece of code:
> --
> ServiceDispatcher sd = serviceDispatcher != null ? serviceDispatcher : ServiceDispatcher.getInstance(dispatcherName, delegator);
> LocalDispatcher thisDispatcher = null;
> if (sd != null) {
> dispatcher = sd.getLocalDispatcher(dispatcherName);
> }
> if (thisDispatcher == null) {
> dispatcher = new GenericDispatcher(dispatcherName, delegator, readerURLs, loader, sd);
> }
> --
> The if-block "if (sd != null)" is obsolete, since thisDispatcher will always be null in if-block "if (thisDispatcher == null)". But due to sd.getLocalDispatcher(dispatcherName) implementation:
> --
> return localContext.get(name).getDispatcher();
> --
> It may cause NullPointer exception, whenever localContext.get(name) returns null. For example this happens in case of using default JmsQueueListener implementation, while implementing jms-service in OFBiz-way.
> Just removing the if-block
> --
> if (sd != null) {
> dispatcher = sd.getLocalDispatcher(dispatcherName);
> }
> --
> Will fix the problem.
> Since this bug blocks implementing JMS-service, I believe it is atleast critical; since there is a workaround, but it's not very nice one.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira