cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nhtzr <...@git.apache.org>
Subject [GitHub] cxf pull request #253: [CXF-7309] JAX-RS @Context fields throw NPE in OSGI h...
Date Wed, 05 Apr 2017 03:37:03 GMT
Github user nhtzr commented on a diff in the pull request:

    https://github.com/apache/cxf/pull/253#discussion_r109824786
  
    --- Diff: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
---
    @@ -1167,10 +1161,12 @@ public static void injectContextMethods(Object requestObject,
                     if (!cri.isSingleton()) {
                         InjectionUtils.injectThroughMethod(requestObject, method, o, message);
                     } else {
    -                    ThreadLocalProxy<Object> proxy 
    -                        = (ThreadLocalProxy<Object>)cri.getContextSetterProxy(method);
    +                    Object proxy = extractFromSetter(requestObject, method);
    +                    if (!(proxy instanceof ThreadLocalProxy)) {
    --- End diff --
    
    Hi! Sorry for the late response!
    
    The intention of this condition is to prevent NPE or ClassCastException that may happen
in case `extractFromSetter()` fails or in case it returns some completely unexpected value.
    The unexpected value could happen from the unfortunate coincidence in which a getter exists
but it doesn't follow a Bean Property pattern. 
    Another possibility would be the property being overwritten by code outside cxf (That
should be unlikely, but it is possible) and therefore no longer a proxy.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message