You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2007/03/19 13:23:25 UTC
svn commit: r519926 -
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
Author: davidillsley
Date: Mon Mar 19 05:23:25 2007
New Revision: 519926
URL: http://svn.apache.org/viewvc?view=rev&rev=519926
Log:
AXIS2-2345
Ensure that EndpointReference.readObject closes the
XMLStreamReader and ByateArrayInputStream
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java?view=diff&rev=519926&r1=519925&r2=519926
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java Mon Mar 19 05:23:25 2007
@@ -571,15 +571,27 @@
in.read(serBytes, 0, numBytes);
ByteArrayInputStream bais = new ByteArrayInputStream(serBytes);
+ XMLStreamReader xmlReader = null;
try {
- XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(bais);
+ xmlReader = StAXUtils.createXMLStreamReader(bais);
StAXOMBuilder builder = new StAXOMBuilder(xmlReader);
OMElement om = builder.getDocumentElement();
EndpointReferenceHelper.fromOM(this, om, AddressingConstants.Final.WSA_NAMESPACE);
- }
- catch (javax.xml.stream.XMLStreamException e) {
+ } catch (javax.xml.stream.XMLStreamException e) {
throw (IOException) (new IOException("Unable to deserialize the EPR")).initCause(e);
+ } finally{
+ // Make sure that the stream and reader are properly closed
+ if(xmlReader != null){
+ try{
+ xmlReader.close();
+ } catch (javax.xml.stream.XMLStreamException e) {
+ throw (IOException) (new IOException("Unable to deserialize the EPR")).initCause(e);
+ }
+ }
+ if(bais != null){
+ bais.close();
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org