Skip to content

Commit

Permalink
* workaround of the nullpointer exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
MediaJunky committed Sep 1, 2019
1 parent 7ad1c40 commit 579d4d0
Showing 1 changed file with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,27 +171,31 @@ public boolean isFile() {

private void addComplexityFileMeasures(InputFile component, NodeList values) {
LOGGER.debug("File measures for {}",component.toString());
int complexity = Integer.parseInt(values.item(cyclomaticComplexityIndex).getTextContent());

context.<Integer>newMeasure()
.on(component)
.forMetric(CoreMetrics.COMPLEXITY)
.withValue(complexity)
.save();

int numberOfFunctions = Integer.parseInt(values.item(functionCountIndex).getTextContent());
context.<Integer>newMeasure()
.on(component)
.forMetric(CoreMetrics.FUNCTIONS)
.withValue(numberOfFunctions)
.save();

int numberOfLines = Integer.parseInt(values.item(lineCountIndex).getTextContent());
context.<Integer>newMeasure()
.on(component)
.forMetric(CoreMetrics.LINES)
.withValue(numberOfLines)
.save();
try {
int complexity = Integer.parseInt(values.item(cyclomaticComplexityIndex).getTextContent());

context.<Integer>newMeasure()
.on(component)
.forMetric(CoreMetrics.COMPLEXITY)
.withValue(complexity)
.save();

int numberOfFunctions = Integer.parseInt(values.item(functionCountIndex).getTextContent());
context.<Integer>newMeasure()
.on(component)
.forMetric(CoreMetrics.FUNCTIONS)
.withValue(numberOfFunctions)
.save();

int numberOfLines = Integer.parseInt(values.item(lineCountIndex).getTextContent());
context.<Integer>newMeasure()
.on(component)
.forMetric(CoreMetrics.LINES)
.withValue(numberOfLines)
.save();
} catch (Exception e) {
LOGGER.debug("unable to create complexity " + e.getMessage());
}
}

private void addComplexityFunctionMeasures(InputComponent component, NodeList values) {
Expand Down

0 comments on commit 579d4d0

Please sign in to comment.