Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.1
    • Fix Version/s: 2.4.2, 3.0.0
    • Component/s: None
    • Labels:
      None

      Description

      In InstrumentationFactory class at line 375 JarFile is not closed.

       private static boolean validateAgentJarManifest(File agentJarFile, Log log,
              String agentClassName) {
              try {
                  JarFile jar = new JarFile(agentJarFile);
                  Manifest manifest = jar.getManifest();
                  if (manifest == null) {
                      return false;
                  }
                  Attributes attributes = manifest.getMainAttributes();
                  String ac = attributes.getValue("Agent-Class");
                  if (ac != null && ac.equals(agentClassName)) {
                      return true;
                  }
              } catch (Exception e) {
                  if (log.isTraceEnabled() == true) {
                      log.trace(_name
                          + ".validateAgentJarManifest() caught unexpected "
                          + "exception " + e.getMessage());
                  }
              }
              return false;
          }
      

        Activity

        Hide
        ilgrosso Francesco Chicchiriccò added a comment -

        In [1], if you close the JarFile instance created on line 375, you will end up by closing the underlying agentJarFile: I would rather close it at the end of the getAgentJar() method in the same class.

        WDYT?

        [1] https://github.com/apache/openjpa/blob/2.4.x/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java

        Show
        ilgrosso Francesco Chicchiriccò added a comment - In [1] , if you close the JarFile instance created on line 375, you will end up by closing the underlying agentJarFile: I would rather close it at the end of the getAgentJar() method in the same class. WDYT? [1] https://github.com/apache/openjpa/blob/2.4.x/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1768194 from Mark Struberg in branch 'openjpa/branches/2.4.x'
        [ https://svn.apache.org/r1768194 ]

        OPENJPA-2674 properly close JarFile

        txs to Kaloyan Spiridonov for the catch!

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1768194 from Mark Struberg in branch 'openjpa/branches/2.4.x' [ https://svn.apache.org/r1768194 ] OPENJPA-2674 properly close JarFile txs to Kaloyan Spiridonov for the catch!
        Hide
        struberg Mark Struberg added a comment -

        txs for the catch!

        Show
        struberg Mark Struberg added a comment - txs for the catch!
        Hide
        jira-bot ASF subversion and git services added a comment -

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

        OPENJPA-2674 properly closing JarFile

        txs to Kaloyan Spiridonov for the catch!

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1768201 from Mark Struberg in branch 'openjpa/trunk' [ https://svn.apache.org/r1768201 ] OPENJPA-2674 properly closing JarFile txs to Kaloyan Spiridonov for the catch!
        Hide
        ilgrosso Francesco Chicchiriccò added a comment -

        Bulk close for 2.4.2

        Show
        ilgrosso Francesco Chicchiriccò added a comment - Bulk close for 2.4.2

          People

          • Assignee:
            struberg Mark Struberg
            Reporter:
            kal0ian Kaloyan Spiridonov
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development