JBossWS SVN: r10712 - spi/trunk/src/main/java/org/jboss/wsf/spi/util.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-18 04:56:42 -0400 (Fri, 18 Sep 2009)
New Revision: 10712
Added:
spi/trunk/src/main/java/org/jboss/wsf/spi/util/ResourceCachingClassLoader.java
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java
spi/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java
Log:
[JBWS-2763] Cache resource name lookup through Services API (prevent many useless accesses to filesystem)
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/util/ResourceCachingClassLoader.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/ResourceCachingClassLoader.java (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/ResourceCachingClassLoader.java 2009-09-18 08:56:42 UTC (rev 10712)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.util;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * A ClassLoader with caches for resource lookup through services (META-INF/services)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 18-Sep-2009
+ *
+ */
+public class ResourceCachingClassLoader extends ClassLoader
+{
+ private ConcurrentMap<String, String> servicesMap = new ConcurrentHashMap<String, String>();
+
+ public ResourceCachingClassLoader(ClassLoader parent)
+ {
+ super(parent);
+ //clear maps to same memory, as this constructor is also called when this classloader becomes a father (hence the cache is not useful anymore)
+ servicesMap.clear();
+ }
+
+ public boolean hasResourceNameFromServices(String key)
+ {
+ return servicesMap.containsKey(key);
+ }
+
+ public String getResourceNameFromServices(String key)
+ {
+ return servicesMap.get(key);
+ }
+
+ public void setResourceNameFromServices(String key, String value)
+ {
+ servicesMap.put(key, value);
+ }
+}
Property changes on: spi/trunk/src/main/java/org/jboss/wsf/spi/util/ResourceCachingClassLoader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java 2009-09-17 15:30:33 UTC (rev 10711)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java 2009-09-18 08:56:42 UTC (rev 10712)
@@ -60,6 +60,29 @@
}
/**
+ * Set context classloader.
+ *
+ */
+ static void setContextClassLoader(final ClassLoader cl)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ return null;
+ }
+ });
+ }
+ }
+
+ /**
* Get resource as stream
*
* @param cl
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java 2009-09-17 15:30:33 UTC (rev 10711)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java 2009-09-18 08:56:42 UTC (rev 10712)
@@ -75,18 +75,26 @@
{
Object factory = null;
String factoryName = null;
- ClassLoader loader = SecurityActions.getContextClassLoader();
+ ClassLoader cl = SecurityActions.getContextClassLoader();
+ ResourceCachingClassLoader loader;
+
+ if (cl instanceof ResourceCachingClassLoader)
+ {
+ loader = (ResourceCachingClassLoader)cl;
+ }
+ else
+ {
+ loader = new ResourceCachingClassLoader(cl);
+ SecurityActions.setContextClassLoader(loader);
+ }
// Use the Services API (as detailed in the JAR specification), if available, to determine the classname.
String filename = "META-INF/services/" + propertyName;
- InputStream inStream = SecurityActions.getResourceAsStream(loader, filename);
- if (inStream != null)
+ if (loader.hasResourceNameFromServices(filename))
{
+ factoryName = loader.getResourceNameFromServices(filename);
try
{
- BufferedReader br = new BufferedReader(new InputStreamReader(inStream, "UTF-8"));
- factoryName = br.readLine();
- br.close();
if (factoryName != null)
{
Class factoryClass = SecurityActions.loadClass(loader, factoryName);
@@ -98,6 +106,29 @@
throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t);
}
}
+ else
+ {
+ InputStream inStream = SecurityActions.getResourceAsStream(loader, filename);
+ if (inStream != null)
+ {
+ try
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader(inStream, "UTF-8"));
+ factoryName = br.readLine();
+ br.close();
+ loader.setResourceNameFromServices(filename, factoryName);
+ if (factoryName != null)
+ {
+ Class factoryClass = SecurityActions.loadClass(loader, factoryName);
+ factory = factoryClass.newInstance();
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t);
+ }
+ }
+ }
// Use the default factory implementation class.
if (factory == null && defaultFactory != null)
15 years, 3 months
JBossWS SVN: r10711 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-17 11:30:33 -0400 (Thu, 17 Sep 2009)
New Revision: 10711
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
Log:
[JBWS-2767] Setting an URI instead of an InputSource in MessageContext - WSDL_DESCRIPTION
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2009-09-17 10:37:02 UTC (rev 10710)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2009-09-17 15:30:33 UTC (rev 10711)
@@ -24,6 +24,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.net.URL;
import javax.xml.ws.handler.MessageContext;
@@ -127,7 +128,7 @@
{
super.setOperationMetaData(opMetaData);
- // [JBWS-2031] Implement standard message context properties
+ // [JBWS-2013] Implement standard message context properties
if (opMetaData != null)
{
EndpointMetaData epMetaData = opMetaData.getEndpointMetaData();
@@ -138,14 +139,11 @@
{
try
{
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copyStream(baos, wsdlURL.openStream()); // [JBWS-2325] ensure file descriptors are closed
- InputSource inputSource = new InputSource(new ByteArrayInputStream(baos.toByteArray()));
- put(MessageContext.WSDL_DESCRIPTION, inputSource);
+ put(MessageContext.WSDL_DESCRIPTION, wsdlURL.toURI());
}
- catch (IOException ex)
+ catch (URISyntaxException e)
{
- throw new WSException("Cannot open: " + wsdlURL);
+ log.warn("Cannot get the wsdl url", e);
}
}
15 years, 3 months
JBossWS SVN: r10710 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-09-17 06:37:02 -0400 (Thu, 17 Sep 2009)
New Revision: 10710
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
Log:
[JBWS-2741] fixing TCK5 regression
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2009-09-17 10:04:11 UTC (rev 10709)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2009-09-17 10:37:02 UTC (rev 10710)
@@ -27,6 +27,7 @@
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
+import javax.xml.ws.BindingType;
import javax.xml.ws.Endpoint;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.Service;
@@ -68,7 +69,14 @@
@Override
public Endpoint createEndpoint(String bindingId, Object implementor)
{
- return new EndpointImpl(bindingId == null ? SOAPBinding.SOAP11HTTP_BINDING : bindingId, implementor);
+ String realBindingId = bindingId;
+ if (realBindingId == null)
+ {
+ BindingType anBindingType = implementor.getClass().getAnnotation(BindingType.class);
+ realBindingId = (anBindingType != null) ? anBindingType.value() : SOAPBinding.SOAP11HTTP_BINDING;
+ }
+
+ return new EndpointImpl(realBindingId, implementor);
}
@Override
15 years, 3 months
JBossWS SVN: r10709 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-09-17 06:04:11 -0400 (Thu, 17 Sep 2009)
New Revision: 10709
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
Log:
[JBWS-2741] fixing TCK5 regression
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2009-09-16 17:21:07 UTC (rev 10708)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2009-09-17 10:04:11 UTC (rev 10709)
@@ -68,8 +68,7 @@
@Override
public Endpoint createEndpoint(String bindingId, Object implementor)
{
- EndpointImpl endpoint = new EndpointImpl(bindingId, implementor);
- return endpoint;
+ return new EndpointImpl(bindingId == null ? SOAPBinding.SOAP11HTTP_BINDING : bindingId, implementor);
}
@Override
15 years, 3 months
JBossWS SVN: r10708 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-16 13:21:07 -0400 (Wed, 16 Sep 2009)
New Revision: 10708
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/NodeImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPEnvelopeImpl.java
Log:
[JBWS-2763] Prevent multiple computations of stop-value in "for" loops, remove useless traces, misc optimizations
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/NodeImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/NodeImpl.java 2009-09-16 17:20:16 UTC (rev 10707)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/NodeImpl.java 2009-09-16 17:21:07 UTC (rev 10708)
@@ -30,7 +30,6 @@
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
-import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
@@ -58,9 +57,6 @@
*/
public class NodeImpl implements javax.xml.soap.Node
{
- // provide logging
- private static Logger log = Logger.getLogger(NodeImpl.class);
-
// The parent of this Node
protected SOAPElementImpl soapParent;
// This org.w3c.dom.Node
@@ -318,7 +314,8 @@
if (soapParent != null)
{
List children = ((NodeImpl)soapParent).soapChildren;
- for (int i = 0; i < children.size(); i++)
+ int len = children.size();
+ for (int i = 0; i < len; i++)
{
NodeImpl node = (NodeImpl)children.get(i);
if (node == this && i > 0)
@@ -343,10 +340,11 @@
if (soapParent != null)
{
List children = ((NodeImpl)soapParent).soapChildren;
- for (int i = 0; i < children.size(); i++)
+ int len = children.size();
+ for (int i = 0; i < len; i++)
{
NodeImpl node = (NodeImpl)children.get(i);
- if (node == this && (i + 1) < children.size())
+ if (node == this && (i + 1) < len)
{
sibling = (NodeImpl)children.get(i + 1);
break;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-09-16 17:20:16 UTC (rev 10707)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-09-16 17:21:07 UTC (rev 10708)
@@ -36,7 +36,6 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.Text;
-import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.wsf.common.DOMUtils;
@@ -60,9 +59,6 @@
*/
public class SOAPElementImpl extends NodeImpl implements SOAPElement, SAAJVisitable
{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPElementImpl.class);
-
// The org.w3c.dom.Element
private Element element;
// The element name
@@ -73,7 +69,6 @@
{
super(DOMUtils.createElement(localPart, null, null));
this.element = (Element)domNode;
- log.trace("new SOAPElementImpl: " + getElementName());
}
/** Called by SOAPFactory */
@@ -81,7 +76,6 @@
{
super(DOMUtils.createElement(localPart, prefix, nsURI));
this.element = (Element)domNode;
- log.trace("new SOAPElementImpl: " + getElementName());
}
/** Called by SOAPFactory */
@@ -102,7 +96,6 @@
{
super(element);
this.element = (Element)domNode;
- log.trace("new SOAPElementImpl: " + getElementName());
}
/** Get the SOAPEnvelope for this SOAPElement */
@@ -267,7 +260,6 @@
*/
public SOAPElement addChildElement(SOAPElement child) throws SOAPException
{
- log.trace("addChildElement: " + getElementName() + " -> " + child.getElementName());
SOAPElementImpl soapElement = (SOAPElementImpl)child;
soapElement = (SOAPElementImpl)appendChild(soapElement);
return soapElement.completeNamespaceDeclaration();
@@ -292,7 +284,6 @@
if (prefix != null && prefix.length() > 0)
qualifiedName += ":" + prefix;
- log.trace("addNamespaceDeclaration: " + qualifiedName + "='" + nsURI + "'");
element.setAttributeNS("http://www.w3.org/2000/xmlns/", qualifiedName, nsURI);
return this;
}
@@ -321,7 +312,6 @@
*/
public SOAPElement addTextNode(String value) throws SOAPException
{
- log.trace("addTextNode: " + value);
org.w3c.dom.Node domNode;
if (value.startsWith("<!--") && value.endsWith("-->"))
{
@@ -349,7 +339,8 @@
{
ArrayList list = new ArrayList();
NamedNodeMap nnm = getAttributes();
- for (int i = 0; i < nnm.getLength(); i++)
+ int len = nnm.getLength();
+ for (int i = 0; i < len; i++)
{
org.w3c.dom.Node node = (org.w3c.dom.Node)nnm.item(i);
String local = node.getLocalName();
@@ -376,7 +367,8 @@
{
ArrayList list = new ArrayList();
NamedNodeMap nnm = getAttributes();
- for (int i = 0; i < nnm.getLength(); i++)
+ int len = nnm.getLength();
+ for (int i = 0; i < len; i++)
{
org.w3c.dom.Node node = (org.w3c.dom.Node)nnm.item(i);
String local = node.getLocalName();
@@ -462,7 +454,8 @@
{
List list = new ArrayList();
NodeList nodeList = getChildNodes();
- for (int i = 0; i < nodeList.getLength(); i++)
+ int len = nodeList.getLength();
+ for (int i = 0; i < len; i++)
{
org.w3c.dom.Node node = nodeList.item(i);
if (node instanceof SOAPElement)
@@ -476,6 +469,27 @@
}
return list.iterator();
}
+
+ protected SOAPElement getFirstChildElementByLocalName(String localName)
+ {
+ if (localName == null)
+ throw new IllegalArgumentException("localName cannot be null");
+ NodeList nodeList = getChildNodes();
+ int len = nodeList.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ org.w3c.dom.Node node = nodeList.item(i);
+ if (localName.equals(node.getLocalName()))
+ {
+ if (node instanceof SOAPElement)
+ {
+ return (SOAPElement)node;
+ }
+ }
+ }
+ return null;
+ }
+
/**
* Returns an Iterator over all the immediate child Nodes of this element with the specified name.
@@ -554,7 +568,8 @@
{
ArrayList list = new ArrayList();
NamedNodeMap attrMap = element.getAttributes();
- for (int i = 0; i < attrMap.getLength(); i++)
+ int len = attrMap.getLength();
+ for (int i = 0; i < len; i++)
{
Attr attr = (Attr)attrMap.item(i);
String attrName = attr.getNodeName();
@@ -629,7 +644,6 @@
*/
public void removeContents()
{
- log.trace("removeContents");
Iterator it = getChildElements();
while (it.hasNext())
{
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPEnvelopeImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPEnvelopeImpl.java 2009-09-16 17:20:16 UTC (rev 10707)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPEnvelopeImpl.java 2009-09-16 17:21:07 UTC (rev 10708)
@@ -153,26 +153,12 @@
public SOAPBody getBody() throws SOAPException
{
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- Node node = (Node)it.next();
- if ("Body".equals(node.getLocalName()))
- return (SOAPBody)node;
- }
- return null;
+ return (SOAPBody)getFirstChildElementByLocalName("Body");
}
public SOAPHeader getHeader() throws SOAPException
{
- Iterator it = getChildElements();
- while (it.hasNext())
- {
- Node node = (Node)it.next();
- if ("Header".equals(node.getLocalName()))
- return (SOAPHeader)node;
- }
- return null;
+ return (SOAPHeader)getFirstChildElementByLocalName("Header");
}
/**
15 years, 3 months
JBossWS SVN: r10707 - common/trunk/src/main/java/org/jboss/wsf/common.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-16 13:20:16 -0400 (Wed, 16 Sep 2009)
New Revision: 10707
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java
common/trunk/src/main/java/org/jboss/wsf/common/DOMWriter.java
common/trunk/src/main/java/org/jboss/wsf/common/IOUtils.java
Log:
[JBWS-2763] Using StringBuilder instead of StringBuffer, misc optimizations
Modified: common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java 2009-09-16 17:19:08 UTC (rev 10706)
+++ common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java 2009-09-16 17:20:16 UTC (rev 10707)
@@ -228,7 +228,7 @@
public static Element createElement(String localPart)
{
Document doc = getOwnerDocument();
- log.trace("createElement {}" + localPart);
+ if (log.isTraceEnabled()) log.trace("createElement {}" + localPart);
return doc.createElement(localPart);
}
@@ -237,7 +237,7 @@
public static Element createElement(String localPart, String prefix)
{
Document doc = getOwnerDocument();
- log.trace("createElement {}" + prefix + ":" + localPart);
+ if (log.isTraceEnabled()) log.trace("createElement {}" + prefix + ":" + localPart);
return doc.createElement(prefix + ":" + localPart);
}
@@ -248,12 +248,12 @@
Document doc = getOwnerDocument();
if (prefix == null || prefix.length() == 0)
{
- log.trace("createElement {" + uri + "}" + localPart);
+ if (log.isTraceEnabled()) log.trace("createElement {" + uri + "}" + localPart);
return doc.createElementNS(uri, localPart);
}
else
{
- log.trace("createElement {" + uri + "}" + prefix + ":" + localPart);
+ if (log.isTraceEnabled()) log.trace("createElement {" + uri + "}" + prefix + ":" + localPart);
return doc.createElementNS(uri, prefix + ":" + localPart);
}
}
@@ -421,7 +421,8 @@
{
Map attmap = new HashMap();
NamedNodeMap attribs = el.getAttributes();
- for (int i = 0; i < attribs.getLength(); i++)
+ int len = attribs.getLength();
+ for (int i = 0; i < len; i++)
{
Attr attr = (Attr)attribs.item(i);
String name = attr.getName();
@@ -437,7 +438,8 @@
public static void copyAttributes(Element destElement, Element srcElement)
{
NamedNodeMap attribs = srcElement.getAttributes();
- for (int i = 0; i < attribs.getLength(); i++)
+ int len = attribs.getLength();
+ for (int i = 0; i < len; i++)
{
Attr attr = (Attr)attribs.item(i);
String uri = attr.getNamespaceURI();
@@ -448,7 +450,7 @@
// change an object in a way which is incorrect with regard to namespaces.
if (uri == null && qname.startsWith("xmlns"))
{
- log.trace("Ignore attribute: [uri=" + uri + ",qname=" + qname + ",value=" + value + "]");
+ if (log.isTraceEnabled()) log.trace("Ignore attribute: [uri=" + uri + ",qname=" + qname + ",value=" + value + "]");
}
else
{
@@ -462,10 +464,11 @@
public static boolean hasTextChildNodesOnly(Node node)
{
NodeList nodeList = node.getChildNodes();
- if (nodeList.getLength() == 0)
+ int len = nodeList.getLength();
+ if (len == 0)
return false;
- for (int i = 0; i < nodeList.getLength(); i++)
+ for (int i = 0; i < len; i++)
{
Node acksToChildNode = nodeList.item(i);
if (acksToChildNode.getNodeType() != Node.TEXT_NODE)
@@ -480,7 +483,8 @@
public static boolean hasChildElements(Node node)
{
NodeList nlist = node.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
+ int len = nlist.getLength();
+ for (int i = 0; i < len; i++)
{
Node child = nlist.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE)
@@ -495,7 +499,8 @@
{
List<Element> list = new LinkedList<Element>();
NodeList nlist = node.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
+ int len = nlist.getLength();
+ for (int i = 0; i < len; i++)
{
Node child = nlist.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE)
@@ -509,9 +514,10 @@
public static String getTextContent(Node node)
{
boolean hasTextContent = false;
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
NodeList nlist = node.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
+ int len = nlist.getLength();
+ for (int i = 0; i < len; i++)
{
Node child = nlist.item(i);
if (child.getNodeType() == Node.TEXT_NODE)
@@ -629,7 +635,8 @@
List<Element> list = new LinkedList<Element>();
NodeList nlist = node.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
+ int len = nlist.getLength();
+ for (int i = 0; i < len; i++)
{
Node child = nlist.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE)
@@ -665,7 +672,8 @@
if (recursive)
{
NodeList nlist = baseElement.getChildNodes();
- for (int i = 0; i < nlist.getLength(); i++)
+ int len = nlist.getLength();
+ for (int i = 0; i < len; i++)
{
Node child = nlist.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE)
Modified: common/trunk/src/main/java/org/jboss/wsf/common/DOMWriter.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/DOMWriter.java 2009-09-16 17:19:08 UTC (rev 10706)
+++ common/trunk/src/main/java/org/jboss/wsf/common/DOMWriter.java 2009-09-16 17:20:16 UTC (rev 10707)
@@ -267,7 +267,8 @@
case Node.DOCUMENT_NODE:
{
NodeList children = node.getChildNodes();
- for (int iChild = 0; iChild < children.getLength(); iChild++)
+ int len = children.getLength();
+ for (int iChild = 0; iChild < len; iChild++)
{
printInternal(children.item(iChild), false);
}
@@ -577,9 +578,9 @@
/** Normalizes the given string. */
public static String normalize(String s, boolean canonical)
{
- StringBuffer str = new StringBuffer();
+ int len = (s != null) ? s.length() : 0;
+ StringBuilder str = new StringBuilder();
- int len = (s != null) ? s.length() : 0;
for (int i = 0; i < len; i++)
{
char ch = s.charAt(i);
Modified: common/trunk/src/main/java/org/jboss/wsf/common/IOUtils.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/IOUtils.java 2009-09-16 17:19:08 UTC (rev 10706)
+++ common/trunk/src/main/java/org/jboss/wsf/common/IOUtils.java 2009-09-16 17:20:16 UTC (rev 10707)
@@ -128,7 +128,7 @@
{
int capacity = 1024;
char[] charBuffer = new char[capacity];
- StringBuffer strBuffer = new StringBuffer(capacity);
+ StringBuilder strBuffer = new StringBuilder(capacity);
int len = reader.read(charBuffer, 0, capacity);
while (len > 0)
15 years, 3 months
JBossWS SVN: r10706 - framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-16 13:19:08 -0400 (Wed, 16 Sep 2009)
New Revision: 10706
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AbstractRecordProcessor.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/LogRecorder.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java
Log:
[JBWS-2763] Using StringBuilder instead of StringBuffer
Modified: framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AbstractRecordProcessor.java
===================================================================
--- framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AbstractRecordProcessor.java 2009-09-16 17:15:41 UTC (rev 10705)
+++ framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AbstractRecordProcessor.java 2009-09-16 17:19:08 UTC (rev 10706)
@@ -179,7 +179,7 @@
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(super.toString());
sb.append(" (recording = " + recording);
sb.append(", processDestinationHost = " + processDestinationHost);
Modified: framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/LogRecorder.java
===================================================================
--- framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/LogRecorder.java 2009-09-16 17:15:41 UTC (rev 10705)
+++ framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/LogRecorder.java 2009-09-16 17:19:08 UTC (rev 10706)
@@ -49,7 +49,7 @@
@Override
public void processRecord(Record record)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (this.isProcessMessageType())
{
if (record.getMessageType() == MessageType.INBOUND)
Modified: framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java
===================================================================
--- framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java 2009-09-16 17:15:41 UTC (rev 10705)
+++ framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java 2009-09-16 17:19:08 UTC (rev 10706)
@@ -192,7 +192,7 @@
private String toHtml(boolean groupRecords, boolean showDetails, Map<String, List<Record>> records)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("</pre></span>");
if (!groupRecords)
openTable(sb, showDetails);
@@ -213,7 +213,7 @@
return sb.toString();
}
- private void openTable(StringBuffer sb, boolean showDetails)
+ private void openTable(StringBuilder sb, boolean showDetails)
{
sb.append("<table border='1'><tr class='AttributesHeader'><th>Group ID</th><th>Type</th><th>Date</th><th>From</th><th>To</th><th>Operation</th>");
if (showDetails)
@@ -221,12 +221,12 @@
sb.append("</tr><tr>");
}
- private void closeTable(StringBuffer sb)
+ private void closeTable(StringBuilder sb)
{
sb.append("</tr></table><br />");
}
- private void appendRecordRow(StringBuffer sb, Record record, boolean showDetails) {
+ private void appendRecordRow(StringBuilder sb, Record record, boolean showDetails) {
sb.append("<tr><td><pre>");
sb.append(record.getGroupID() != null ? record.getGroupID() : "[Not available]");
sb.append("</pre></td>");
15 years, 3 months
JBossWS SVN: r10705 - in stack/native/trunk/modules/core/src/main/java/org/jboss/ws: metadata/umdm and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-16 13:15:41 -0400 (Wed, 16 Sep 2009)
New Revision: 10705
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
Log:
[JBWS-2763] Using StringBuilder instead of StringBuffer
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java 2009-09-16 17:14:23 UTC (rev 10704)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java 2009-09-16 17:15:41 UTC (rev 10705)
@@ -57,7 +57,7 @@
public String toString()
{
- StringBuffer sb = new StringBuffer(100);
+ StringBuilder sb = new StringBuilder(100);
sb.append('[');
sb.append("name=").append(name);
sb.append(",value=").append(value);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java 2009-09-16 17:14:23 UTC (rev 10704)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.java 2009-09-16 17:15:41 UTC (rev 10705)
@@ -81,7 +81,7 @@
public String toString()
{
- StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXRPC:");
+ StringBuilder buffer = new StringBuilder("\nHandlerMetaDataJAXRPC:");
buffer.append("\n type=" + getHandlerType());
buffer.append("\n name=" + getHandlerName());
buffer.append("\n class=" + getHandlerClassName());
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java 2009-09-16 17:14:23 UTC (rev 10704)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java 2009-09-16 17:15:41 UTC (rev 10705)
@@ -97,7 +97,7 @@
public String toString()
{
- StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXWS:");
+ StringBuilder buffer = new StringBuilder("\nHandlerMetaDataJAXWS:");
buffer.append("\n type=" + getHandlerType());
buffer.append("\n name=" + getHandlerName());
buffer.append("\n class=" + getHandlerClass());
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2009-09-16 17:14:23 UTC (rev 10704)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2009-09-16 17:15:41 UTC (rev 10705)
@@ -211,7 +211,7 @@
String javaClassPath = System.getProperty("java.class.path");
if(additionalCompilerClassPath.isEmpty() == false)
{
- StringBuffer javaCP = new StringBuffer();
+ StringBuilder javaCP = new StringBuilder();
for(String s : additionalCompilerClassPath)
{
javaCP.append(s).append(File.pathSeparator);
15 years, 3 months
JBossWS SVN: r10704 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-16 13:14:23 -0400 (Wed, 16 Sep 2009)
New Revision: 10704
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
Log:
[JBWS-2763] Making field static
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2009-09-16 17:13:09 UTC (rev 10703)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2009-09-16 17:14:23 UTC (rev 10704)
@@ -94,7 +94,7 @@
public class ServiceDelegateImpl extends ServiceDelegate
{
// provide logging
- private final Logger log = Logger.getLogger(ServiceDelegateImpl.class);
+ private static final Logger log = Logger.getLogger(ServiceDelegateImpl.class);
// The executor service
private static ExecutorService defaultExecutor = Executors.newCachedThreadPool();
15 years, 3 months