Skip to content

avoid some NPE on generateSnippet #192

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

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory;
import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
Expand Down Expand Up @@ -69,7 +70,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
Expand Down Expand Up @@ -249,7 +249,7 @@
*/
@Override
public TestResultAction.Data contributeTestData(
Run<?, ?> run, @Nonnull FilePath workspace, Launcher launcher, TaskListener listener, TestResult testResult)
Run<?, ?> run, @NonNull FilePath workspace, Launcher launcher, TaskListener listener, TestResult testResult)
throws IOException, InterruptedException {

EnvVars envVars = run.getEnvironment(listener);
Expand Down Expand Up @@ -795,6 +795,10 @@
}
}

if (jiraPublisherJSON == null) {
return FormValidation.error("jiraPublisherJSON is null.\n");

Check warning on line 799 in src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JiraTestDataPublisher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 798-799 are not covered by tests
}

// constructing the objects from json
List<AbstractFields> configs =
newInstancesFromHeteroList(req, jiraPublisherJSON.get("configs"), getListDescriptors());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@
* Method for setting the last configuration made for a project
*/
public synchronized void saveConfig(Job project, JobConfigEntry entry) {
if (project == null) {
return;

Check warning on line 398 in src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JobConfigMapping.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 397-398 are not covered by tests
}
if (entry instanceof JobConfigEntryBuilder) {
entry = ((JobConfigEntryBuilder) entry).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@
* @param job
*/
public void register(Job job) {
if (job == null) {
return;

Check warning on line 158 in src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/TestToIssueMapping.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 157-158 are not covered by tests
}

if (job instanceof MatrixProject) {
for (Job child : ((MatrixProject) job).getAllJobs()) {
if (child instanceof MatrixProject) {
Expand Down
Loading