Author: alessio.soldano(a)jboss.com
Date: 2009-02-25 12:31:09 -0500 (Wed, 25 Feb 2009)
New Revision: 9395
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonMessageContext.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
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/SOAPMessageContextJAXWS.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityStore.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
Log:
[JBWS-2555] Miscellanous fix for issues reported by FindBugs
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -79,7 +79,7 @@
// provide logging
private static Logger log = Logger.getLogger(CommonClient.class);
- public static String SESSION_COOKIES =
"org.jboss.ws.maintain.session.cookies";
+ public static final String SESSION_COOKIES =
"org.jboss.ws.maintain.session.cookies";
// The endpoint together with the operationName uniquely identify the call operation
protected EndpointMetaData epMetaData;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -52,9 +52,9 @@
// expandToDOM in the SOAPContentElement should not happen during normal operation
// This property should be set the message context when it is ok to do so.
- public static String ALLOW_EXPAND_TO_DOM = "org.jboss.ws.allow.expand.dom";
+ public static final String ALLOW_EXPAND_TO_DOM =
"org.jboss.ws.allow.expand.dom";
- public static String REMOTING_METADATA = "org.jboss.ws.remoting.metadata";
+ public static final String REMOTING_METADATA =
"org.jboss.ws.remoting.metadata";
// The serialization context for this message ctx
private SerializationContext serContext;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -355,7 +355,7 @@
int nullHash = HashCodeUtil.hash(result, "null");
result = javaType!= null ? HashCodeUtil.hash(result, javaType.getName()) :
HashCodeUtil.hash(result, nullHash);
result = xmlType!= null ? HashCodeUtil.hash(result, xmlType.hashCode()):
HashCodeUtil.hash(result, nullHash);
- return new Integer(result);
+ return Integer.valueOf(result);
}
private List<KeyPair> getKeyPairsInternal(IQName xmlType, Class javaType)
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -204,6 +204,7 @@
InputStream is = new URL(servletPath).openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
endpointAddress = br.readLine();
+ br.close();
is.close();
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -42,7 +42,7 @@
{
public final static String DEFAULT_JAXB_CONTEXT_FACTORY =
"org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory";
- private static ThreadLocal threadContextCount = new ThreadLocal();
+ private static ThreadLocal<Integer> threadContextCount = new
ThreadLocal<Integer>();
public abstract JAXBContext createContext(Class[] clazzes, BindingCustomization
bindingCustomization) throws WSException;
@@ -56,21 +56,21 @@
protected void incrementContextCount()
{
Integer count = getContextCount();
- threadContextCount.set(new Integer(count + 1));
+ threadContextCount.set(Integer.valueOf(count + 1));
}
public static Integer getContextCount()
{
Integer count = (Integer)threadContextCount.get();
if (count == null)
- count = new Integer(0);
+ count = Integer.valueOf(0);
return count;
}
public static void resetContextCount()
{
- threadContextCount.set(new Integer(0));
+ threadContextCount.set(Integer.valueOf(0));
}
/**
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-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -114,7 +114,7 @@
resContext.setSOAPMessage(null);
// Reverse the direction
- resContext.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new Boolean(!outbound));
+ resContext.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,
Boolean.valueOf(!outbound));
MessageContextAssociation.pushMessageContext(resContext);
cleanupAttachments(reqContext);
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/SOAPMessageContextJAXWS.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/SOAPMessageContextJAXWS.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/SOAPMessageContextJAXWS.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -103,9 +103,12 @@
{
actor = new URI(hElement.getActor());
}
- if (roles.contains(actor) || allRoles)
+ if (actor != null)
{
- headers.add(hElement);
+ if (roles.contains(actor.toString()) || allRoles)
+ {
+ headers.add(hElement);
+ }
}
}
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -121,8 +121,7 @@
SOAPFactory factory = SOAPFactory.newInstance();
SOAPElement soapElement = factory.createElement(localName, prefix, nsURI);
- if (domElement instanceof Element)
- DOMUtils.copyAttributes(soapElement, (Element)domElement);
+ DOMUtils.copyAttributes(soapElement, domElement);
if (deep)
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -171,11 +171,15 @@
else if (source instanceof StreamSource || source instanceof SAXSource)
{
StreamSource streamSource = (StreamSource)source;
+ boolean newReader = false;
Reader reader = streamSource.getReader();
{
if (reader == null)
+ {
reader = new InputStreamReader(streamSource.getInputStream(),
"UTF-8");
+ newReader = true;
+ }
}
char[] cbuf = new char[1024];
@@ -206,6 +210,9 @@
len = reader.read(cbuf);
off = 0;
}
+
+ if (newReader)
+ reader.close();
}
else
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityStore.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityStore.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityStore.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -249,6 +249,7 @@
log.error(line);
line = reader.readLine();
}
+ reader.close();
stderr.close();
}
log.debug("Command exited with: " + status);
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -91,9 +91,14 @@
// Write updated xsd file
File xsdFile = SchemaUtils.getSchemaTempFile(ns);
FileWriter writer = new FileWriter(xsdFile);
- writer.write(xsdString);
- writer.close();
-
+ try
+ {
+ writer.write(xsdString);
+ }
+ finally
+ {
+ writer.close();
+ }
return xsdFile.toURL();
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -46,9 +46,9 @@
public class WSSecurityOMFactory implements ObjectModelFactory
{
- public static String SERVER_RESOURCE_NAME = "jboss-wsse-server.xml";
+ public static final String SERVER_RESOURCE_NAME = "jboss-wsse-server.xml";
- public static String CLIENT_RESOURCE_NAME = "jboss-wsse-client.xml";
+ public static final String CLIENT_RESOURCE_NAME = "jboss-wsse-client.xml";
private static HashMap options = new HashMap(7);
@@ -181,7 +181,7 @@
if ("timestamp-verification".equals(localName))
{
//By default, the createdTolerance should be '0'
- Long createdTolerance = new Long(0);
+ Long createdTolerance = Long.valueOf(0);
String createdToleranceAttr = attrs.getValue("",
"createdTolerance");
if (createdToleranceAttr != null)
createdTolerance =
(Long)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_LONG_NAME, createdToleranceAttr,
null);
@@ -193,13 +193,13 @@
warnCreated =
(Boolean)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_BOOLEAN_NAME, warnCreatedAttr,
null);
//By default, the expiresTolerance should be '0'
- Long expiresTolerance = new Long(0);
+ Long expiresTolerance = Long.valueOf(0);
String expiresToleranceAttr = attrs.getValue("",
"expiresTolerance");
if (expiresToleranceAttr != null)
expiresTolerance =
(Long)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_LONG_NAME, expiresToleranceAttr,
null);
//By default, we do log warnings if the tolerance is used.
- Boolean warnExpires = new Boolean(true);
+ Boolean warnExpires = Boolean.valueOf(true);
String warnExpiresAttr = attrs.getValue("", "warnExpires");
if (warnExpiresAttr != null)
warnExpires =
(Boolean)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_BOOLEAN_NAME, warnExpiresAttr,
null);
@@ -284,19 +284,19 @@
else if ("username".equals(localName))
{
//By default, we do not use password digest
- Boolean digestPassword = new Boolean(false);
+ Boolean digestPassword = Boolean.valueOf(false);
String digestPasswordAttr = attrs.getValue("",
"digestPassword");
if (digestPasswordAttr != null)
digestPassword =
(Boolean)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_BOOLEAN_NAME,
digestPasswordAttr, null);
//if password digest is enabled, we use nonces by default
- Boolean useNonce = new Boolean(true);
+ Boolean useNonce = Boolean.valueOf(true);
String useNonceAttr = attrs.getValue("", "useNonce");
if (useNonceAttr != null)
useNonce =
(Boolean)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_BOOLEAN_NAME, useNonceAttr,
null);
//if password digest is enabled, we use the created element by default
- Boolean useCreated = new Boolean(true);
+ Boolean useCreated = Boolean.valueOf(true);
String useCreatedAttr = attrs.getValue("", "useCreated");
if (useCreatedAttr != null)
useCreated =
(Boolean)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_BOOLEAN_NAME, useCreatedAttr,
null);
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -268,7 +268,7 @@
JAnnotationUse xmlTypeAnnotation = clazz.annotate(XmlType.class);
xmlTypeAnnotation.param("name", xmlType.getLocalPart());
String xmlTypeNS = xmlType.getNamespaceURI();
- if (xmlTypeNS != null & xmlTypeNS.length() > 0)
+ if (xmlTypeNS != null && xmlTypeNS.length() > 0)
{
xmlTypeAnnotation.param("namespace", xmlTypeNS);
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -57,7 +57,7 @@
private Class endpoint = null;
- public ToolsAnnotationMetaDataBuilder(ToolsEndpointMetaData tmd, String
targetNamespace, String typeNamespace2)
+ public ToolsAnnotationMetaDataBuilder(ToolsEndpointMetaData tmd, String
targetNamespace, String typeNamespace)
{
this.tmd = tmd;
this.targetNamespace = targetNamespace;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -76,7 +76,7 @@
public Result createOutput(String namespace, String file) throws IOException
{
// JBWS-1295, getKnownNamespaceURIs is not accurate
- if (namespace.length() > 0 && wsdl.getPrefix(namespace) ==
null)
+ if (namespace != null && namespace.length() > 0 &&
wsdl.getPrefix(namespace) == null)
wsdl.registerNamespaceURI(namespace, null);
// JAXB creates an empty namespace due to type references, ignore it
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -85,7 +85,7 @@
*/
public void setFeature(String name, boolean value) throws IllegalArgumentException
{
- features.put(name, new Boolean(value));
+ features.put(name, Boolean.valueOf(value));
}
/**
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -563,7 +563,6 @@
int index = classname.lastIndexOf(".");
if (index < 0)
index = classname.length();
- else index = index;
return classname.substring(0,index);
}
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -66,7 +66,7 @@
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
String address = epMetaData.getEndpointAddress();
builder.address(address);
- builder.wsdlDocumentLocation(address.toString() + "?wsdl");
+ builder.wsdlDocumentLocation(address + "?wsdl");
//TODO set other parameters in the builder
if (referenceParameters != null &&
W3CEndpointReference.class.getName().equals(clazz.getName()))
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2009-02-25
11:44:53 UTC (rev 9394)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2009-02-25
17:31:09 UTC (rev 9395)
@@ -251,7 +251,7 @@
else
{
msgContext = new SOAPMessageContextJAXWS();
- msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new
Boolean(false));
+ msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY,
Boolean.valueOf(false));
msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
invContext.addAttachment(javax.xml.ws.handler.MessageContext.class,
msgContext);
}