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 2017/08/04 19:35:07 UTC

[07/12] cxf git commit: Fix unecessary "else" clauses in rt/frontend

http://git-wip-us.apache.org/repos/asf/cxf/blob/903ef61f/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
index 075d683..ca4d94f 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
@@ -333,22 +333,20 @@ public class JaxWsImplementorInfo {
         WebServiceProvider ann = cls.getAnnotation(WebServiceProvider.class);
         if (null != ann) {
             return ann;
-        } else {
-            if (ifAnnotationLoadedByOtherClassLoader(cls, WebServiceProvider.class)) {
-                LOG.log(Level.WARNING,
-                    "WEBSERVICE_ANNOTATIONS_IS_LOADED_BY_OTHER_CLASSLOADER",
-                    WebServiceProvider.class.getName());
-            }
+        }
+        if (ifAnnotationLoadedByOtherClassLoader(cls, WebServiceProvider.class)) {
+            LOG.log(Level.WARNING,
+                "WEBSERVICE_ANNOTATIONS_IS_LOADED_BY_OTHER_CLASSLOADER",
+                WebServiceProvider.class.getName());
         }
         for (Class<?> inf : cls.getInterfaces()) {
             if (null != inf.getAnnotation(WebServiceProvider.class)) {
                 return inf.getAnnotation(WebServiceProvider.class);
-            } else {
-                if (ifAnnotationLoadedByOtherClassLoader(cls, WebServiceProvider.class)) {
-                    LOG.log(Level.WARNING,
-                            "WEBSERVICE_ANNOTATIONS_IS_LOADED_BY_OTHER_CLASSLOADER",
-                            WebServiceProvider.class.getName());
-                }
+            }
+            if (ifAnnotationLoadedByOtherClassLoader(cls, WebServiceProvider.class)) {
+                LOG.log(Level.WARNING,
+                        "WEBSERVICE_ANNOTATIONS_IS_LOADED_BY_OTHER_CLASSLOADER",
+                        WebServiceProvider.class.getName());
             }
         }
         return getWebServiceProviderAnnotation(cls.getSuperclass());
@@ -383,9 +381,8 @@ public class JaxWsImplementorInfo {
                     if (Provider.class == clazz) {
                         Type paramTypes[] = ((ParameterizedType)t).getActualTypeArguments();
                         return JAXBEncoderDecoder.getClassFromType(paramTypes[0]);
-                    } else {
-                        return doGetProviderParameterType(clazz);
                     }
+                    return doGetProviderParameterType(clazz);
                 }
             }
             c = c.getSuperclass();

http://git-wip-us.apache.org/repos/asf/cxf/blob/903ef61f/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
index 707feb2..90cb931 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
@@ -145,9 +145,8 @@ public class JaxWsServiceConfiguration extends AbstractServiceConfiguration {
             }
 
             return new QName(intf.getName().getNamespaceURI(), name);
-        } else {
-            return new QName(intf.getName().getNamespaceURI(), method.getName());
         }
