You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2018/09/14 06:25:45 UTC

groovy git commit: minor refactoring

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 8a612adc6 -> e16728b91


minor refactoring


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e16728b9
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e16728b9
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e16728b9

Branch: refs/heads/GROOVY_2_4_X
Commit: e16728b91601573ee18475ec5dee5355817f670c
Parents: 8a612ad
Author: Paul King <pa...@asert.com.au>
Authored: Fri Sep 14 16:25:37 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Fri Sep 14 16:25:37 2018 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/ant/GroovycTest.java     | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e16728b9/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java b/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
index e5c2fa8..ad19109 100644
--- a/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
+++ b/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
@@ -97,29 +97,30 @@ public class GroovycTest extends GroovyTestCase {
                 break;
             } catch (final FileNotFoundException fnfe) {
                 String message = "File " + result.getName() + " should have been created but wasn't.";
-                if (i == 0) {
-                    System.err.println(message);
-                    DefaultGroovyStaticMethods.sleep(this, 50L);
-                } else fail(message);
+                reportOrFail(i, message);
             } catch (final IOException ioe) {
                 String message = "Error reading file " + result.getName() + ".";
-                fail(message);
-                if (i == 0) System.err.println(message);
-                else fail(message);
+                reportOrFail(i, message);
             } finally {
                 if (null != fr) {
                     try {
                         fr.close();
                     } catch (IOException e) {
                         String message = "Error closing file reader: " + result.getName() + ".";
-                        if (i == 0) System.err.println(message);
-                        else fail(message);
+                        reportOrFail(i, message);
                     }
                 }
             }
         }
     }
 
+    private void reportOrFail(int i, String message) {
+        if (i == 0) {
+            System.err.println(message);
+            DefaultGroovyStaticMethods.sleep(this, 50L);
+        } else fail(message);
+    }
+
     public void testGroovycTest1_NoFork_NoClasspath() {
         ensureExecutes("GroovycTest1_NoFork_NoClasspath");
     }