# HG changeset patch # User Pavel Tisnovsky # Date 1345476733 -7200 # Node ID 50271ecf8de583a739c91a13c456f67346614eae # Parent 7bb9210fb1924b5f83e1374aa09a42de12166424 Make sure that report generator does not throw NPE. diff -r 7bb9210fb192 -r 50271ecf8de5 ChangeLog --- a/ChangeLog Fri Jun 15 17:33:08 2012 +0200 +++ b/ChangeLog Mon Aug 20 17:32:13 2012 +0200 @@ -1,3 +1,8 @@ +2012-08-20 Pavel Tisnovsky + + * src/ReportGenerator.java: + Make sure that report generator does not throw NPE. + 2012-06-15 Pavel Tisnovsky * Makefile: diff -r 7bb9210fb192 -r 50271ecf8de5 src/ReportGenerator.java --- a/src/ReportGenerator.java Fri Jun 15 17:33:08 2012 +0200 +++ b/src/ReportGenerator.java Mon Aug 20 17:32:13 2012 +0200 @@ -406,6 +406,11 @@ */ private static String addOneRowToResultsTable(String reportDirectory, String className, Map classInfoMap) { + // check if class is processed at all + if (!classInfoMap.containsKey(className)) + { + return ""; + } Set apiMethods = classInfoMap.get(className).getApiMethods(); Set testedMethods = classInfoMap.get(className).getTestedMethods(); // compute number of all methods in a class @@ -616,11 +621,15 @@ // iterate through all tested classes for (String testedClass : testedClasses) { - ClassInfo classInfo = classInfoMap.get(testedClass); - Set apiMethods = classInfo.getApiMethods(); - Set testedMethods = classInfo.getTestedMethods(); - Set allMethods = classInfo.getAllMethods(); - createFileForClass(reportDirectory, testedClass, allMethods, apiMethods, testedMethods); + // tested class should exists + if (classInfoMap.containsKey(testedClass)) + { + ClassInfo classInfo = classInfoMap.get(testedClass); + Set apiMethods = classInfo.getApiMethods(); + Set testedMethods = classInfo.getTestedMethods(); + Set allMethods = classInfo.getAllMethods(); + createFileForClass(reportDirectory, testedClass, allMethods, apiMethods, testedMethods); + } } }