matthiasblaesing opened a new pull request, #9070:
URL: https://github.com/apache/netbeans/pull/9070

   Example:
   
   ```java
   import java.io.ByteArrayOutputStream;
   import java.io.InputStream;
   
   public class Test {
   
       public static byte[] test(InputStream input) throws Exception {
           ByteArrayOutputStream outStream = new ByteArrayOutputStream();
           int len;
   
           byte[] buffer = new byte[1024];
   
           while ((len = input.read(buffer)) != -1) {
               outStream.write(buffer, 0, len);
           }
           input.close();
   
           return outStream.toByteArray();
       }
   }
   ```
   
   ```java
   import java.io.ByteArrayOutputStream;
   import java.io.InputStream;
   
   public class Test {
   
       public static byte[] test(InputStream input) throws Exception {
           try (input) {
               outStream = new ByteArrayOutputStream();
               int len;
               byte[] buffer = new byte[1024];
               while ((len = input.read(buffer)) != -1) {
                   outStream.write(buffer, 0, len);
               }
           }
   
           return outStream.toByteArray();
       }
   }
   ```
   
   Problem is here, that the result variable is used outside the new try block, 
but the declaration is not written.
   
   Closes: #9046
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to