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

Fix exception when invoked from TFS Release Management (JENKINS-40283) #142

Merged
merged 1 commit into from
Dec 8, 2016

Conversation

davidstaheli
Copy link
Contributor

This addresses issue JENKINS-40283 that addresses a crash with the following stack trace:

java.lang.Error: java.net.URISyntaxException: Cannot parse Git URI-ish: The uri was empty or null
	at hudson.plugins.tfs.model.GitCodePushedEventArgs.getRepoURIish(GitCodePushedEventArgs.java:23)
	at hudson.plugins.tfs.CommitParameterAction.<init>(CommitParameterAction.java:20)
	at hudson.plugins.tfs.model.BuildCommand.contributeTeamBuildParameterActions(BuildCommand.java:227)
	at hudson.plugins.tfs.model.BuildCommand.perform(BuildCommand.java:110)

Tested as follows:

  1. mvn clean verify - All tests pass
  2. I verified failure with the above stack trace when the "Jenkins Queue Job" task invoked a Jenkins job from TFS Release Management. Then, I applied this code change and verified that the job ran successfully.

@AlexRukhlin
Copy link

LGTM

args.pushedBy = pushedBy;
final CommitParameterAction action = new CommitParameterAction(args);
actions.add(action);
if (repoUriString != null && !repoUriString.trim().isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Build.Repository.Uri present in the JSON payload and has an empty/null value or is it not present at all? For example, line 207 above checks if the map contains an entry with what resolves to the Build.Repository.Provider key.

Otherwise, might I recommend using org.apache.commons.lang.StringUtils.isNotBlank()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build.Repository.Uri is present in the JSON payload and ends up having a value of white space. So unfortunately, we can't use teamBuildParameters.containsKey(BUILD_REPOSITORY_URI). Great suggestion to use org.apache.commons.lang.StringUtils.isNotBlank(). I made that change. Does it look okay otherwise @olivierdagenais?

Copy link
Member

@olivierdagenais olivierdagenais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution, you may merge at your convenience.

@davidstaheli davidstaheli merged commit aa7b022 into master Dec 8, 2016
@davidstaheli davidstaheli deleted the users/davidstaheli/rm1 branch December 8, 2016 13:31
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.

3 participants