You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2007/06/25 08:57:36 UTC

svn commit: r550389 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java

Author: jstrachan
Date: Sun Jun 24 23:57:35 2007
New Revision: 550389

URL: http://svn.apache.org/viewvc?view=rev&rev=550389
Log:
applied patch for issue: http://www.nabble.com/Performance-problem-in-ActiveMQ4.2-SNAPSHOT-tf3973867s2354.html#a11280202

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java?view=diff&rev=550389&r1=550388&r2=550389
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTextMessage.java Sun Jun 24 23:57:35 2007
@@ -74,10 +74,11 @@
 
     public String getText() throws JMSException {
         if (text == null && getContent() != null) {
+            InputStream is = null;
             try {
                 ByteSequence bodyAsBytes = getContent();
                 if (bodyAsBytes != null) {
-                    InputStream is = new ByteArrayInputStream(bodyAsBytes);
+                    is = new ByteArrayInputStream(bodyAsBytes);
                     if( isCompressed() ) {
                         is = new InflaterInputStream(is);
                     }
@@ -88,6 +89,16 @@
                 }
             } catch (IOException ioe) {
                 throw JMSExceptionSupport.create(ioe);
+            }
+            finally {
+                if (is != null) {
+                    try {
+                        is.close();
+                    }
+                    catch (IOException e) {
+                        // ignore
+                    }
+                }
             }
         }
         return text;