emilianbold commented on a change in pull request #295: Drop usage of 
FileInput/OutputStreams - modules a* -> c*
URL: https://github.com/apache/incubator-netbeans/pull/295#discussion_r153083681
 
 

 ##########
 File path: 
autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogCache.java
 ##########
 @@ -155,24 +156,24 @@ public void storeLicense(String name, String content) {
     
     private String readLicenseFile(String name) {
         File file = getLicenseFile(name);
-        FileInputStream fr = null;
+        InputStream is = null;
         synchronized (name.intern()) {
             try {
-                fr = new FileInputStream(file);
+                is = Files.newInputStream(file.toPath());
                 byte[] buffer = new byte[8192];
                 int n;
                 StringBuilder sb = new StringBuilder();
-                while ((n = fr.read(buffer)) != -1) {
+                while ((n = is.read(buffer)) != -1) {
                     sb.append(new String(buffer, 0, n, "utf-8"));//NOI18N
                 }
                 return sb.toString();
             } catch (IOException e) {
                 err.log(Level.INFO, "Can`t read license from file " + file, e);
                 return null;
             } finally {
-                if (fr != null) {
+                if (is != null) {
                     try {
-                        fr.close();
+                        is.close();
 
 Review comment:
   No try-with-resources here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to