+        return new QName(intf.getName().getNamespaceURI(), method.getName());
     }
 
     public Boolean isWebMethod(final Method method) {
@@ -361,20 +360,19 @@ public class JaxWsServiceConfiguration extends AbstractServiceConfiguration {
         }
         if (parameter >= annotations.length) {
             return null;
-        } else {
-            for (int i = 0; i < annotations[parameter].length; i++) {
-                Annotation annotation = annotations[parameter][i];
-                // With the ibm jdk, the condition:
-                // if (annotation.annotationType().equals(WebParam.class)) {
-                // SOMETIMES returns false even when the annotation type
-                // is a WebParam.  Doing an instanceof check or using the
-                // == operator seems to give the desired result.
-                if (annotation instanceof WebParam) {
-                    return (WebParam)annotation;
-                }
+        }
+        for (int i = 0; i < annotations[parameter].length; i++) {
+            Annotation annotation = annotations[parameter][i];
+            // With the ibm jdk, the condition:
+            // if (annotation.annotationType().equals(WebParam.class)) {
+            // SOMETIMES returns false even when the annotation type
+            // is a WebParam.  Doing an instanceof check or using the
+            // == operator seems to give the desired result.
+            if (annotation instanceof WebParam) {
+                return (WebParam)annotation;
             }
-            return null;
         }
+        return null;
     }
     @Override
     public String getRequestWrapperPartName(OperationInfo op, Method method) {
@@ -451,37 +449,36 @@ public class JaxWsServiceConfiguration extends AbstractServiceConfiguration {
 
         if (paramNumber >= 0) {
             return getParameterName(op, method, paramNumber, op.getOutput().size(), "return", false);
-        } else {
-            WebResult webResult = getWebResult(method);
+        }
+        WebResult webResult = getWebResult(method);
 
-            String tns = null;
-            String local = null;
-            if (webResult != null) {
-                tns = webResult.targetNamespace();
-                local = webResult.name();
-            }
-            if (tns == null || tns.length() == 0) {
-                QName wrappername = getResponseWrapperName(op, method);
-                if (wrappername != null) {
-                    tns = wrappername.getNamespaceURI();
-                }
+        String tns = null;
+        String local = null;
+        if (webResult != null) {
+            tns = webResult.targetNamespace();
+            local = webResult.name();
+        }
+        if (tns == null || tns.length() == 0) {
+            QName wrappername = getResponseWrapperName(op, method);
+            if (wrappername != null) {
+                tns = wrappername.getNamespaceURI();
             }
+        }
 
-            if (tns == null || tns.length() == 0) {
-                tns = op.getName().getNamespaceURI();
-            }
+        if (tns == null || tns.length() == 0) {
+            tns = op.getName().getNamespaceURI();
+        }
 
-            if (local == null || local.length() == 0) {
-                if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) {
-                    local = getDefaultLocalName(op, method, paramNumber, op.getOutput().size(), "return");
-                } else {
-                    local = getOperationName(op.getInterface(),
-                                             method).getLocalPart() + "Response";
-                }
+        if (local == null || local.length() == 0) {
+            if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) {
+                local = getDefaultLocalName(op, method, paramNumber, op.getOutput().size(), "return");
+            } else {
+                local = getOperationName(op.getInterface(),
+                                         method).getLocalPart() + "Response";
             }
-
-            return new QName(tns, local);
         }
+
+        return new QName(tns, local);
     }
 
     @Override
@@ -490,29 +487,28 @@ public class JaxWsServiceConfiguration extends AbstractServiceConfiguration {
 
         if (paramNumber >= 0) {
             return getPartName(op, method, paramNumber, op.getOutput(), "return", false);
-        } else {
-            WebResult webResult = getWebResult(method);
-            String tns = op.getOutput().getName().getNamespaceURI();
-            String local = null;
-            if (webResult != null) {
-                if (Boolean.TRUE.equals(isRPC(method)) || isDocumentBare(method)) {
-                    local = webResult.partName();
-                }
-                if (local == null || local.length() == 0) {
-                    local = webResult.name();
-                }
+        }
+        WebResult webResult = getWebResult(method);
+        String tns = op.getOutput().getName().getNamespaceURI();
+        String local = null;
+        if (webResult != null) {
+            if (Boolean.TRUE.equals(isRPC(method)) || isDocumentBare(method)) {
+                local = webResult.partName();
             }
-
             if (local == null || local.length() == 0) {
-                if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) {
-                    local = "return";
-                } else {
-                    local = getOperationName(op.getInterface(), method).getLocalPart() + "Response";
-                }
+                local = webResult.name();
             }
+        }
 
-            return new QName(tns, local);
+        if (local == null || local.length() == 0) {
+            if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) {
+                local = "return";
+            } else {
+                local = getOperationName(op.getInterface(), method).getLocalPart() + "Response";
+            }
         }
+
+        return new QName(tns, local);
     }
 
     @Override
@@ -787,10 +783,9 @@ public class JaxWsServiceConfiguration extends AbstractServiceConfiguration {
         if (j >= 0) {
             WebParam webParam = getWebParam(method, j);
             return webParam != null && webParam.header();
-        } else {
-            WebResult webResult = getWebResult(method);
-            return webResult != null && webResult.header();
         }
+        WebResult webResult = getWebResult(method);
+        return webResult != null && webResult.header();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/903ef61f/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java
index 55574c4..cae4b09 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java
@@ -104,9 +104,8 @@ public class JAXWSHttpSpiDestination extends AbstractHTTPDestination {
             Throwable cause = ex.getCause();
             if (cause instanceof RuntimeException) {
                 throw (RuntimeException)cause;
-            } else {
-                throw ex;
             }
+            throw ex;
         } catch (RuntimeException ex) {
             throw ex;
         } finally {

http://git-wip-us.apache.org/repos/asf/cxf/blob/903ef61f/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ServerApp.java
----------------------------------------------------------------------
diff --git a/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ServerApp.java b/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ServerApp.java
index d22416c..5f7218c 100644
--- a/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ServerApp.java
+++ b/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ServerApp.java
@@ -140,9 +140,8 @@ public class ServerApp {
             if (f.isFile()) {
                 String name = f.getName();
                 return name.endsWith(".js") || name.endsWith(".jsx");
-            } else {
-                return false;
             }
+            return false;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/903ef61f/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
index 448e0b8..2c99ac3 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
@@ -729,9 +729,8 @@ public class DynamicClientFactory {
 
             if (resolver.isResolved()) {
                 return resolver.getURI().toURL();
-            } else {
-                throw new ServiceConstructionException(new Message("COULD_NOT_RESOLVE_URL", LOG, s));
             }
+            throw new ServiceConstructionException(new Message("COULD_NOT_RESOLVE_URL", LOG, s));
         } catch (IOException e) {
             throw new ServiceConstructionException(new Message("COULD_NOT_RESOLVE_URL", LOG, s), e);
         }
@@ -802,9 +801,8 @@ public class DynamicClientFactory {
                 File file = new File(baseURI, systemId);
                 if (file.exists()) {
                     return new InputSource(Files.newInputStream(file.toPath()));
-                } else {
-                    return new InputSource(systemId);
                 }
+                return new InputSource(systemId);
             }
             return null;
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/903ef61f/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxy.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxy.java b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxy.java
index b74c77f..d0670ca 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxy.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxy.java
@@ -97,9 +97,8 @@ public class ClientProxy implements InvocationHandler, Closeable {
 
         if (rawRet != null && rawRet.length > 0) {
             return rawRet[0];
-        } else {
-            return null;
         }
+        return null;
     }
     public Map<String, Object> getRequestContext() {
         if (client == null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/903ef61f/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
index a279a7f..b314dca 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
@@ -286,9 +286,8 @@ public class ServerFactoryBean extends AbstractWSDLBasedEndpointFactory {
     public Class<?> getServiceBeanClass() {
         if (serviceBean != null) {
             return ClassHelper.getRealClass(getBus(), serviceBean);
-        } else {
-            return getServiceFactory().getServiceClass();
         }
+        return getServiceFactory().getServiceClass();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cxf/blob/903ef61f/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
index ff1b254..9327c81 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
@@ -482,11 +482,10 @@ public class WSDLGetUtils {
             if (name == null) {
                 setSoapAddressLocationOn(ports.iterator().next(), publishingUrl);
                 break; // only update the first port since we don't target any specific port
-            } else {
-                for (Port port : ports) {
-                    if (name.getLocalPart().equals(port.getName())) {
-                        setSoapAddressLocationOn(port, publishingUrl);
-                    }
+            }
+            for (Port port : ports) {
+                if (name.getLocalPart().equals(port.getName())) {
+                    setSoapAddressLocationOn(port, publishingUrl);
                 }
             }
         }