From 01042a73adbfe9076aa2546da66ea6022d3a2140 Mon Sep 17 00:00:00 2001 From: Troy Kelley Date: Fri, 6 Feb 2015 16:15:45 -0500 Subject: Return empty collections instead of null to prevent NPE. --- .../bitbucketpullrequestbuilder/bitbucket/BitbucketApiClient.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BitbucketApiClient.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BitbucketApiClient.java index 5906f4c..8bd1b03 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BitbucketApiClient.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BitbucketApiClient.java @@ -10,6 +10,7 @@ import org.codehaus.jackson.type.TypeReference; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.util.Collections; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -42,7 +43,7 @@ public class BitbucketApiClient { } catch(Exception e) { logger.log(Level.WARNING, "invalid pull request response.", e); } - return null; + return Collections.EMPTY_LIST; } public List getPullRequestComments(String commentOwnerName, String commentRepositoryName, String pullRequestId) { @@ -53,7 +54,7 @@ public class BitbucketApiClient { } catch(Exception e) { logger.log(Level.WARNING, "invalid pull request response.", e); } - return null; + return Collections.EMPTY_LIST; } public void deletePullRequestComment(String pullRequestId, String commentId) { -- cgit v1.2.3