Skip to content

Commit fd40e0b

Browse files
authored
Merge pull request #30 from fabio-franco/fix_for_null_pointer_during_callgraph_generation
Fix for null pointer during callgraph generation
2 parents 0eff763 + b7a301e commit fd40e0b

1 file changed

Lines changed: 23 additions & 19 deletions

File tree

src/main/java/com/ibm/minerva/analyzer/TableBuilder.java

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -652,26 +652,30 @@ private void resolveDuplicateClassMappings() {
652652
// Removing inner classes which the parent is an interface. This is important because we do not
653653
// give recommendations for interfaces, which result in inner classes without a parent in the table files.
654654
private void removeInnerClassesInsideInterfaces() {
655-
for (String innerClass:allInnerClasses) {
656-
int index = innerClass.lastIndexOf("$");
657-
if (index >= 0) {
658-
String parentFQCN = innerClass.substring(0,index-1);
659-
660-
if (allInterfaces.contains(parentFQCN)) {
661-
int parentNameIndex = parentFQCN.lastIndexOf(".");
662-
String compoundName = innerClass.substring(parentNameIndex+1);
663-
compoundName = compoundName.replace(".$", "::");
664-
665-
symTable.remove(compoundName);
666-
// refTable.remove // refTable is more complex because has different entries for the same class
667-
// but does not cause a fail in the process when the parent class of a inner class is not in the table
668-
fqcns.remove(innerClass);
669-
670-
logger.warning("The Class "+innerClass+" is defined inside an interface and will not be analyzed.");
671-
}
672-
}
655+
// if symTable is null there is nothing to check
656+
if (symTable != null) {
657+
for (String innerClass:allInnerClasses) {
658+
int index = innerClass.lastIndexOf("$");
659+
if (index >= 0) {
660+
String parentFQCN = innerClass.substring(0,index-1);
661+
662+
if (allInterfaces.contains(parentFQCN)) {
663+
int parentNameIndex = parentFQCN.lastIndexOf(".");
664+
String compoundName = innerClass.substring(parentNameIndex+1);
665+
compoundName = compoundName.replace(".$", "::");
666+
667+
if (symTable.has(compoundName)) {
668+
symTable.remove(compoundName);
669+
// refTable.remove // refTable is more complex because has different entries for the same class
670+
// but does not cause a fail in the process when the parent class of a inner class is not in the table
671+
fqcns.remove(innerClass);
672+
logger.warning("The Class "+innerClass+" is defined inside an interface and will not be analyzed.");
673+
}
674+
}
675+
}
676+
}
673677
}
674-
// deallocate global variable memories that will not be used anymore
678+
// deallocate global variable memories that will not be used anymore
675679
allInnerClasses.clear();
676680
allInterfaces.clear();
677681
}

0 commit comments

Comments
 (0)