Author: heiko.braun(a)jboss.com
Date: 2007-11-08 08:31:55 -0500 (Thu, 08 Nov 2007)
New Revision: 5012
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java
common/trunk/src/main/java/org/jboss/wsf/common/IOUtils.java
common/trunk/version.properties
Log:
JBWS-1903: DOMUtils doesn't clear thread locals
Modified: common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java 2007-11-08 10:35:23 UTC
(rev 5011)
+++ common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java 2007-11-08 13:31:55 UTC
(rev 5012)
@@ -114,6 +114,12 @@
}
};
+ public static void clearThreadLocals()
+ {
+ documentThreadLocal.remove();
+ builderThreadLocal.remove();
+ }
+
// Hide the constructor
private DOMUtils()
{
Modified: common/trunk/src/main/java/org/jboss/wsf/common/IOUtils.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/IOUtils.java 2007-11-08 10:35:23 UTC
(rev 5011)
+++ common/trunk/src/main/java/org/jboss/wsf/common/IOUtils.java 2007-11-08 13:31:55 UTC
(rev 5012)
@@ -63,27 +63,47 @@
*/
public static void copyStream(OutputStream outs, InputStream ins) throws IOException
{
- byte[] bytes = new byte[1024];
- int r = ins.read(bytes);
- while (r > 0)
+ try
{
- outs.write(bytes, 0, r);
- r = ins.read(bytes);
+ byte[] bytes = new byte[1024];
+ int r = ins.read(bytes);
+ while (r > 0)
+ {
+ outs.write(bytes, 0, r);
+ r = ins.read(bytes);
+ }
}
+ catch (IOException e)
+ {
+ throw e;
+ }
+ finally{
+ ins.close();
+ }
}
/** Copy the reader to the output stream
*/
public static void copyReader(OutputStream outs, Reader reader) throws IOException
{
- OutputStreamWriter writer = new OutputStreamWriter(outs);
- char[] bytes = new char[1024];
- int r = reader.read(bytes);
- while (r > 0)
+ try
{
- writer.write(bytes, 0, r);
- r = reader.read(bytes);
+ OutputStreamWriter writer = new OutputStreamWriter(outs);
+ char[] bytes = new char[1024];
+ int r = reader.read(bytes);
+ while (r > 0)
+ {
+ writer.write(bytes, 0, r);
+ r = reader.read(bytes);
+ }
}
+ catch (IOException e)
+ {
+ throw e;
+ }
+ finally{
+ reader.close();
+ }
}
public static byte[] convertToBytes(DataHandler dh)
@@ -106,17 +126,27 @@
*/
public static InputStream transformReader(Reader reader) throws IOException
{
- int capacity = 1024;
- char[] charBuffer = new char[capacity];
- StringBuffer strBuffer = new StringBuffer(capacity);
+ try
+ {
+ int capacity = 1024;
+ char[] charBuffer = new char[capacity];
+ StringBuffer strBuffer = new StringBuffer(capacity);
- int len = reader.read(charBuffer, 0, capacity);
- while (len > 0)
+ int len = reader.read(charBuffer, 0, capacity);
+ while (len > 0)
+ {
+ strBuffer.append(charBuffer, 0, len);
+ len = reader.read(charBuffer, 0, capacity);
+ }
+ return new ByteArrayInputStream(strBuffer.toString().getBytes());
+ }
+ catch (IOException e)
{
- strBuffer.append(charBuffer, 0, len);
- len = reader.read(charBuffer, 0, capacity);
+ throw e;
}
- return new ByteArrayInputStream(strBuffer.toString().getBytes());
+ finally{
+ reader.close();
+ }
}
public static File createTempDirectory() throws IOException
Modified: common/trunk/version.properties
===================================================================
--- common/trunk/version.properties 2007-11-08 10:35:23 UTC (rev 5011)
+++ common/trunk/version.properties 2007-11-08 13:31:55 UTC (rev 5012)
@@ -6,9 +6,8 @@
specification.version=jbossws-2.0
version.id=1.0.1.GA
-repository.id=1.0.1.GA
+repository.id=snapshot
-implementation.title=JBoss Web Services - Common
implementation.url=http://www.jboss.org/products/jbossws
implementation.vendor=JBoss Inc.
implementation.vendor.id=http://www.jboss.org