You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/06/12 12:48:04 UTC

[cxf] branch master updated: Prevent some potential NPEs if null set is set on various fields for an OAuth Client

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 464ed87  Prevent some potential NPEs if null set is set on various fields for an OAuth Client
464ed87 is described below

commit 464ed874544a4ea030ea0b50b15e41e0a23a8c8d
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri Jun 12 13:47:31 2020 +0100

    Prevent some potential NPEs if null set is set on various fields for an OAuth Client
---
 .../org/apache/cxf/rs/security/oauth2/common/Client.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Client.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Client.java
index 14837e2..1d00700 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Client.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Client.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.rs.security.oauth2.common;
 
 import java.io.Serializable;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -223,7 +224,7 @@ public class Client implements Serializable {
      * @param redirectUris the redirect uris
      */
     public void setRedirectUris(List<String> redirectUris) {
-        this.redirectUris = redirectUris;
+        this.redirectUris = redirectUris != null ? redirectUris : Collections.emptyList();
     }
 
     /**
@@ -243,7 +244,7 @@ public class Client implements Serializable {
      * @param allowedGrantTypes the list of grant types
      */
     public void setAllowedGrantTypes(List<String> allowedGrantTypes) {
-        this.allowedGrantTypes = allowedGrantTypes;
+        this.allowedGrantTypes = allowedGrantTypes != null ? allowedGrantTypes : Collections.emptyList();
     }
 
     /**
@@ -328,7 +329,7 @@ public class Client implements Serializable {
      * @param registeredScopes the scopes
      */
     public void setRegisteredScopes(List<String> registeredScopes) {
-        this.registeredScopes = registeredScopes;
+        this.registeredScopes = registeredScopes != null ? registeredScopes : Collections.emptyList();
     }
 
     @ElementCollection(fetch = FetchType.EAGER)
@@ -342,7 +343,7 @@ public class Client implements Serializable {
      * @param registeredAudiences audiences
      */
     public void setRegisteredAudiences(List<String> registeredAudiences) {
-        this.registeredAudiences = registeredAudiences;
+        this.registeredAudiences = registeredAudiences != null ? registeredAudiences : Collections.emptyList();
     }
 
     @ElementCollection(fetch = FetchType.EAGER)
@@ -358,7 +359,8 @@ public class Client implements Serializable {
      * Basic or other password-aware authentication on top of 2-way TLS.
      */
     public void setApplicationCertificates(List<String> applicationCertificates) {
-        this.applicationCertificates = applicationCertificates;
+        this.applicationCertificates = applicationCertificates != null
+                ? applicationCertificates : Collections.emptyList();
     }
 
     public String getClientIpAddress() {