This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new 60d8400 Clean-up. Indents and braces 60d8400 is described below commit 60d8400e0331cd1adbfce27b8f921fbdb88c6625 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Jul 10 09:03:26 2019 +0100 Clean-up. Indents and braces --- .../naming/factory/webservices/ServiceProxy.java | 12 ++--- .../factory/webservices/ServiceRefFactory.java | 60 +++++++++++----------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/java/org/apache/naming/factory/webservices/ServiceProxy.java b/java/org/apache/naming/factory/webservices/ServiceProxy.java index 114a445..d6c03b1 100644 --- a/java/org/apache/naming/factory/webservices/ServiceProxy.java +++ b/java/org/apache/naming/factory/webservices/ServiceProxy.java @@ -101,14 +101,12 @@ public class ServiceProxy implements InvocationHandler { * @return Returns the correct Port * @throws ServiceException if port's QName is an unknown Port (not defined in WSDL). */ - private Object getProxyPortQNameClass(Object[] args) - throws ServiceException { + private Object getProxyPortQNameClass(Object[] args) throws ServiceException { QName name = (QName) args[0]; String nameString = name.getLocalPart(); Class<?> serviceendpointClass = (Class<?>) args[1]; - for (@SuppressWarnings("unchecked") - Iterator<QName> ports = service.getPorts(); ports.hasNext();) { + for (@SuppressWarnings("unchecked") Iterator<QName> ports = service.getPorts(); ports.hasNext();) { QName portName = ports.next(); String portnameString = portName.getLocalPart(); if (portnameString.equals(nameString)) { @@ -132,12 +130,12 @@ public class ServiceProxy implements InvocationHandler { * @return Returns the correct Port * @throws ServiceException if port's QName is an unknown Port */ - private Remote getProxyPortClass(Object[] args) - throws ServiceException { + private Remote getProxyPortClass(Object[] args) throws ServiceException { Class<?> serviceendpointClass = (Class<?>) args[0]; - if (this.portComponentRef == null) + if (this.portComponentRef == null) { return service.getPort(serviceendpointClass); + } QName portname = this.portComponentRef.get(serviceendpointClass.getName()); if (portname != null) { diff --git a/java/org/apache/naming/factory/webservices/ServiceRefFactory.java b/java/org/apache/naming/factory/webservices/ServiceRefFactory.java index b47c4ff..1f37d30 100644 --- a/java/org/apache/naming/factory/webservices/ServiceRefFactory.java +++ b/java/org/apache/naming/factory/webservices/ServiceRefFactory.java @@ -65,31 +65,32 @@ public class ServiceRefFactory implements ObjectFactory { */ @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, - Hashtable<?,?> environment) - throws Exception { + Hashtable<?,?> environment) throws Exception { if (obj instanceof ServiceRef) { ServiceRef ref = (ServiceRef) obj; // ClassLoader - ClassLoader tcl = - Thread.currentThread().getContextClassLoader(); - if (tcl == null) + ClassLoader tcl = Thread.currentThread().getContextClassLoader(); + if (tcl == null) { tcl = this.getClass().getClassLoader(); + } ServiceFactory factory = ServiceFactory.newInstance(); javax.xml.rpc.Service service = null; // Service Interface RefAddr tmp = ref.get(ServiceRef.SERVICE_INTERFACE); String serviceInterface = null; - if (tmp != null) + if (tmp != null) { serviceInterface = (String) tmp.getContent(); + } // WSDL tmp = ref.get(ServiceRef.WSDL); String wsdlRefAddr = null; - if (tmp != null) + if (tmp != null) { wsdlRefAddr = (String) tmp.getContent(); + } // PortComponent Hashtable<String,QName> portComponentRef = new Hashtable<>(); @@ -124,8 +125,7 @@ public class ServiceRefFactory implements ObjectFactory { serviceQname ); } } catch (Exception e) { - NamingException ex = new NamingException - ("Could not create service"); + NamingException ex = new NamingException("Could not create service"); ex.initCause(e); throw ex; } @@ -134,8 +134,7 @@ public class ServiceRefFactory implements ObjectFactory { try { serviceInterfaceClass = tcl.loadClass(serviceInterface); } catch(ClassNotFoundException e) { - NamingException ex = new NamingException - ("Could not load service Interface"); + NamingException ex = new NamingException("Could not load service Interface"); ex.initCause(e); throw ex; } @@ -146,8 +145,7 @@ public class ServiceRefFactory implements ObjectFactory { try { if (wsdlRefAddr == null) { if (!Service.class.isAssignableFrom(serviceInterfaceClass)) { - throw new NamingException - ("service Interface should extend javax.xml.rpc.Service"); + throw new NamingException("service Interface should extend javax.xml.rpc.Service"); } service = factory.loadService( serviceInterfaceClass ); } else { @@ -156,8 +154,7 @@ public class ServiceRefFactory implements ObjectFactory { new Properties() ); } } catch (Exception e) { - NamingException ex = new NamingException - ("Could not create service"); + NamingException ex = new NamingException("Could not create service"); ex.initCause(e); throw ex; } @@ -176,11 +173,10 @@ public class ServiceRefFactory implements ObjectFactory { Definition def = reader.readWSDL((new URL(wsdlRefAddr)).toExternalForm()); javax.wsdl.Service wsdlservice = def.getService(serviceQname); - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // Can't change the API Map<String,?> ports = wsdlservice.getPorts(); Method m = serviceInterfaceClass.getMethod("setEndpointAddress", - new Class[] { java.lang.String.class, - java.lang.String.class }); + new Class[] { java.lang.String.class, java.lang.String.class }); for (String portName : ports.keySet()) { Port port = wsdlservice.getPort(portName); String endpoint = getSOAPLocation(port); @@ -197,8 +193,7 @@ public class ServiceRefFactory implements ObjectFactory { throw (VirtualMachineError) cause; } } - NamingException ex = new NamingException - ("Error while reading Wsdl File"); + NamingException ex = new NamingException("Error while reading Wsdl File"); ex.initCause(e); throw ex; } @@ -207,7 +202,7 @@ public class ServiceRefFactory implements ObjectFactory { ServiceProxy proxy = new ServiceProxy(service); // Use port-component-ref - for (int i = 0; i < ref.size(); i++) + for (int i = 0; i < ref.size(); i++) { if (ServiceRef.SERVICEENDPOINTINTERFACE.equals(ref.get(i).getType())) { String serviceendpoint = ""; String portlink = ""; @@ -219,6 +214,7 @@ public class ServiceRefFactory implements ObjectFactory { portComponentRef.put(serviceendpoint, new QName(portlink)); } + } proxy.setPortComponentRef(portComponentRef); // Instantiate service with proxy class @@ -246,8 +242,9 @@ public class ServiceRefFactory implements ObjectFactory { // Loading handler Class tmp = handlerRef.get(HandlerRef.HANDLER_CLASS); - if ((tmp == null) || (tmp.getContent() == null)) + if ((tmp == null) || (tmp.getContent() == null)) { break; + } Class<?> handlerClass = null; try { handlerClass = tcl.loadClass((String) tmp.getContent()); @@ -260,7 +257,7 @@ public class ServiceRefFactory implements ObjectFactory { List<QName> headers = new ArrayList<>(); Hashtable<String,String> config = new Hashtable<>(); List<String> portNames = new ArrayList<>(); - for (int i = 0; i < handlerRef.size(); i++) + for (int i = 0; i < handlerRef.size(); i++) { if (HandlerRef.HANDLER_LOCALPART.equals(handlerRef.get(i).getType())) { String localpart = ""; String namespace = ""; @@ -289,6 +286,7 @@ public class ServiceRefFactory implements ObjectFactory { portName = (String) handlerRef.get(i).getContent(); portNames.add(portName); } + } // Set the handlers informations handlerInfo.setHandlerClass(handlerClass); @@ -302,9 +300,9 @@ public class ServiceRefFactory implements ObjectFactory { } } else { Enumeration<QName> e = portComponentRef.elements(); - while(e.hasMoreElements()) - initHandlerChain(e.nextElement(), handlerRegistry, - handlerInfo, soaproles); + while(e.hasMoreElements()) { + initHandlerChain(e.nextElement(), handlerRegistry, handlerInfo, soaproles); + } } } } @@ -323,7 +321,7 @@ public class ServiceRefFactory implements ObjectFactory { */ private String getSOAPLocation(Port port) { String endpoint = null; - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // Can't change the API List<ExtensibilityElement> extensions = port.getExtensibilityElements(); for (ExtensibilityElement ext : extensions) { if (ext instanceof SOAPAddress) { @@ -338,7 +336,7 @@ public class ServiceRefFactory implements ObjectFactory { private void initHandlerChain(QName portName, HandlerRegistry handlerRegistry, HandlerInfo handlerInfo, List<String> soaprolesToAdd) { HandlerChain handlerChain = (HandlerChain) handlerRegistry.getHandlerChain(portName); - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") // Can't change the API Iterator<Handler> iter = handlerChain.iterator(); while (iter.hasNext()) { Handler handler = iter.next(); @@ -347,10 +345,12 @@ public class ServiceRefFactory implements ObjectFactory { String[] soaprolesRegistered = handlerChain.getRoles(); String [] soaproles = new String[soaprolesRegistered.length + soaprolesToAdd.size()]; int i; - for (i = 0;i < soaprolesRegistered.length; i++) + for (i = 0;i < soaprolesRegistered.length; i++) { soaproles[i] = soaprolesRegistered[i]; - for (int j = 0; j < soaprolesToAdd.size(); j++) + } + for (int j = 0; j < soaprolesToAdd.size(); j++) { soaproles[i+j] = soaprolesToAdd.get(j); + } handlerChain.setRoles(soaproles); handlerRegistry.setHandlerChain(portName, handlerChain); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org