SonarQubeCommunity / sonar-scm-mercurial

SonarQube Mercurial plugin
4 stars 7 forks source link

Fixed out of bounds exception #9

Closed ThE-TiGeR closed 6 years ago

ThE-TiGeR commented 6 years ago

INFO: java.lang.ArrayIndexOutOfBoundsException: -1 INFO: at java.util.ArrayList.elementData(Unknown Source) INFO: at java.util.ArrayList.get(Unknown Source) INFO: at org.sonar.plugins.scm.mercurial.MercurialBlameCommand.blame(MercurialBlameCommand.java:104) INFO: at org.sonar.plugins.scm.mercurial.MercurialBlameCommand.access$000(MercurialBlameCommand.java:42) INFO: at org.sonar.plugins.scm.mercurial.MercurialBlameCommand$1.call(MercurialBlameCommand.java:83) INFO: at org.sonar.plugins.scm.mercurial.MercurialBlameCommand$1.call(MercurialBlameCommand.java:80)

This happens if blame fails (e.g. file not under version control) and the source file has only one line of code

simonbrandhof commented 6 years ago

Thanks for the contribution. Would it be possible to add a unit test ?

ThE-TiGeR commented 6 years ago

I have not done any unit tests with java until now, I also do not know how to run your unit tests

simonbrandhof commented 6 years ago

Unit test added to this new pull request : https://github.com/SonarSource/sonar-scm-mercurial/pull/11 Will be merged soon.

simonbrandhof commented 6 years ago

Meanwhile I close this PR. Thanks for the contribution.