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/11 12:08:47 UTC

[jira] [Created] (OFBIZ-4280) Obsolete code in GenericDispatcher, which leads to NullPointer when such Dispatcher was not created earlier

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

[jira] [Closed] (OFBIZ-4280) Obsolete code in GenericDispatcher, which leads to NullPointer when such Dispatcher was not created earlier

Posted by "Ilya A. Pimenov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-4280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ilya A. Pimenov closed OFBIZ-4280.
----------------------------------


Resolved in trunk.

> 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

[jira] [Resolved] (OFBIZ-4280) Obsolete code in GenericDispatcher, which leads to NullPointer when such Dispatcher was not created earlier

Posted by "Ilya A. Pimenov (JIRA)" <ji...@apache.org>.
     [ 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

[jira] [Commented] (OFBIZ-4280) Obsolete code in GenericDispatcher, which leads to NullPointer when such Dispatcher was not created earlier

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-4280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031927#comment-13031927 ] 

Jacques Le Roux commented on OFBIZ-4280:
----------------------------------------

Same comment than in OFBIZ-4279: Please check at http://svn.apache.org/viewvc?rev=1090961&view=rev and close if it's ok with 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