Skip to content

Commit

Permalink
[FindBugs] Resolve NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
Browse files Browse the repository at this point in the history
Possible null pointer dereference in com.vexus2.jenkins.chatwork.jenkinschatworkplugin.ChatworkPublisher.createExtraVariables() due to return value of called method
  • Loading branch information
sue445 committed Nov 10, 2016
1 parent 34ddec3 commit 506dfc7
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.vexus2.jenkins.chatwork.jenkinschatworkplugin.api.ChatworkClient;
import com.vexus2.jenkins.chatwork.jenkinschatworkplugin.api.Room;
import com.vexus2.jenkins.chatwork.jenkinschatworkplugin.api.RoomComparator;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.Launcher;
import hudson.model.AbstractBuild;
Expand Down Expand Up @@ -50,6 +51,7 @@ public class ChatworkPublisher extends Publisher {
private final Boolean notifyOnNotBuilt;
private final Boolean notifyOnAborted;

@NonNull
private transient AbstractBuild build;
private transient BuildListener listener;

Expand Down Expand Up @@ -232,11 +234,16 @@ private Map<String, String> createExtraVariables() {
variables.put("PAYLOAD_SUMMARY", analyzePayload(payloadJson));
}

variables.put("BUILD_RESULT", build.getResult().toString());
variables.put("BUILD_RESULT", getBuildResult().toString());

return variables;
}

@NonNull
private Result getBuildResult() {
return build.getResult();
}

private static String analyzePayload(String payloadJson) {
JSONObject json;
try{
Expand Down

0 comments on commit 506dfc7

Please sign in to comment.