/hg/MauveTestCoverage: Make sure that report generator does not ...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Mon Aug 20 08:30:03 PDT 2012
changeset 50271ecf8de5 in /hg/MauveTestCoverage
details: http://icedtea.classpath.org/hg/MauveTestCoverage?cmd=changeset;node=50271ecf8de5
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Aug 20 17:32:13 2012 +0200
Make sure that report generator does not throw NPE.
diffstat:
ChangeLog | 5 +++++
src/ReportGenerator.java | 19 ++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diffs (48 lines):
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 <ptisnovs at redhat.com>
+
+ * src/ReportGenerator.java:
+ Make sure that report generator does not throw NPE.
+
2012-06-15 Pavel Tisnovsky <ptisnovs at redhat.com>
* 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<String, ClassInfo> classInfoMap)
{
+ // check if class is processed at all
+ if (!classInfoMap.containsKey(className))
+ {
+ return "";
+ }
Set<String> apiMethods = classInfoMap.get(className).getApiMethods();
Set<String> 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<String> apiMethods = classInfo.getApiMethods();
- Set<String> testedMethods = classInfo.getTestedMethods();
- Set<String> allMethods = classInfo.getAllMethods();
- createFileForClass(reportDirectory, testedClass, allMethods, apiMethods, testedMethods);
+ // tested class should exists
+ if (classInfoMap.containsKey(testedClass))
+ {
+ ClassInfo classInfo = classInfoMap.get(testedClass);
+ Set<String> apiMethods = classInfo.getApiMethods();
+ Set<String> testedMethods = classInfo.getTestedMethods();
+ Set<String> allMethods = classInfo.getAllMethods();
+ createFileForClass(reportDirectory, testedClass, allMethods, apiMethods, testedMethods);
+ }
}
}
More information about the distro-pkg-dev
mailing list