Skip to content

Commit

Permalink
Merge pull request #3 from levelops/prop-2199
Browse files Browse the repository at this point in the history
[PROP-2199] Fix: NoSuchMethod in JobRunParserService causing some jobs not to be reported
  • Loading branch information
ivan-levelops authored Nov 23, 2022
2 parents bb31ff7 + 4f91280 commit d9e29ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</profiles>

<properties>
<revision>1.0.22</revision>
<revision>1.0.23</revision>
<!-- <changelist>999999-SNAPSHOT</changelist> -->
<changelist></changelist>
<product.build.sourceEncoding>UTF-8</product.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import io.jenkins.plugins.propelo.commons.models.JobRunParam;
import io.jenkins.plugins.propelo.commons.models.JobTrigger;
import jenkins.model.Jenkins;

import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;

import java.io.File;
Expand Down Expand Up @@ -236,11 +238,11 @@ private String getUserCauseUser(final Cause cause){
case "UserIdCause":
Cause.UserIdCause userIdCause = (Cause.UserIdCause) cause;
LOGGER.finest("JobRunParserService::getUserCauseUser currentUser = " + userIdCause.getUserId());
return Objects.firstNonNull(userIdCause.getUserId(), ACL.ANONYMOUS_USERNAME);
return (String) ObjectUtils.defaultIfNull(userIdCause.getUserId(), ACL.ANONYMOUS_USERNAME);
case "UserCause":
Cause.UserCause userCause = (Cause.UserCause) cause;
LOGGER.finest("JobRunParserService::getUserCauseUser currentUser = " + userCause.getUserName());
return Objects.firstNonNull(userCause.getUserName(), ACL.ANONYMOUS_USERNAME);
return (String) ObjectUtils.defaultIfNull(userCause.getUserName(), ACL.ANONYMOUS_USERNAME);
default:
LOGGER.finest("JobRunParserService::getUserCauseUser currentUser = " + ACL.SYSTEM_USERNAME);
return ACL.SYSTEM_USERNAME;
Expand Down Expand Up @@ -310,6 +312,8 @@ private JobTrigger buildTriggerChain(final Object cause, File hudsonHome) {
case "RemoteCause":
triggerId = ((Cause.RemoteCause) cause).getAddr();
break;
case "GitHubPushCause":
LOGGER.info("GitHubPushCause, handling it as the SCMTriggerCause");
case "SCMTriggerCause":
triggerId = "SCMTrigger";
break;
Expand Down

0 comments on commit d9e29ca

Please sign in to comment.