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

Not so helpful exceptions thrown when invalid commits are specified #192

Closed
lordofthejars opened this Issue Sep 26, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@lordofthejars
Member

lordofthejars commented Sep 26, 2017

Issue Overview

If you configure Smart Testing and create a job in Jenkins, the first time you run since there is no previous commit registered in Jenkins, next command is executed:

mvn '-Dsmart.testing=new, affected' -Dsmart.testing.mode=ordering -Dscm.range.head=2c5121ba00ac0f94c2bd24e22cc9d7c2f55c9790 -Dscm.range.tail=null test
which is translated to a Null Pointer Exception:

Caused by: java.lang.NullPointerException
	at org.eclipse.jgit.internal.storage.file.UnpackedObjectCache$Table.index(UnpackedObjectCache.java:146)
	at org.eclipse.jgit.internal.storage.file.UnpackedObjectCache$Table.contains(UnpackedObjectCache.java:109)
	at org.eclipse.jgit.internal.storage.file.UnpackedObjectCache.isUnpacked(UnpackedObjectCache.java:64)
	at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObject(ObjectDirectory.java:414)
	at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:159)
	at org.eclipse.jgit.treewalk.CanonicalTreeParser.reset(CanonicalTreeParser.java:214)
	at org.arquillian.smart.testing.scm.git.GitChangeResolver.retrieveCommitsChanges(GitChangeResolver.java:130)
	at org.arquillian.smart.testing.scm.git.GitChangeResolver.diff(GitChangeResolver.java:73)
	at org.arquillian.smart.testing.scm.git.GitChangeResolver.diff(GitChangeResolver.java:31)

Maybe it will be worth to detect this null pointer exception and throw an IllegalArgumentExceptionexplaining the reason.

Expected Behaviour

Throw Illegal Argument Exception.

Current Behaviour

Throws a Null Pointer Exception without explaining why.

@lordofthejars lordofthejars added this to the 0.0.2 milestone Sep 26, 2017

lordofthejars added a commit to lordofthejars/smart-testing that referenced this issue Sep 26, 2017

@lordofthejars lordofthejars self-assigned this Sep 26, 2017

@bartoszmajsak bartoszmajsak changed the title from NullPointerException thrown when invalid commit to Not so helpful exceptions thrown when invalid commits are specified Sep 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment