geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r354842 - /geronimo/gbuild/trunk/gbuild-report/src/main/java/org/apache/geronimo/gbuild/report/SummaryReportUtil.java
Date Wed, 07 Dec 2005 20:14:11 GMT
Author: dblevins
Date: Wed Dec  7 12:14:07 2005
New Revision: 354842

URL: http://svn.apache.org/viewcvs?rev=354842&view=rev
Log:
Added better exception handling around parsing

Modified:
    geronimo/gbuild/trunk/gbuild-report/src/main/java/org/apache/geronimo/gbuild/report/SummaryReportUtil.java

Modified: geronimo/gbuild/trunk/gbuild-report/src/main/java/org/apache/geronimo/gbuild/report/SummaryReportUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-report/src/main/java/org/apache/geronimo/gbuild/report/SummaryReportUtil.java?rev=354842&r1=354841&r2=354842&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-report/src/main/java/org/apache/geronimo/gbuild/report/SummaryReportUtil.java
(original)
+++ geronimo/gbuild/trunk/gbuild-report/src/main/java/org/apache/geronimo/gbuild/report/SummaryReportUtil.java
Wed Dec  7 12:14:07 2005
@@ -39,8 +39,11 @@
             Map.Entry entry = (Map.Entry) caseIterator.next();
             String storeName = (String) entry.getKey();
             String storeValue = (String) entry.getValue();
+
             TestCase testCase = createTestcase(storeName, storeValue, newResult, reportFileLocator);
-            testcases.add(testCase);
+            if (testCase != null) {
+                testcases.add(testCase);
+            }
         }
         return testcases;
     }
@@ -55,37 +58,42 @@
     }
 
     private static TestCase createTestcase(String storeName, String storeValue, boolean newResult,
ReportFileLocator reportFileLocator) {
-        int index = storeName.lastIndexOf('#');
-        String name = storeName.substring(index + 1);
-        String classname = storeName.substring(0, index);
-        String reportFile = reportFileLocator.getReportFile(classname, name);
+        try {
+            int index = storeName.lastIndexOf('#');
+            String name = storeName.substring(index + 1);
+            String classname = storeName.substring(0, index);
+            String reportFile = reportFileLocator.getReportFile(classname, name);
 
-        char flag = storeValue.charAt(0);
-        index = storeValue.indexOf(')');
-        long time = Long.parseLong(storeValue.substring(3, index));
-        boolean failed;
-        boolean error;
-        String msg;
-        if (flag == 'P') {
-            failed = false;
-            error = false;
-            msg = "";
-        } else {
-            if (flag == 'F') {
-                failed = true;
-                error = false;
-            } else {
+            char flag = storeValue.charAt(0);
+            index = storeValue.indexOf(')');
+            long time = Long.parseLong(storeValue.substring(3, index));
+            boolean failed;
+            boolean error;
+            String msg;
+            if (flag == 'P') {
                 failed = false;
-                error = true;
-            }
-            if (storeValue.length() >= index + 2) {
-                msg = storeValue.substring(index + 2);
-            } else {
+                error = false;
                 msg = "";
+            } else {
+                if (flag == 'F') {
+                    failed = true;
+                    error = false;
+                } else {
+                    failed = false;
+                    error = true;
+                }
+                if (storeValue.length() >= index + 2) {
+                    msg = storeValue.substring(index + 2);
+                } else {
+                    msg = "";
+                }
             }
-        }
 
-        return new TestCase(name, classname, reportFile, time, failed, error, msg, newResult);
+            return new TestCase(name, classname, reportFile, time, failed, error, msg, newResult);
+        } catch (NumberFormatException e) {
+            System.out.println("FAILED TO PARSE - "+storeName +" = "+storeValue);
+            return null;
+        }
     }
 
     private static String getStoreName(TestCase testCase) {



Mime
View raw message