Description
 You are getting a violation that seems wrong for you for quality rule -  Close the outermost stream ASAP .
Observed in CAST AIP
Release
Yes/No
8.3.x(tick)
Observed on RDBMS
RDBMS
Yes/No
CSS (tick)
Step by Step Scenario
  1. Taking analysis and snapshot
  2. Observing a violation for 'Close the outermost stream ASAP' that seems to be wrong
Action Plan
  1. Check if you have closed the outermost stream both in the try block and in the finally block as shown in below source code. 
    Example -

    private void Writing() throws IOException {
          DataOutputStream out = null;
          try {
              out = new DataOutputStream(new FileOutputStream("data"));
              out.writeInt(666);
              out.writeUTF("Hello");
              out.close(); //close in the try block
             out = null;
         } finally {
              if (out != null) {
                  out.close(); // close in the finally blcok
              }
          } 

    This will lead to a violation because you are not using the right remediation pattern to close the outputstream as indicated in the remediation section.

  2. You should close it only once in the finally block without closing it in the try block. In other words, you should have instead.

     private void correctWriting() throws IOException {
        DataOutputStream out = null;
         try {
             out = new DataOutputStream(new FileOutputStream("data"));
             out.writeInt(666);
             out.writeUTF("Hello");
         } finally {
             if (out != null) {
                 out.close(); // FIX
             }
         }
         } 
Impact on Analysis Results and Dashboard

Impact of issue: Impact after applying solution: To be decided

Notes/comments
 Ticket # 3760