[ 
https://issues.apache.org/jira/browse/CXF-7349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15987691#comment-15987691
 ] 

ASF GitHub Bot commented on CXF-7349:
-------------------------------------

GitHub user andymc12 opened a pull request:

    https://github.com/apache/cxf/pull/270

    CXF-7349: NPE when thread context classloader is null

    A null context classloader is valid - it means that the JVM's boot 
classloader is the context.  When using the ClassLoaderUtils class, there are a 
few places where we get the thread's context classloader, but don't check it 
for null before invoking methods on it - such as getResource/getResources/etc.
    
    This change ensures that we get a non-null classloader by using the system 
classloader when the current thread context classloader is null.  

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/andymc12/cxf NPE-ClassLoaderUtils

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cxf/pull/270.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #270
    
----
commit 751e63ac9fdf5752ae3956b84925ec91ea6e0253
Author: Andy McCright <j.andrew.mccri...@gmail.com>
Date:   2017-03-01T22:40:02Z

    Merge pull request #4 from apache/master
    
    update

commit eec3cd484749630e599732a082e45d60ef1d10d7
Author: Andy McCright <and...@us.ibm.com>
Date:   2017-04-05T14:48:33Z

    Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf

commit 8f38958d75d23edb9b711b6d9c77e663091412ab
Author: Andy McCright <and...@us.ibm.com>
Date:   2017-04-20T20:14:20Z

    Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf

commit cb14bf9ac392a7936aff08d7e54dd12720f8e733
Author: Andy McCright <and...@us.ibm.com>
Date:   2017-04-27T20:57:26Z

    Merge branch 'master' of https://github.com/apache/cxf

commit 7043ded41dc7484a9c47b38888a191ee70802c11
Author: Andy McCright <and...@us.ibm.com>
Date:   2017-04-27T21:09:55Z

    CXF-7349: Resolve NPE when TCCL is null

----


> NPE in ClassLoaderUtils
> -----------------------
>
>                 Key: CXF-7349
>                 URL: https://issues.apache.org/jira/browse/CXF-7349
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.1.11
>            Reporter: Andy McCright
>             Fix For: 3.2.0, 3.1.12
>
>
> A NullPointerException can be thrown when the JVM's boot classloader is set 
> as the thread's context classloader.  Ex:
> URL url = 
> Thread.currentThread().getContextClassLoader().getResource(resourceName);
> The call to getContextClassLoader() could return null - that is a valid 
> return from that method.  In that case, we should use 
> ClassLoader.getSystemClassLoader() instead.
> This issue was reported on in the users mailing list:
> http://cxf.547215.n5.nabble.com/NPE-in-cxf-core-ClassLoaderUtils-possible-bug-td5780007.html



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to