Skip to content

Commit

Permalink
Merge pull request #172 from jimklimov/fix-warnings
Browse files Browse the repository at this point in the history
Fix warnings exposed by PR #171
  • Loading branch information
jimklimov authored May 24, 2023
2 parents 300de10 + 2d3c72f commit 8b1df67
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
</developers>

<scm>
<connection>scm:git:git://github.com/${gitHubRepo}.git</connection>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/hudson/plugins/im/IMPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,10 @@ private boolean downstreamIsFirstInRangeTriggeredByUpstream(
AbstractBuild<?, ?> upstreamBuild, AbstractBuild<?, ?> downstreamBuild) {
RangeSet rangeSet = upstreamBuild.getDownstreamRelationship(downstreamBuild.getProject());

if (rangeSet.isEmpty()) {
if (rangeSet == null || rangeSet.isEmpty()) {
// should not happen
// In fact, getDownstreamRelationship() should never return "null"
// at all - but sometimes does at least in mock-enhanced test classes.
LOGGER.warning("Range set is empty. Upstream " + upstreamBuild + ", downstream " + downstreamBuild);
return false;
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/hudson/plugins/im/tools/BuildHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public static boolean isStillFailureOrUnstable(AbstractBuild<?, ?> build) {
*
* @deprecated use {@link Run#getPreviousSuccessfulBuild()}
*/
@Deprecated
public static AbstractBuild<?, ?> getPreviousSuccessfulBuild(AbstractBuild<?, ?> build) {
AbstractBuild<?, ?> previousBuild = build.getPreviousBuild();
while (previousBuild != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
* @deprecated only left here to deserialize old configs
*/
@Deprecated
public enum NotificationStrategy {

// Note that the order of the constants also specifies the display order!
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/hudson/plugins/im/IMPublisherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ public void before() throws IOException {

this.build = mock(AbstractBuild.class);
when(this.build.getResult()).thenReturn(Result.FAILURE);
when(build.getUpstreamRelationshipBuild(upstreamProject)).thenReturn(this.upstreamBuild);
when(this.build.getUpstreamRelationshipBuild(this.upstreamProject)).thenReturn(this.upstreamBuild);
Map<AbstractProject, Integer> upstreamBuilds = Maps.newHashMap();
upstreamBuilds.put(this.upstreamProject, -1); // number is unimportant, just needed to get the upstream projects
when(build.getUpstreamBuilds()).thenReturn(upstreamBuilds);
when(build.getParent()).thenReturn(this.project);
when(build.getNumber()).thenReturn(buildNumber);
when(this.build.getUpstreamBuilds()).thenReturn(upstreamBuilds);
when(this.build.getParent()).thenReturn(this.project);
when(this.build.getNumber()).thenReturn(this.buildNumber);

createPreviousNextRelationShip(this.previousBuild, this.build);

Expand Down

0 comments on commit 8b1df67

Please sign in to comment.