This is an automated email from the ASF dual-hosted git repository.

mbien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new ee2eb18a3c VisualDevelopmentUtil should close its streams.
     new 7cb0985514 Merge pull request #6172 from Alfusainey/issue-6165
ee2eb18a3c is described below

commit ee2eb18a3c0f97b4539eb69f390252c6fadb7ba4
Author: Alfusainey Jallow <alf.jal...@gmail.com>
AuthorDate: Mon Jul 10 09:12:30 2023 +0200

    VisualDevelopmentUtil should close its streams.
    
    Removed unused copy method.
    
    Signed-off-by: Alfusainey Jallow <alf.jal...@gmail.com>
---
 .../netbeans/qa/form/VisualDevelopmentUtil.java    | 30 +++-------------------
 1 file changed, 4 insertions(+), 26 deletions(-)

diff --git 
a/java/form/test/qa-functional/src/org/netbeans/qa/form/VisualDevelopmentUtil.java
 
b/java/form/test/qa-functional/src/org/netbeans/qa/form/VisualDevelopmentUtil.java
index d272be364b..94881675a9 100644
--- 
a/java/form/test/qa-functional/src/org/netbeans/qa/form/VisualDevelopmentUtil.java
+++ 
b/java/form/test/qa-functional/src/org/netbeans/qa/form/VisualDevelopmentUtil.java
@@ -19,36 +19,14 @@
 
 package org.netbeans.qa.form;
 
-import java.io.*;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 
 public class VisualDevelopmentUtil {
     public static String JAVA_VERSION = System.getProperty("java.version");
     
     public static String readFromFile(String filename) throws IOException   {
-        File f = new File(filename); 
-        int size = (int) f.length();        
-        int bytes_read = 0;
-        FileInputStream in = new FileInputStream(f);
-        byte[] data = new byte [size];
-        while(bytes_read < size)
-            bytes_read += in.read(data, bytes_read, size-bytes_read);
-        return new String(data);
+        return new String(Files.readAllBytes(Paths.get(filename)));
     }
-    
-    public static void copy(File src, File dst) throws IOException {
-            InputStream in = new FileInputStream(src);
-            OutputStream out = new FileOutputStream(dst);
-
-            // Transfer bytes from in to out
-            byte[] buf = new byte[1024];
-            int len;
-            while ((len = in.read(buf)) > 0) {
-                out.write(buf, 0, len);
-            }
-            in.close();
-            out.close();
-        }
-
-    
-    
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

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

Reply via email to