You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/12/16 17:41:39 UTC

svn commit: r891301 - /cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java

Author: dkulp
Date: Wed Dec 16 16:41:38 2009
New Revision: 891301

URL: http://svn.apache.org/viewvc?rev=891301&view=rev
Log:
[CXF-2584] NPE guards for CXFAuthenticator

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java?rev=891301&r1=891300&r2=891301&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java Wed Dec 16 16:41:38 2009
@@ -87,15 +87,18 @@
                 HTTPConduit httpConduit = (HTTPConduit)conduit;
                 if (getRequestorType() == RequestorType.PROXY
                     && httpConduit.getProxyAuthorization() != null) {
-                    
-                    auth = new PasswordAuthentication(httpConduit.getProxyAuthorization().getUserName(),
-                                                      httpConduit.getProxyAuthorization()
-                                                          .getPassword().toCharArray());
+                    String un = httpConduit.getProxyAuthorization().getUserName();
+                    String pwd =  httpConduit.getProxyAuthorization().getPassword();
+                    if (un != null && pwd != null) {
+                        auth = new PasswordAuthentication(un, pwd.toCharArray());
+                    }
                 } else if (getRequestorType() == RequestorType.SERVER
                     && httpConduit.getAuthorization() != null) {
-                    auth = new PasswordAuthentication(httpConduit.getAuthorization().getUserName(),
-                                                      httpConduit.getAuthorization()
-                                                          .getPassword().toCharArray());
+                    String un = httpConduit.getAuthorization().getUserName();
+                    String pwd =  httpConduit.getAuthorization().getPassword();
+                    if (un != null && pwd != null) {
+                        auth = new PasswordAuthentication(un, pwd.toCharArray());
+                    }
                 }
             }
         }