Closed naushniki closed 5 years ago
Hi @naushniki , which version of the plugin are you using?
Sonarqube version 6.7.3 Plugin version 1.4.0-SNAPSHOT
Can you try it with 1.5.0 or 1.6.0-SNAPSHOT?
Updated to ver. 1.5.0. Unfortunately, no visible difference.
Caused by: java.lang.NullPointerException
at org.sonar.plugins.stash.issue.MarkdownPrinter.fileNameList(MarkdownPrinter.java:147)
at org.sonar.plugins.stash.issue.MarkdownPrinter.formatTableList(MarkdownPrinter.java:137)
at org.sonar.plugins.stash.issue.MarkdownPrinter.printReportMarkdown(MarkdownPrinter.java:114)
at org.sonar.plugins.stash.StashRequestFacade.postAnalysisOverview(StashRequestFacade.java:68)
at org.sonar.plugins.stash.StashIssueReportingPostJob.postInfoAndPRsActions(StashIssueReportingPostJob.java:138)
at org.sonar.plugins.stash.StashIssueReportingPostJob.updateStashWithSonarInfo(StashIssueReportingPostJob.java:105)
at org.sonar.plugins.stash.StashIssueReportingPostJob.execute(StashIssueReportingPostJob.java:58)
I am not sure how the algorithm could end up in such a state... Do you know your way around java? I am interested in
issues
at the beginning of MarkdownPrinter.fileNameList()
allIssues
at the beginning of MarkdownPrinter.printReportMarkdown()
key()
, ruleKey()
, severity()
If I understand correctly, the plugin is ran on the server. Unfortunately, I can't run debugger on the server.
The plugin is installed into the server, and downloaded to the client and executed there.
So you could either attach a debugger to the client or try to insert some print
statements at these places.
Alternatively you can set the property "sonar.log.level=DEBUG" and see if you can get the infos from the log.
This is what happens inside fileNameList method
The value of issues at the beginning of MarkdownPrinter.fileNameList()
result = {AbstractMapBasedMultimap$RandomAccessWrappedList@18028} size = 6
0 = {DefaultPostJobContext$DefaultIssueWrapper@18031}
wrapped = {TrackedIssue@18057} "TrackedIssue[ruleKey=kotlin:S1451,key=01687B95680FB134F0,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 19:40:06 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18591} "kotlin:S1451"
key = "01687B95680FB134F0"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18594} "Wed Jan 23 19:40:06 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@18038}
1 = {DefaultPostJobContext$DefaultIssueWrapper@18032}
wrapped = {TrackedIssue@18055} "TrackedIssue[ruleKey=kotlin:S1451,key=01687B956919B13501,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 19:40:06 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18600} "kotlin:S1451"
key = "01687B956919B13501"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18603} "Wed Jan 23 19:40:06 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@18038}
2 = {DefaultPostJobContext$DefaultIssueWrapper@18033}
wrapped = {TrackedIssue@18053} "TrackedIssue[ruleKey=kotlin:S1451,key=01687B956775B134ED,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 19:40:06 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18609} "kotlin:S1451"
key = "01687B956775B134ED"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18612} "Wed Jan 23 19:40:06 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@18038}
3 = {DefaultPostJobContext$DefaultIssueWrapper@18034}
wrapped = {TrackedIssue@18051} "TrackedIssue[ruleKey=kotlin:S1451,key=01687B9569BBB13510,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 19:40:06 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18618} "kotlin:S1451"
key = "01687B9569BBB13510"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18621} "Wed Jan 23 19:40:06 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@18038}
4 = {DefaultPostJobContext$DefaultIssueWrapper@18035}
wrapped = {TrackedIssue@18049} "TrackedIssue[ruleKey=kotlin:S1451,key=01687B956961B13504,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 19:40:06 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18627} "kotlin:S1451"
key = "01687B956961B13504"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18630} "Wed Jan 23 19:40:06 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@18038}
5 = {DefaultPostJobContext$DefaultIssueWrapper@18036}
wrapped = {TrackedIssue@18037} "TrackedIssue[ruleKey=kotlin:S1451,key=01687B95699DB1350E,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 19:40:06 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18636} "kotlin:S1451"
key = "01687B95699DB1350E"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18639} "Wed Jan 23 19:40:06 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@18038}
Elements of allIssues at the beginning of MarkdownPrinter.printReportMarkdown()
result = {ArrayList@17920} size = 11
0 = {DefaultPostJobContext$DefaultIssueWrapper@17984}
wrapped = {TrackedIssue@17995} "TrackedIssue[ruleKey=squid:S00107,key=01687BAD432E4408D0,severity=MAJOR,startLine=76,startLineOffset=11,endLine=76,endLineOffset=36,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.java,message=Constructor has 9 parameters, which is greater than 7 authorized.]"
ruleKey = {RuleKey@18013} "squid:S00107"
repository = "squid"
rule = "S00107"
key = "01687BAD432E4408D0"
severity = "MAJOR"
startLine = {Integer@18016} 76
startLineOffset = {Integer@18017} 11
endLine = {Integer@18016} 76
endLineOffset = {Integer@18018} 36
gap = null
isNew = true
creationDate = {Date@18019} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Constructor has 9 parameters, which is greater than 7 authorized."
hashes = null
this$0 = {DefaultPostJobContext@17996}
1 = {DefaultPostJobContext$DefaultIssueWrapper@17985}
wrapped = {TrackedIssue@18150} "TrackedIssue[ruleKey=squid:UselessImportCheck,key=01687BAD45C84408F4,severity=MINOR,startLine=4,startLineOffset=0,endLine=4,endLineOffset=56,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.java,message=Remove this duplicated import.]"
ruleKey = {RuleKey@18152} "squid:UselessImportCheck"
repository = "squid"
rule = "UselessImportCheck"
key = "01687BAD45C84408F4"
severity = "MINOR"
startLine = {Integer@18155} 4
startLineOffset = {Integer@18111} 0
endLine = {Integer@18155} 4
endLineOffset = {Integer@18156} 56
gap = null
isNew = true
creationDate = {Date@18157} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Remove this duplicated import."
hashes = null
this$0 = {DefaultPostJobContext@17996}
2 = {DefaultPostJobContext$DefaultIssueWrapper@17986}
wrapped = {TrackedIssue@18135} "TrackedIssue[ruleKey=squid:UselessImportCheck,key=01687BAD45C84408F5,severity=MINOR,startLine=10,startLineOffset=0,endLine=10,endLineOffset=49,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.javax.xml.bind.annotation.XmlAccessorType'.]"
ruleKey = {RuleKey@18137} "squid:UselessImportCheck"
repository = "squid"
rule = "UselessImportCheck"
key = "01687BAD45C84408F5"
severity = "MINOR"
startLine = {Integer@18140} 10
startLineOffset = {Integer@18111} 0
endLine = {Integer@18140} 10
endLineOffset = {Integer@18141} 49
gap = null
isNew = true
creationDate = {Date@18142} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Remove this unused import 'javax.xml.bind.annotation.XmlAccessorType'."
hashes = null
this$0 = {DefaultPostJobContext@17996}
3 = {DefaultPostJobContext$DefaultIssueWrapper@17987}
wrapped = {TrackedIssue@18121} "TrackedIssue[ruleKey=squid:UselessImportCheck,key=01687BAD45C84408F6,severity=MINOR,startLine=11,startLineOffset=0,endLine=11,endLineOffset=41,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.javax.xml.bind.annotation.XmlType'.]"
ruleKey = {RuleKey@18123} "squid:UselessImportCheck"
repository = "squid"
rule = "UselessImportCheck"
key = "01687BAD45C84408F6"
severity = "MINOR"
startLine = {Integer@18017} 11
startLineOffset = {Integer@18111} 0
endLine = {Integer@18017} 11
endLineOffset = {Integer@18126} 41
gap = null
isNew = true
creationDate = {Date@18127} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Remove this unused import 'javax.xml.bind.annotation.XmlType'."
hashes = null
this$0 = {DefaultPostJobContext@17996}
4 = {DefaultPostJobContext$DefaultIssueWrapper@17988}
wrapped = {TrackedIssue@18105} "TrackedIssue[ruleKey=squid:UselessImportCheck,key=01687BAD45C84408F7,severity=MINOR,startLine=9,startLineOffset=0,endLine=9,endLineOffset=47,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.javax.xml.bind.annotation.XmlAccessType'.]"
ruleKey = {RuleKey@18107} "squid:UselessImportCheck"
repository = "squid"
rule = "UselessImportCheck"
key = "01687BAD45C84408F7"
severity = "MINOR"
startLine = {Integer@18110} 9
startLineOffset = {Integer@18111} 0
endLine = {Integer@18110} 9
endLineOffset = {Integer@18112} 47
gap = null
isNew = true
creationDate = {Date@18113} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Remove this unused import 'javax.xml.bind.annotation.XmlAccessType'."
hashes = null
this$0 = {DefaultPostJobContext@17996}
5 = {DefaultPostJobContext$DefaultIssueWrapper@17989}
wrapped = {TrackedIssue@18092} "TrackedIssue[ruleKey=kotlin:S1451,key=01687BAD444C4408DA,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18094} "kotlin:S1451"
repository = "kotlin"
rule = "S1451"
key = "01687BAD444C4408DA"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18097} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@17996}
6 = {DefaultPostJobContext$DefaultIssueWrapper@17990}
wrapped = {TrackedIssue@18079} "TrackedIssue[ruleKey=kotlin:S1451,key=01687BAD45504408EB,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18081} "kotlin:S1451"
repository = "kotlin"
rule = "S1451"
key = "01687BAD45504408EB"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18084} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@17996}
7 = {DefaultPostJobContext$DefaultIssueWrapper@17991}
wrapped = {TrackedIssue@18066} "TrackedIssue[ruleKey=kotlin:S1451,key=01687BAD43BE4408D7,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18068} "kotlin:S1451"
repository = "kotlin"
rule = "S1451"
key = "01687BAD43BE4408D7"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18071} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@17996}
8 = {DefaultPostJobContext$DefaultIssueWrapper@17992}
wrapped = {TrackedIssue@18053} "TrackedIssue[ruleKey=kotlin:S1451,key=01687BAD45ED4408FA,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18055} "kotlin:S1451"
repository = "kotlin"
rule = "S1451"
key = "01687BAD45ED4408FA"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18058} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@17996}
9 = {DefaultPostJobContext$DefaultIssueWrapper@17993}
wrapped = {TrackedIssue@18040} "TrackedIssue[ruleKey=kotlin:S1451,key=01687BAD45954408EE,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18042} "kotlin:S1451"
repository = "kotlin"
rule = "S1451"
key = "01687BAD45954408EE"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18045} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@17996}
10 = {DefaultPostJobContext$DefaultIssueWrapper@17994}
wrapped = {TrackedIssue@18027} "TrackedIssue[ruleKey=kotlin:S1451,key=01687BAD45CE4408F8,severity=BLOCKER,startLine=<null>,startLineOffset=<null>,endLine=<null>,endLineOffset=<null>,gap=<null>,isNew=true,creationDate=Wed Jan 23 20:06:10 MSK 2019,resolution=<null>,status=OPEN,assignee=<null>,componentKey=***.kt,message=Add or update the header of this file.]"
ruleKey = {RuleKey@18029} "kotlin:S1451"
repository = "kotlin"
rule = "S1451"
key = "01687BAD45CE4408F8"
severity = "BLOCKER"
startLine = null
startLineOffset = null
endLine = null
endLineOffset = null
gap = null
isNew = true
creationDate = {Date@18032} "Wed Jan 23 20:06:10 MSK 2019"
resolution = null
status = "OPEN"
assignee = null
componentKey = ***
message = "Add or update the header of this file."
hashes = null
this$0 = {DefaultPostJobContext@17996}
Oh. For some reason the stacktrace you reported initially showed, that the root of the NPE was in fileNameList()
in line 147.
The line is this: issues.sort(issueFormatComparator);
. The only way this can be the root source of an NPE would be for issues
to be null
.
However the stacktrace in your debugger show, that the NPE has its origin during the evaluation of the comparator.
This makes sense now.
The comparator blew up, because the .line()
of the issue was null
(because these were file-wide issues.
@naushniki Could you retry with the current master branch? I pushed https://github.com/AmadeusITGroup/sonar-stash/commit/57df3e618a2dccc5e66b7f1a66819a10e7d8814c which should fix this.
This helped. Thank you very much for this super fast fix!
You are welcome! There will be a bugfix release shortly.