SonarQube
  1. SonarQube
  2. SONAR-1666

Some Findbugs violations are missing in the Sonar web interface

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The Maven Findbugs plugin generates two XML reports in the target/ directory : findbugs.xml and findbugsXml.xml. The first one is the findbugs xdocs report used to generate the Maven site, and the second one is the "real" findbugs XML report.

      In some case some violations are missing in the findbugs xdocs report which is used by Sonar. Looks like this happens with related violations. For instance, in the following case, the first primary (primary='true') violation will be in the findbugs.xml file but not the secondary (role='SOURCE_LINE_ANOTHER_INSTANCE) violation :

      <SourceLine endBytecode='111' startBytecode='111' start='240' classname='com.bnpparibas.cib.zgh.client.swing.historic.HistoricDialog$ChercheAction' primary='true' sourcepath='com/bnpparibas/cib/zgh/client/swing/historic/HistoricDialog.java' sourcefile='HistoricDialog.java' end='240'><Message>At HistoricDialog.java:[line 240]</Message></SourceLine>
      
      
      <SourceLine endBytecode='159' startBytecode='159' start='244' classname='com.bnpparibas.cib.zgh.client.swing.historic.HistoricDialog$ChercheAction' sourcepath='com/bnpparibas/cib/zgh/client/swing/historic/HistoricDialog.java' role='SOURCE_LINE_ANOTHER_INSTANCE' sourcefile='HistoricDialog.java' end='244'><Message>Another occurrence at HistoricDialog.java:[line 244]</Message></SourceLine>
      

        Activity

        Hide
        Freddy Mallet added a comment - - edited

        Example of a BugInstance node in the findbugsXml.xml report file :

        <BugInstance category='BAD_PRACTICE' instanceHash='65c6770c9055a84db4899b95826e4edd' instanceOccurrenceNum='0' priority='2' abbrev='AM' type='AM_CREATES_EMPTY_ZIP_FILE_ENTRY' instanceOccurrenceMax='0'>
        	<ShortMessage>Creates an empty zip file entry</ShortMessage>
        	<LongMessage>Empty zip file entry created in org.sonar.commons.ZipUtils._zip(String, File, ZipOutputStream)</LongMessage>
        	<Class classname='org.sonar.commons.ZipUtils' primary='true'>
        		<SourceLine start='33' classname='org.sonar.commons.ZipUtils' sourcepath='org/sonar/commons/ZipUtils.java' sourcefile='ZipUtils.java' end='139'>
        			<Message>At ZipUtils.java:[lines 33-139]</Message>
        		</SourceLine>
        		<Message>In class org.sonar.commons.ZipUtils</Message>
        	</Class>
        	<Method isStatic='true' classname='org.sonar.commons.ZipUtils' name='_zip' primary='true' signature='(Ljava/lang/String;Ljava/io/File;Ljava/util/zip/ZipOutputStream;)V'>
        		<SourceLine endBytecode='353' startBytecode='0' start='103' classname='org.sonar.commons.ZipUtils' sourcepath='org/sonar/commons/ZipUtils.java' sourcefile='ZipUtils.java' end='124'></SourceLine>
        		<Message>In method org.sonar.commons.ZipUtils._zip(String, File, ZipOutputStream)</Message>
        	</Method>
        	<SourceLine endBytecode='42' startBytecode='42' start='107' classname='org.sonar.commons.ZipUtils' primary='true' sourcepath='org/sonar/commons/ZipUtils.java' sourcefile='ZipUtils.java' end='107'>
        		<Message>At ZipUtils.java:[line 107]</Message>
        	</SourceLine>
        </BugInstance>
        

        A BugInstance node can contain several SourceLine nodes.

        Show
        Freddy Mallet added a comment - - edited Example of a BugInstance node in the findbugsXml.xml report file : <BugInstance category='BAD_PRACTICE' instanceHash='65c6770c9055a84db4899b95826e4edd' instanceOccurrenceNum='0' priority='2' abbrev='AM' type='AM_CREATES_EMPTY_ZIP_FILE_ENTRY' instanceOccurrenceMax='0'> <ShortMessage>Creates an empty zip file entry</ShortMessage> <LongMessage>Empty zip file entry created in org.sonar.commons.ZipUtils._zip( String , File, ZipOutputStream)</LongMessage> < Class classname='org.sonar.commons.ZipUtils' primary=' true '> <SourceLine start='33' classname='org.sonar.commons.ZipUtils' sourcepath='org/sonar/commons/ZipUtils.java' sourcefile='ZipUtils.java' end='139'> <Message>At ZipUtils.java:[lines 33-139]</Message> </SourceLine> <Message>In class org.sonar.commons.ZipUtils</Message> </ Class > <Method isStatic=' true ' classname='org.sonar.commons.ZipUtils' name='_zip' primary=' true ' signature='(Ljava/lang/ String ;Ljava/io/File;Ljava/util/zip/ZipOutputStream;)V'> <SourceLine endBytecode='353' startBytecode='0' start='103' classname='org.sonar.commons.ZipUtils' sourcepath='org/sonar/commons/ZipUtils.java' sourcefile='ZipUtils.java' end='124'></SourceLine> <Message>In method org.sonar.commons.ZipUtils._zip( String , File, ZipOutputStream)</Message> </Method> <SourceLine endBytecode='42' startBytecode='42' start='107' classname='org.sonar.commons.ZipUtils' primary=' true ' sourcepath='org/sonar/commons/ZipUtils.java' sourcefile='ZipUtils.java' end='107'> <Message>At ZipUtils.java:[line 107]</Message> </SourceLine> </BugInstance> A BugInstance node can contain several SourceLine nodes.

          People

          • Assignee:
            Freddy Mallet
            Reporter:
            Freddy Mallet
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: