Skip to content

Fixed out of bounds exception#9

Closed
ghost wants to merge 1 commit intomasterfrom
unknown repository
Closed

Fixed out of bounds exception#9
ghost wants to merge 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Aug 1, 2018

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

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
Copy link
Contributor

simonbrandhof commented Aug 3, 2018

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

@ghost
Copy link
Author

ghost commented Aug 6, 2018

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

@simonbrandhof
Copy link
Contributor

Unit test added to this new pull request : #11
Will be merged soon.

@simonbrandhof
Copy link
Contributor

Meanwhile I close this PR. Thanks for the contribution.

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

Successfully merging this pull request may close these issues.

2 participants