Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7902835

JOL: ObjectShapes.processJAR should close resources properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • None
    • None
    • tools
    • jol

    Description

      SonarCloud instance reports the failures here:
       "Use try-with-resources or close this "URLClassLoader" in a "finally" clause."
       "Use try-with-resources or close this "JarFile" in a "finally" clause."

          private Multiset<String> processJAR(String jarName) {
              Multiset<String> shapes = new Multiset<>();
              try {
                  URLClassLoader cl = URLClassLoader.newInstance(new URL[]{new URL("jar:file:" + jarName + "!/")});
                 JarFile jarFile = new JarFile(jarName);

      Attachments

        Issue Links

          Activity

            People

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: