Skip to content

Commit

Permalink
[cleanup] Use bug instance instead of def
Browse files Browse the repository at this point in the history
  • Loading branch information
hazendaz committed Jan 21, 2025
1 parent 7cf8924 commit 45d4671
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.codehaus.mojo.spotbugs

import edu.umd.cs.findbugs.BugInstance
import groovy.xml.XmlParser
import groovy.xml.XmlSlurper

Expand Down Expand Up @@ -383,9 +384,9 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {

if (outputFile.exists()) {

def xml = new XmlParser().parse(outputFile)
Node xml = new XmlParser().parse(outputFile)

def bugs = xml.BugInstance
BugInstance bugs[] = xml.BugInstance as BugInstance[]
int bugCount = bugs.size()
log.info("BugInstance size is ${bugCount}")

Expand All @@ -410,7 +411,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {

int bugCountAboveThreshold = 0
for (i in 0..bugCount-1) {
def bug = bugs[i]
BugInstance bug = bugs[i]
int priorityNum = bug.'@priority' as Integer
String priorityName = SpotBugsInfo.spotbugsPriority[priorityNum]
String logMsg = priorityName + ': ' + bug.LongMessage.text() + SpotBugsInfo.BLANK + bug.SourceLine.'@classname' + SpotBugsInfo.BLANK +
Expand Down

0 comments on commit 45d4671

Please sign in to comment.