Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotbugs: Not exact line number #2

Open
kekru opened this issue Aug 28, 2020 · 0 comments
Open

Spotbugs: Not exact line number #2

kekru opened this issue Aug 28, 2020 · 0 comments

Comments

@kekru
Copy link
Owner

kekru commented Aug 28, 2020

In Spotbugs, when we have the following BugInstance

<BugInstance type="DLS_DEAD_LOCAL_STORE" priority="2" rank="17" abbrev="DLS" category="STYLE" instanceHash="9de02933b5cbd2aceff52cb845612e0c" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="563">
    <ShortMessage>Dead store to local variable</ShortMessage>
    <LongMessage>Dead store to abc in new de.kekru.example.codeanalysisbb.Main()</LongMessage>
    <Class classname="de.kekru.example.codeanalysisbb.Main" primary="true">
      <SourceLine classname="de.kekru.example.codeanalysisbb.Main" start="13" end="33" sourcefile="Main.java" sourcepath="de/kekru/example/codeanalysisbb/Main.java" relSourcepath="java\de\kekru\example\codeanalysisbb\Main.java">
        <Message>At Main.java:[lines 13-33]</Message>
      </SourceLine>
      <Message>In class de.kekru.example.codeanalysisbb.Main</Message>
    </Class>
    ...
    <SourceLine classname="de.kekru.example.codeanalysisbb.Main" primary="true" start="23" end="23" startBytecode="33" endBytecode="33" sourcefile="Main.java" sourcepath="de/kekru/example/codeanalysisbb/Main.java" relSourcepath="java\de\kekru\example\codeanalysisbb\Main.java">
      <Message>At Main.java:[line 23]</Message>
    </SourceLine>
    ...
  </BugInstance>

Then currently we take BugInstance.Class.SourceLine.End = 33 as line number.
The exact line number would be BugInstance.SourceLine.End = 23.

So when line 33 is not changed, then Bitbucket will not annotate this finding.

Current problem is, that it seems, that the generated Java files from the XSD do not allow to navigate to BugInstance.SourceLine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant