changeset 17:8d326a855021 draft

* src/ReportGenerator.java: Fixed an exception occuring when class list contains an empty line (usually at the end of file).
author Pavel Tisnovsky <ptisnovs@redhat.com>
date Thu, 24 May 2012 16:55:09 +0200
parents b6c8372f5723
children 6fb52e29ed29
files ChangeLog src/ReportGenerator.java
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed May 16 10:59:45 2012 +0200
+++ b/ChangeLog	Thu May 24 16:55:09 2012 +0200
@@ -1,3 +1,10 @@
+2012-05-24  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/ReportGenerator.java:
+	Fixed an exception occuring when class list
+	contains an empty line (usually at the end
+	of file).
+
 2012-05-16  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/ClassInfo.java:
--- a/src/ReportGenerator.java	Wed May 16 10:59:45 2012 +0200
+++ b/src/ReportGenerator.java	Thu May 24 16:55:09 2012 +0200
@@ -71,7 +71,15 @@
         // set of classes should be sorted
         Set<String> allClasses = new TreeSet<String>();
         // add all lines read from a file to a set (and sort them)
-        allClasses.addAll(fileContent);
+        // we have to exclude all empty lines
+        for (String className : fileContent)
+        {
+            // add only non empty lines
+            if (className != null && !className.trim().isEmpty())
+            {
+                allClasses.add(className.trim());
+            }
+        }
         return allClasses;
     }