Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1829

Classloading bug in Reflections.java

    XMLWordPrintable

Details

    Description

      classforName() in org.jboss.weld.environment.servlet.util.Reflections.java can fail unnecessarily in an OSGi environment. Sometimes the thread context classloader is set, but the class to be loaded is on the bundle classloader, and not the thread context classloader. This code in classforName() below line 47

      if (tccl != null)

      { return (Class<T>) tccl.loadClass(name); }

      else

      { return (Class<T>) Class.forName(name); }

      should be replaced with,

      if (tccl != null) {
      try

      { return (Class<T>) tccl.loadClass(name); }

      catch (ClassNotFoundException e)

      { // could add debug trace here }

      catch (LinkageError e)

      { // debug trace here also }

      }
      return (Class<T>) Class.forName(name);

      Attachments

        Activity

          People

            mkouba@redhat.com Martin Kouba
            mpnuttall Mark Nuttall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: