Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2575

wrong context class loader in org.apache.openjpa.enhance.PCClassFileTransformer#transform0

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.0
    • Component/s: None
    • Labels:
      None

      Description

      Hi

      if there is a temp loader in org.apache.openjpa.enhance.PCClassFileTransformer#transform0 then it should be the context where classes are loaded during the enhancement (transform0). typically "new Project().loadClass(new ByteArrayInputStream(bytes), _tmpLoader)" shouldn't be done outside of _tmpLoader contextual loader.

      Standard Thread.currentThread().setContextClassLoader(_tmpLoader); then setContextClassLoader(old) try/finally solves it.

      Side note: this issue has been reported originally on tomee@.

      1. OPENJPA-2575.patch
        3 kB
        Romain Manni-Bucau

        Activity

        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1671821 from Mark Struberg in branch 'openjpa/trunk'
        [ https://svn.apache.org/r1671821 ]

        OPENJPA-2575 temporary set TCCL to _tmpClassloader

        This prevents using the wrong ClassLoader during OpenJPA boostrap
        which might lead to mem leaks.

        Txs to rmannibucau for the report and fix!

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1671821 from Mark Struberg in branch 'openjpa/trunk' [ https://svn.apache.org/r1671821 ] OPENJPA-2575 temporary set TCCL to _tmpClassloader This prevents using the wrong ClassLoader during OpenJPA boostrap which might lead to mem leaks. Txs to rmannibucau for the report and fix!
        Hide
        struberg Mark Struberg added a comment -

        Applied.
        Txs to Romain for the report and fix!

        Show
        struberg Mark Struberg added a comment - Applied. Txs to Romain for the report and fix!

          People

          • Assignee:
            struberg Mark Struberg
            Reporter:
            romain.manni-bucau Romain Manni-Bucau
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development