Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-13113

NullPointerException if Thread.getContextClassLoader() returns null

    XMLWordPrintable

Details

    Description

      We just need to detect the null class loader and return null.

      This was originally discovered in a call stack like: -

      Caused by: java.lang.NullPointerException
      	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
      	at org.wildfly.security.auth.server.SecurityDomain.getCurrent(SecurityDomain.java:171)
      	at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:74)
      	at org.jboss.weld.tests.event.async.context.security.Printer$$$view2.print(Unknown Source)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      

      So in general calls where the context class loader is not set are at risk of this NPE, the fix is to simply check for null.

      Also ElytronXmlParser assumes it is always available.

      Attachments

        Issue Links

          Activity

            People

              darran.lofthouse@redhat.com Darran Lofthouse
              darran.lofthouse@redhat.com Darran Lofthouse
              Martin Svehla Martin Svehla
              Martin Svehla Martin Svehla
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: