Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: sloccount-plugin
    • Labels:
      None
    • Environment:
      Bug in code logic
    • Similar Issues:

      Description

      If an exception occurs before the stream is closed there will be a resource leak since close() won't be called. Use try-finally pattern.

          private void parse(java.io.File file, SloccountReportInterface report) throws IOException {
              InputStreamReader in = new InputStreamReader(new FileInputStream(file), encoding);
              this.parse(in, report);
              in.close();
          }
      

        Attachments

          Activity

          Show
          mixalturek Michal Turek added a comment - Fixed in https://github.com/mixalturek/sloccount-plugin/commit/22fe90021f243b01905e0b4c5ba6f5e03208ac9b .
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Michal Turek
          Path:
          src/main/java/hudson/plugins/sloccount/model/SloccountParser.java
          http://jenkins-ci.org/commit/sloccount-plugin/22fe90021f243b01905e0b4c5ba6f5e03208ac9b
          Log:
          JENKINS-21229 Possible resource leak in parser

          • If an exception occurs before the stream is closed there will be a resource leak since close() won't be called.
          • Solved using try-finally pattern.
          • Indentation fixed.
          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Michal Turek Path: src/main/java/hudson/plugins/sloccount/model/SloccountParser.java http://jenkins-ci.org/commit/sloccount-plugin/22fe90021f243b01905e0b4c5ba6f5e03208ac9b Log: JENKINS-21229 Possible resource leak in parser If an exception occurs before the stream is closed there will be a resource leak since close() won't be called. Solved using try-finally pattern. Indentation fixed.

            People

            • Assignee:
              mixalturek Michal Turek
              Reporter:
              mixalturek Michal Turek
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: