You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ow...@apache.org on 2012/05/28 21:36:36 UTC

svn commit: r1343372 - in /cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core: FederationProcessorImpl.java config/FederationProtocol.java

Author: owulff
Date: Mon May 28 19:36:36 2012
New Revision: 1343372

URL: http://svn.apache.org/viewvc?rev=1343372&view=rev
Log:
NullPointerException in createSignInRequest fixed

Modified:
    cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java
    cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FederationProtocol.java

Modified: cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java?rev=1343372&r1=1343371&r2=1343372&view=diff
==============================================================================
--- cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java (original)
+++ cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java Mon May 28 19:36:36 2012
@@ -272,28 +272,32 @@ public class FederationProcessorImpl imp
             
             Object wAuthObj = ((FederationProtocol)config.getProtocol()).getAuthenticationType();
             String wAuth = null;
-            if (wAuthObj instanceof String) {
-                wAuth = (String)wAuthObj;
-            } else if (wAuthObj instanceof CallbackHandler) {
-                CallbackHandler wauthCB = (CallbackHandler)wAuthObj;
-                WAuthCallback callback = new WAuthCallback(request);
-                wauthCB.handle(new Callback[] {callback});
-                wAuth = callback.getWauth();
+            if (wAuthObj != null) {
+                if (wAuthObj instanceof String) {
+                    wAuth = (String)wAuthObj;
+                } else if (wAuthObj instanceof CallbackHandler) {
+                    CallbackHandler wauthCB = (CallbackHandler)wAuthObj;
+                    WAuthCallback callback = new WAuthCallback(request);
+                    wauthCB.handle(new Callback[] {callback});
+                    wAuth = callback.getWauth();
+                }  
             }
             LOG.info("WAuth: " + wAuth);
             
             Object homeRealmObj = ((FederationProtocol)config.getProtocol()).getHomeRealm();
             String homeRealm = null;
-            if (homeRealmObj instanceof String) {
-                homeRealm = (String)homeRealmObj;
-            } else if (homeRealmObj instanceof CallbackHandler) {
-                CallbackHandler hrCB = (CallbackHandler)homeRealmObj;
-                HomeRealmCallback callback = new HomeRealmCallback(request);
-                hrCB.handle(new Callback[] {callback});
-                homeRealm = callback.getHomeRealm();
+            if (homeRealmObj != null) {
+                if (homeRealmObj instanceof String) {
+                    homeRealm = (String)homeRealmObj;
+                } else if (homeRealmObj instanceof CallbackHandler) {
+                    CallbackHandler hrCB = (CallbackHandler)homeRealmObj;
+                    HomeRealmCallback callback = new HomeRealmCallback(request);
+                    hrCB.handle(new Callback[] {callback});
+                    homeRealm = callback.getHomeRealm();
+                }
             }
             LOG.info("HomeRealm: " + homeRealm);
-
+            
             StringBuilder sb = new StringBuilder();
 
             sb.append(FederationConstants.PARAM_ACTION).append('=').append(FederationConstants.ACTION_SIGNIN);

Modified: cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FederationProtocol.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FederationProtocol.java?rev=1343372&r1=1343371&r2=1343372&view=diff
==============================================================================
--- cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FederationProtocol.java (original)
+++ cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FederationProtocol.java Mon May 28 19:36:36 2012
@@ -89,7 +89,10 @@ public class FederationProtocol extends 
             return this.authenticationType;
         }
         CallbackType cbt = getFederationProtocol().getAuthenticationType();
-        if (cbt.getType().equals(ArgumentType.STRING)) {
+        if (cbt == null) {
+            return null;
+        }
+        if (cbt.getType() == null || cbt.getType().equals(ArgumentType.STRING)) {
             this.authenticationType = new String(cbt.getValue());
         } else if (cbt.getType().equals(ArgumentType.CLASS)) {
             try {
@@ -123,7 +126,10 @@ public class FederationProtocol extends 
             return this.homeRealm;
         }
         CallbackType cbt = getFederationProtocol().getHomeRealm();
-        if (cbt.getType().equals(ArgumentType.STRING)) {
+        if (cbt == null) {
+            return null;
+        }
+        if (cbt.getType() == null || cbt.getType().equals(ArgumentType.STRING)) {
             this.homeRealm = new String(cbt.getValue());
         } else if (cbt.getType().equals(ArgumentType.CLASS)) {
             try {
@@ -157,7 +163,7 @@ public class FederationProtocol extends 
             return this.issuer;
         }
         CallbackType cbt = getFederationProtocol().getIssuer();
-        if (cbt.getType().equals(ArgumentType.STRING)) {
+        if (cbt.getType() == null || cbt.getType().equals(ArgumentType.STRING)) {
             this.issuer = new String(cbt.getValue());
         } else if (cbt.getType().equals(ArgumentType.CLASS)) {
             try {