Author: rmannibucau
Date: Mon Jan  7 21:51:22 2013
New Revision: 1430039

URL: http://svn.apache.org/viewvc?rev=1430039&view=rev
Log:
avoiding NPE + setting right address to JAXRSServerFactoryBean

Modified:
    
openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java

Modified: 
openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java?rev=1430039&r1=1430038&r2=1430039&view=diff
==============================================================================
--- 
openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
 (original)
+++ 
openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
 Mon Jan  7 21:51:22 2013
@@ -56,7 +56,6 @@ import javax.ws.rs.core.Application;
 import javax.xml.bind.Marshaller;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -290,11 +289,18 @@ public class CxfRsHttpListener implement
     }
 
     private static String forceLength(final String httpMethod, final int l) {
+        final String http;
+        if (httpMethod == null) { // subresourcelocator implies null http 
method
+            http = "";
+        } else {
+            http = httpMethod;
+        }
+
         final StringBuilder builder = new StringBuilder();
-        for (int i = 0; i < l - httpMethod.length(); i++) {
+        for (int i = 0; i < l - http.length(); i++) {
             builder.append(" ");
         }
-        return builder.append(httpMethod).toString();
+        return builder.append(http).toString();
     }
 
     public static String toGenericString(final Method mtd) {
@@ -362,7 +368,7 @@ public class CxfRsHttpListener implement
         final JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
         factory.setDestinationFactory(transportFactory);
         factory.setBus(transportFactory.getBus());
-        factory.setAddress(prefix);
+        factory.setAddress(prefix.substring(0, prefix.length() - 
wildcard.length()));
         return factory;
     }
 


Reply via email to