mbien commented on code in PR #7070:
URL: https://github.com/apache/netbeans/pull/7070#discussion_r1491942708


##########
ide/git/test/unit/src/org/netbeans/modules/git/AbstractGitTestCase.java:
##########
@@ -233,41 +265,36 @@ protected final void runExternally (File workdir, 
List<String> command) throws E
         ProcessBuilder pb = new ProcessBuilder(command);
         pb.directory(workdir);
         Process p = pb.start();
-        final BufferedReader outReader = new 
BufferedReader(Channels.newReader(Channels.newChannel(p.getInputStream()), 
"UTF-8"));
-        final BufferedReader errReader = new 
BufferedReader(Channels.newReader(Channels.newChannel(p.getErrorStream()), 
"UTF-8"));
-        final List<String> output = new LinkedList<String>();
-        final List<String> err = new LinkedList<String>();
-        Thread t1 = new Thread(new Runnable() {
-            @Override
-            public void run () {
+        final List<String> err;
+        try (BufferedReader outReader = new 
BufferedReader(Channels.newReader(Channels.newChannel(p.getInputStream()), 
"UTF-8"))) {
+            BufferedReader errReader = new 
BufferedReader(Channels.newReader(Channels.newChannel(p.getErrorStream()), 
"UTF-8"));
+            @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
+            final List<String> output = new LinkedList<>();
+            err = new LinkedList<>();
+            Thread t1 = new Thread(() -> {
                 try {
                     for (String line = outReader.readLine(); line != null; 
line = outReader.readLine()) {
                         output.add(line);
                     }
                 } catch (IOException ex) {
-                    
+                    // Ignore

Review Comment:
   wondering if it would be better to fail the test on IOE?
   ```
       output.add(ex.getMessage());
   ```
   adding the msg to the list would fail the test a few lines later



##########
ide/git/nbproject/project.properties:
##########
@@ -29,8 +29,4 @@ test.config.stable.includes=**/*Test.class
 test.config.stableBTD.includes=**/*Test.class
 test.config.stableBTD.excludes=\
     **/ConnectTest.class,\
-    **/DiffTest.class,\
-    **/ExternalChangesTest.class,\
-    **/FilesystemInterceptorTest.class,\
-    **/getTopmostTest.class,\
-    **/MergeTest.class
+    **/ExternalChangesTest.class

Review Comment:
   i checked and `ide/git` tests aren't run atm.
   
   only found `ide/libs.git` and `ide/versioning*`. Since you fixed a lot of 
tests int he second commit, would you mind adding them near the `ide/libs.git` 
step to the workflow?
   
   I will move all versioning and git tests to the versioning job the next time 
I update the yaml, but for now lets keep them in the IDE job near `libs.git`.



##########
ide/git/test/unit/src/org/netbeans/modules/git/AbstractGitTestCase.java:
##########
@@ -233,41 +265,36 @@ protected final void runExternally (File workdir, 
List<String> command) throws E
         ProcessBuilder pb = new ProcessBuilder(command);
         pb.directory(workdir);
         Process p = pb.start();
-        final BufferedReader outReader = new 
BufferedReader(Channels.newReader(Channels.newChannel(p.getInputStream()), 
"UTF-8"));
-        final BufferedReader errReader = new 
BufferedReader(Channels.newReader(Channels.newChannel(p.getErrorStream()), 
"UTF-8"));
-        final List<String> output = new LinkedList<String>();
-        final List<String> err = new LinkedList<String>();
-        Thread t1 = new Thread(new Runnable() {
-            @Override
-            public void run () {
+        final List<String> err;
+        try (BufferedReader outReader = new 
BufferedReader(Channels.newReader(Channels.newChannel(p.getInputStream()), 
"UTF-8"))) {
+            BufferedReader errReader = new 
BufferedReader(Channels.newReader(Channels.newChannel(p.getErrorStream()), 
"UTF-8"));
+            @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
+            final List<String> output = new LinkedList<>();
+            err = new LinkedList<>();
+            Thread t1 = new Thread(() -> {
                 try {
                     for (String line = outReader.readLine(); line != null; 
line = outReader.readLine()) {
                         output.add(line);
                     }
                 } catch (IOException ex) {
-                    
+                    // Ignore
                 }
-            }
-        });
-        Thread t2 = new Thread(new Runnable() {
-            @Override
-            public void run () {
+            });
+            Thread t2 = new Thread(() -> {
                 try {
                     for (String line = errReader.readLine(); line != null; 
line = errReader.readLine()) {
                         err.add(line);
                     }
                 } catch (IOException ex) {
-                    
+                    // Ignore

Review Comment:
   same here



-- 
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