You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2006/05/27 15:57:42 UTC

svn commit: r409828 - in /incubator/activemq/trunk: activemq-core/src/gram/java/org/apache/activemq/openwire/tool/ activemq-core/src/gram/script/ openwire-cpp/ openwire-cpp/src/gram/ openwire-cpp/src/main/cpp/activemq/ openwire-cpp/src/main/cpp/activem...

Author: nmittler
Date: Sat May 27 06:57:41 2006
New Revision: 409828

URL: http://svn.apache.org/viewvc?rev=409828&view=rev
Log:
AMQ-656: Applying patch_060518.zip.  Moving scripts (under gram) to activemq-core. 

Added:
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/CharsetEncodingException.hpp
Removed:
    incubator/activemq/trunk/openwire-cpp/src/gram/
Modified:
    incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCppClassesScript.java
    incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppClasses.groovy
    incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppHeaders.groovy
    incubator/activemq/trunk/openwire-cpp/activemq-cpp.vcproj
    incubator/activemq/trunk/openwire-cpp/activemq-test.vcproj
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.hpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.hpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.cpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.hpp
    incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/ICharsetEncoder.hpp
    incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp

Modified: incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCppClassesScript.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCppClassesScript.java?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCppClassesScript.java (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCppClassesScript.java Sat May 27 06:57:41 2006
@@ -29,7 +29,7 @@
     public Object run() {
         filePostFix = getFilePostFix();
         if (destDir == null) {
-            destDir = new File("../openwire-cpp/src/command");
+            destDir = new File("../openwire-cpp/src/main/cpp/activemq/command");
         }
         return super.run();
     }
@@ -52,13 +52,13 @@
 		else if( name.equals("DataStructure[]") )
                 name = "IDataStructure[]" ;
 
-            return "ap<" + name.substring(0, name.length()-2) + ">";
+            return "array<" + name.substring(0, name.length()-2) + ">";
         }
         else if (name.equals("Throwable") || name.equals("Exception")) {
             return "p<BrokerError>";
         }
         else if (name.equals("ByteSequence")) {
-            return "char*";
+            return "array<char>";
         }
         else if (name.equals("boolean")) {
             return "bool";
@@ -84,6 +84,126 @@
      * Converts the Java type to a C++ default value
      */
     public String toCppDefaultValue(JClass type) {
-        return "0";
+        String name = type.getSimpleName();
+
+        if ( name.equals("boolean") ) {
+            return "false";
+        }
+        else if (!type.isPrimitiveType()) {
+            return "NULL";
+        }
+        else {
+            return "0";
+        }
+    }
+
+    /**
+     * Converts the Java type to the name of the C++ marshal method
+     * to be used
+     */
+    public String toMarshalMethodName(JClass type) {
+        String name = type.getSimpleName();
+        if (name.equals("String")) {
+            return "marshalString";
+        }
+        else if (type.isArrayType()) {
+            if ( type.getArrayComponentType().isPrimitiveType() && name.equals("byte[]") )
+                return "marshalByteArray" ;
+            else
+                return "marshalObjectArray" ;
+        }
+        else if ( name.equals("ByteSequence") ) {
+            return "marshalByteArray";
+        }
+        else if (name.equals("short") ) {
+            return "marshalShort";
+        }
+        else if (name.equals("int") ) {
+            return "marshalInt";
+        }
+        else if (name.equals("long") ) {
+            return "marshalLong";
+        }
+        else if (name.equals("byte")) {
+            return "marshalByte";
+        }
+        else if (name.equals("double")) {
+            return "marshalDouble";
+        }
+        else if (name.equals("float")) {
+            return "marshalFloat";
+        }
+        else if (name.equals("boolean")) {
+            return "marshalBoolean";
+        }
+        else if( !type.isPrimitiveType() ) {
+            return "marshalObject" ;
+        }
+        else {
+            return name ;
+        }
+    }
+
+    /**
+     * Converts the Java type to the name of the C++ unmarshal method
+     * to be used
+     */
+    public String toUnmarshalMethodName(JClass type) {
+        String name = type.getSimpleName();
+        if (name.equals("String")) {
+            return "unmarshalString";
+        }
+        else if (type.isArrayType()) {
+            if ( type.getArrayComponentType().isPrimitiveType() && name.equals("byte[]") )
+                return "unmarshalByteArray" ;
+            else
+                return "unmarshalObjectArray" ;
+        }
+        else if ( name.equals("ByteSequence") ) {
+            return "unmarshalByteArray";
+        }
+        else if (name.equals("short") ) {
+            return "unmarshalShort";
+        }
+        else if (name.equals("int") ) {
+            return "unmarshalInt";
+        }
+        else if (name.equals("long") ) {
+            return "unmarshalLong";
+        }
+        else if (name.equals("byte")) {
+            return "unmarshalByte";
+        }
+        else if (name.equals("double")) {
+            return "unmarshalDouble";
+        }
+        else if (name.equals("float")) {
+            return "unmarshalFloat";
+        }
+        else if (name.equals("boolean")) {
+            return "unmarshalBoolean";
+        }
+        else if( !type.isPrimitiveType() ) {
+            return "unmarshalObject" ;
+        }
+        else {
+            return name ;
+        }
+    }
+
+    /**
+     * Converts the Java type to a C++ pointer cast
+     */
+    public String toUnmarshalCast(JClass type) {
+        String name = toCppType(type) ;
+
+        if( name.startsWith("p<") )
+            return "p_cast<" + name.substring(2) ;
+        else if( name.startsWith("array<") &&
+                 (type.isArrayType() && !type.getArrayComponentType().isPrimitiveType()) &&
+                 !type.getSimpleName().equals("ByteSequence") )
+            return "array_cast<" + name.substring(6) ;
+        else
+            return "" ;
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppClasses.groovy
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppClasses.groovy?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppClasses.groovy (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppClasses.groovy Sat May 27 06:57:41 2006
@@ -1,92 +1,125 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import org.apache.activemq.openwire.tool.OpenWireCppClassesScript
-
-/**
- * Generates the C++ commands for the Open Wire Format
- *
- * @version $Revision$
- */
-class GenerateCppClasses extends OpenWireCppClassesScript {
-
-	void generateFile(PrintWriter out) {
-                out << """/*
-* Copyright 2006 The Apache Software Foundation or its licensors, as
-* applicable.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#include "command/${className}.hpp"
-
-using namespace apache::activemq::client::command;
-
-/*
- *
- *  Marshalling code for Open Wire Format for ${className}
- *
- *
- *  NOTE!: This file is autogenerated - do not modify!
- *         if you need to make a change, please see the Groovy scripts in the
- *         activemq-core module
- *
- */
-${className}::${className}()
-{"""
-    for (property in properties) {
-        def value = toCppDefaultValue(property.type)
-        def propertyName = property.simpleName
-        def parameterName = decapitalize(propertyName)
-        out << """
-    this->${parameterName} = ${value} ;"""
-    }
-    out << """
-}
-
-${className}::~${className}()
-{
-}
-"""
-    for (property in properties) {
-        def type = toCppType(property.type)
-        def propertyName = property.simpleName
-        def parameterName = decapitalize(propertyName)
-        out << """
-        
-${type} ${className}::get${propertyName}()
-{
-    return ${parameterName} ;
-}
-
-void ${className}::set${propertyName}(${type} ${parameterName})
-{
-    this->${parameterName} = ${parameterName} ;
-}
-"""
-
-    }
-    }
-}
\ No newline at end of file
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import org.apache.activemq.openwire.tool.OpenWireCppClassesScript
+
+/**
+ * Generates the C++ commands for the Open Wire Format
+ *
+ * @version $Revision$
+ */
+class GenerateCppClasses extends OpenWireCppClassesScript {
+
+	void generateFile(PrintWriter out) {
+                out << """/*
+* Copyright 2006 The Apache Software Foundation or its licensors, as
+* applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#include "activemq/command/${className}.hpp"
+
+using namespace apache::activemq::command;
+
+/*
+ *
+ *  Command and marshalling code for OpenWire format for ${className}
+ *
+ *
+ *  NOTE!: This file is autogenerated - do not modify!
+ *         if you need to make a change, please see the Groovy scripts in the
+ *         activemq-core module
+ *
+ */
+${className}::${className}()
+{"""
+    for (property in properties) {
+        def value = toCppDefaultValue(property.type)
+        def propertyName = property.simpleName
+        def parameterName = decapitalize(propertyName)
+        out << """
+    this->${parameterName} = ${value} ;"""
+    }
+    out << """
+}
+
+${className}::~${className}()
+{
+}
+
+unsigned char ${className}::getDataStructureType()
+{
+    return ${className}::TYPE ; 
+}
+"""
+    for (property in properties) {
+        def type = toCppType(property.type)
+        def propertyName = property.simpleName
+        def parameterName = decapitalize(propertyName)
+        out << """
+        
+${type} ${className}::get${propertyName}()
+{
+    return ${parameterName} ;
+}
+
+void ${className}::set${propertyName}(${type} ${parameterName})
+{
+    this->${parameterName} = ${parameterName} ;
+}
+"""
+    }
+out << """
+int ${className}::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> ostream) throw (IOException)
+{
+    int size = 0 ;
+
+    size += ${baseClass}::marshal(marshaller, mode, ostream) ; """
+    for (property in properties) {
+        def marshalMethod = toMarshalMethodName(property.type)
+        def propertyName = decapitalize(property.simpleName)
+        out << """
+    size += marshaller->${marshalMethod}(${propertyName}, mode, ostream) ; """
+    }
+out << """
+    return size ;
+}
+
+void ${className}::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> istream) throw (IOException)
+{
+    ${baseClass}::unmarshal(marshaller, mode, istream) ; """
+    for (property in properties) {
+        def cast = toUnmarshalCast(property.type)
+        def unmarshalMethod = toUnmarshalMethodName(property.type)
+        def propertyName = decapitalize(property.simpleName)
+        out << """
+    ${propertyName} = ${cast}(marshaller->${unmarshalMethod}(mode, istream)) ; """
+    }
+out << """
+}
+"""
+    }
+}

Modified: incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppHeaders.groovy
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppHeaders.groovy?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppHeaders.groovy (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCppHeaders.groovy Sat May 27 06:57:41 2006
@@ -40,17 +40,17 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-#ifndef ${className}_hpp_
-#define ${className}_hpp_
+#ifndef ActiveMQ_${className}_hpp_
+#define ActiveMQ_${className}_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
 
 #include <string>
 """
-if( baseClass.equals("BrokerError") )
-    out << """#include "${baseClass}.hpp"
-"""
-else
-    out << """#include "command/${baseClass}.hpp"
-    
+    out << """#include "activemq/command/${baseClass}.hpp"
 """
 for (property in properties)
 {
@@ -65,38 +65,42 @@
             if( arrayType.isPrimitiveType() )
                 continue ;
         }
-        if( includeName.startsWith("ap<") )
-            includeName = includeName.substring(3, includeName.length()-1) ;
+        if( includeName.startsWith("array<") )
+            includeName = includeName.substring(6, includeName.length()-1) ;
         else if( includeName.startsWith("p<") )
             includeName = includeName.substring(2, includeName.length()-1)
 
-        if( includeName.equals("BrokerError") )
-            out << """#include "${includeName}.hpp"
+        if( includeName.equals("IDataStructure") )
+            out << """#include "activemq/${includeName}.hpp"
 """
         else
-            out << """#include "command/${includeName}.hpp"
+            out << """#include "activemq/command/${includeName}.hpp"
 """
     }
 }
 out << """
-#include "util/ifr/ap.hpp"
-#include "util/ifr/p.hpp"
+#include "activemq/protocol/IMarshaller.hpp"
+#include "ppr/io/IOutputStream.hpp"
+#include "ppr/io/IInputStream.hpp"
+#include "ppr/io/IOException.hpp"
+#include "ppr/util/ifr/array"
+#include "ppr/util/ifr/p"
 
 namespace apache
 {
   namespace activemq
   {
-    namespace client
+    namespace command
     {
-      namespace command
-      {
-        using namespace ifr;
-        using namespace std;
-        using namespace apache::activemq::client;
+      using namespace ifr;
+      using namespace std;
+      using namespace apache::activemq;
+      using namespace apache::activemq::protocol;
+      using namespace apache::ppr::io;
 
 /*
  *
- *  Marshalling code for Open Wire Format for ${className}
+ *  Command and marshalling code for OpenWire format for ${className}
  *
  *
  *  NOTE!: This file is autogenerated - do not modify!
@@ -106,7 +110,7 @@
  */
 class ${className} : public ${baseClass}
 {
-private:
+protected:
 """
     for (property in properties) {
         def type = toCppType(property.type)
@@ -116,13 +120,13 @@
     }
     out << """
 public:
-    const static int TYPE = ${getOpenWireOpCode(jclass)};
+    const static unsigned char TYPE = ${getOpenWireOpCode(jclass)};
 
 public:
     ${className}() ;
     virtual ~${className}() ;
 
-    virtual int getCommandType() ;
+    virtual unsigned char getDataStructureType() ;
 """
     for (property in properties) {
         def type = toCppType(property.type)
@@ -134,16 +138,16 @@
 """
     }
     out << """
-
+    virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> ostream) throw (IOException) ;
+    virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> istream) throw (IOException) ;
 } ;
 
 /* namespace */
-      }
     }
   }
 }
 
-#endif /*${className}_hpp_*/
+#endif /*ActiveMQ_${className}_hpp_*/
 """
     }
-}
\ No newline at end of file
+}

Modified: incubator/activemq/trunk/openwire-cpp/activemq-cpp.vcproj
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/activemq-cpp.vcproj?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/activemq-cpp.vcproj (original)
+++ incubator/activemq/trunk/openwire-cpp/activemq-cpp.vcproj Sat May 27 06:57:41 2006
@@ -105,8 +105,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				AdditionalIncludeDirectories="src\main\cpp"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0400"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(IntDir)\amqlib.pdb"
@@ -1096,6 +1096,10 @@
 						</File>
 						<File
 							RelativePath=".\src\main\cpp\ppr\io\encoding\CharsetEncoderRegistry.hpp"
+							>
+						</File>
+						<File
+							RelativePath=".\src\main\cpp\ppr\io\encoding\CharsetEncodingException.hpp"
 							>
 						</File>
 						<File

Modified: incubator/activemq/trunk/openwire-cpp/activemq-test.vcproj
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/activemq-test.vcproj?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/activemq-test.vcproj (original)
+++ incubator/activemq/trunk/openwire-cpp/activemq-test.vcproj Sat May 27 06:57:41 2006
@@ -119,10 +119,10 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				AdditionalIncludeDirectories="src\main\cpp"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0400"
 				RuntimeLibrary="2"
-				UsePrecompiledHeader="2"
+				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(IntDir)\test.pdb"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
@@ -139,8 +139,9 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="wsock32.lib"
 				LinkIncremental="1"
-				GenerateDebugInformation="true"
+				GenerateDebugInformation="false"
 				SubSystem="1"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp Sat May 27 06:57:41 2006
@@ -248,8 +248,7 @@
 void MessageConsumer::doAcknowledge(p<Message> message)
 {
     p<MessageAck> ack = createMessageAck(message) ;
-    //cout << "Sending Ack: " << ack->getAckType() << endl ;
-    session->getConnection()->syncRequest(ack) ;
+    session->getConnection()->oneway(ack) ;
 }
 
 /*

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp Sat May 27 06:57:41 2006
@@ -32,8 +32,9 @@
  */
 OpenWireMarshaller::OpenWireMarshaller(p<WireFormatInfo> formatInfo)
 {
-    this->formatInfo = formatInfo ;
-    this->encoder    = CharsetEncoderRegistry::getEncoder() ;
+    this->formatInfo       = formatInfo ;
+    this->encoder          = CharsetEncoderRegistry::getEncoder() ;
+    this->useTightEncoding = formatInfo->getTightEncodingEnabled() ;
 }
 
 // --- Operation methods --------------------------------------------
@@ -46,7 +47,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( mode == IMarshaller::MARSHAL_WRITE )
             dos->writeBoolean(value) ;
@@ -68,7 +69,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( mode == IMarshaller::MARSHAL_WRITE )
             dos->writeByte(value) ;
@@ -90,7 +91,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( mode == IMarshaller::MARSHAL_WRITE )
             dos->writeShort(value) ;
@@ -112,7 +113,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( mode == IMarshaller::MARSHAL_WRITE )
             dos->writeInt(value) ;
@@ -134,7 +135,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( mode == IMarshaller::MARSHAL_WRITE )
             dos->writeLong(value) ;
@@ -156,7 +157,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( mode == IMarshaller::MARSHAL_WRITE )
             dos->writeFloat(value) ;
@@ -178,7 +179,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( mode == IMarshaller::MARSHAL_WRITE )
             dos->writeDouble(value) ;
@@ -200,7 +201,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( mode == IMarshaller::MARSHAL_WRITE )
         {
@@ -235,7 +236,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         int size = 0 ;
 
@@ -278,7 +279,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         int size = 0 ;
 
@@ -323,7 +324,7 @@
     // Assert that supplied output stream is a data output stream
     p<DataOutputStream> dos = checkOutputStream(ostream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         int size = 0 ;
 
@@ -367,7 +368,7 @@
  */
 int OpenWireMarshaller::marshalMap(p<PropertyMap> object, int mode, p<IOutputStream> ostream) throw(IOException)
 {
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         int size = 0 ;
 
@@ -541,7 +542,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         return dis->readBoolean() ;
     }
@@ -560,7 +561,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         return dis->readByte() ;
     }
@@ -578,7 +579,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         return dis->readShort() ;
     }
@@ -597,7 +598,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         return dis->readInt() ;
     }
@@ -616,7 +617,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         return dis->readLong() ;
     }
@@ -635,7 +636,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         return dis->readFloat() ;
     }
@@ -654,7 +655,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         return dis->readFloat() ;
     }
@@ -673,7 +674,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         if( dis->readBoolean() )
             return dis->readString() ;
@@ -695,7 +696,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         // Null marker
         if( !dis->readBoolean() )
@@ -728,7 +729,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         // Null marker
         if( !dis->readBoolean() )
@@ -766,7 +767,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         // Null marker
         if( !dis->readBoolean() )
@@ -801,7 +802,7 @@
     // Assert that supplied input stream is a data input stream
     p<DataInputStream> dis = checkInputStream(istream) ;
 
-    if( !formatInfo->getTightEncodingEnabled() )
+    if( !useTightEncoding )
     {
         // Get size of map
         int size = dis->readInt() ;

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp Sat May 27 06:57:41 2006
@@ -62,6 +62,7 @@
 private:
     p<WireFormatInfo>  formatInfo ;
     p<ICharsetEncoder> encoder ;
+    bool               useTightEncoding ;
 
 public:
     // Primitive types

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp Sat May 27 06:57:41 2006
@@ -43,6 +43,9 @@
     wireFormatInfo->setSizePrefixDisabled(false) ;
     wireFormatInfo->setTightEncodingEnabled(false) ;
 
+    // Use variable instead of map lookup for performance reason
+    this->sizePrefixDisabled = wireFormatInfo->getSizePrefixDisabled() ;
+
     // Create wire marshaller
     wireMarshaller = new OpenWireMarshaller(wireFormatInfo) ;
 }
@@ -87,7 +90,7 @@
         unsigned char dataType = object->getDataStructureType() ;
 
         // Calculate size to be marshalled if configured
-        if( !wireFormatInfo->getSizePrefixDisabled() )
+        if( !sizePrefixDisabled )
         {
             size  = 1 ; // data structure type
             size += object->marshal(wireMarshaller, IMarshaller::MARSHAL_SIZE, ostream) ;
@@ -102,7 +105,7 @@
     else   // ...NULL object
     {
         // Calculate size to be marshalled if configured
-        if( !wireFormatInfo->getSizePrefixDisabled() )
+        if( !sizePrefixDisabled )
         {
             // Calculate size to be marshalled
             size = 1 ; // data structure type
@@ -125,7 +128,7 @@
     int                size = 0 ;
 
     // Read packet size if configured
-    if( !wireFormatInfo->getSizePrefixDisabled() )
+    if( !sizePrefixDisabled )
         size = dis->readInt() ;
 
     // First byte is the data structure type

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp Sat May 27 06:57:41 2006
@@ -57,6 +57,7 @@
 private:
     p<OpenWireMarshaller> wireMarshaller ;
     p<WireFormatInfo>     wireFormatInfo ;
+    bool                  sizePrefixDisabled ;
 
     static const char NULL_TYPE ;
     static const int  PROTOCOL_VERSION ;

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp Sat May 27 06:57:41 2006
@@ -33,11 +33,11 @@
 p<Response> FutureResponse::getResponse()
 {
     // Wait for response to arrive
-    LOCKED_SCOPE (mutex);
-    while ( response == NULL )
+    LOCKED_SCOPE (mutex) ;
+    if ( response == NULL )
     {
         LOCKED_SCOPE_UNLOCK;
-        semaphore->wait(maxWait); // BUG: Why have a max wait when what you do is just to wait again and again? //dafah
+        semaphore->wait();
         LOCKED_SCOPE_RELOCK;
     }
     return response ;

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp Sat May 27 06:57:41 2006
@@ -197,7 +197,14 @@
 
         // Decode string if charset encoder has been configured
         if( encoder != NULL )
-            value = encoder->decode(value) ;
+        {
+            try {
+                value = encoder->decode(value) ;
+            }
+            catch( CharsetEncodingException &cee ) {
+                throw new IOException( cee.what() ) ;
+            }
+        }
     }
     else   // ...empty string
         value = new string("") ;

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.hpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.hpp Sat May 27 06:57:41 2006
@@ -20,6 +20,7 @@
 #include "ppr/io/IInputStream.hpp"
 #include "ppr/io/encoding/ICharsetEncoder.hpp"
 #include "ppr/io/encoding/CharsetEncoderRegistry.hpp"
+#include "ppr/io/encoding/CharsetEncodingException.hpp"
 #include "ppr/util/Endian.hpp"
 #include "ppr/util/ifr/p"
 

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp Sat May 27 06:57:41 2006
@@ -184,7 +184,14 @@
 
     // Encode string if an charset encoder has been configured
     if( encoder != NULL )
-        data = encoder->encode(value, &length) ;
+    {
+        try {
+            data = encoder->encode(value, &length) ;
+        }
+        catch( CharsetEncodingException &cee ) {
+            throw IOException( cee.what() ) ;
+        }
+    }
     else
         data = value ;
 

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.hpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.hpp Sat May 27 06:57:41 2006
@@ -20,6 +20,7 @@
 #include "ppr/io/IOutputStream.hpp"
 #include "ppr/io/encoding/ICharsetEncoder.hpp"
 #include "ppr/io/encoding/CharsetEncoderRegistry.hpp"
+#include "ppr/io/encoding/CharsetEncodingException.hpp"
 #include "ppr/util/Endian.hpp"
 #include "ppr/util/ifr/p"
 

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.cpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.cpp Sat May 27 06:57:41 2006
@@ -76,7 +76,7 @@
 /*
  * Encodes given string from ASCII into modified UTF-8.
  */
-p<string> AsciiToUTF8Encoder::encode(p<string> str, int *enclen)
+p<string> AsciiToUTF8Encoder::encode(p<string> str, int *enclen) throw (CharsetEncodingException) 
 {
     // Assert parameter
     if( str == NULL )
@@ -125,7 +125,7 @@
 /*
  * Decodes given string from modified UTF-8 into ASCII.
  */
-p<string> AsciiToUTF8Encoder::decode(p<string> str)
+p<string> AsciiToUTF8Encoder::decode(p<string> str) throw (CharsetEncodingException)
 {
     // Assert argument
     if( str == NULL || str->length() == 0 )
@@ -159,28 +159,28 @@
                 i += 2 ;
 
                 if( i > length )
-                    throw exception() ;
+                    throw CharsetEncodingException("Missing character in double pair") ;
 
                 ch2 = (*str)[i - 1] ;
                 if( (ch2 & 0xC0) != 0x80 )
-                    throw exception() ;
+                    throw CharsetEncodingException("Invalid second character in double byte pair") ;
 
                 decstr->append( 1, (char)(((ch & 0x1F) << 6) | (ch2 & 0x3F)) ) ;
                 break ;
             case 14:  // Triple bytes char, 1110xxxx 10xxxxxx 10xxxxxx
                 i += 3 ;
                 if( i > length )
-                    throw exception() ;
+                    throw CharsetEncodingException("Missing character in triple set") ;
 
                 ch2 = (*str)[i - 2] ;
                 ch3 = (*str)[i - 1] ;
                 if( ((ch2 & 0xC0) != 0x80) || ((ch3 & 0xC0) != 0x80) )
-                    throw exception();
+                    throw CharsetEncodingException("Invalid second and/or third character in triple set") ;
 
                 decstr->append( 1, (char)(((ch & 0x0F) << 12) | ((ch2 & 0x3F) << 6) | ((ch3 & 0x3F) << 0)) ) ;
                 break ;
             default:  // Unsupported, 10xxxxxx 1111xxxx
-                throw exception() ;
+                throw CharsetEncodingException("Unsupported type flag") ;
         }
     }
     return decstr ;

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.hpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/AsciiToUTF8Encoder.hpp Sat May 27 06:57:41 2006
@@ -20,6 +20,7 @@
 #include <string>
 #include <ppr/io/ByteArrayOutputStream.hpp>
 #include <ppr/io/encoding/ICharsetEncoder.hpp>
+#include <ppr/io/encoding/CharsetEncodingException.hpp>
 #include <ppr/util/ifr/array>
 #include <ppr/util/ifr/p>
 
@@ -50,8 +51,8 @@
     virtual ~AsciiToUTF8Encoder() ;
 
     virtual int length(p<string> str) ;
-    virtual p<string> encode(p<string> str, int *enclen) ;
-    virtual p<string> decode(p<string> str) ;
+    virtual p<string> encode(p<string> str, int *enclen) throw (CharsetEncodingException) ;
+    virtual p<string> decode(p<string> str) throw (CharsetEncodingException) ;
 } ;
 
 /* namespace */

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/CharsetEncodingException.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/CharsetEncodingException.hpp?rev=409828&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/CharsetEncodingException.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/CharsetEncodingException.hpp Sat May 27 06:57:41 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef Ppr_CharsetEncodingException_hpp_
+#define Ppr_CharsetEncodingException_hpp_
+
+#include "ppr/TraceException.hpp"
+
+namespace apache
+{
+  namespace ppr
+  {
+
+/*
+ * Signals that a character encoding or decoding error has occurred.
+ */
+class CharsetEncodingException : public TraceException
+{
+public:
+    CharsetEncodingException() : TraceException()
+       { /* no-op */ } ;
+    CharsetEncodingException(const char *const& msg) : TraceException(msg)
+       { /* no-op */ } ;
+    CharsetEncodingException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
+       { /* no-op */ } ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Ppr_CharsetEncodingException_hpp_*/

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/ICharsetEncoder.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/ICharsetEncoder.hpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/ICharsetEncoder.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/encoding/ICharsetEncoder.hpp Sat May 27 06:57:41 2006
@@ -18,6 +18,7 @@
 #define Ppr_ICharsetEncoder_hpp_
 
 #include <string>
+#include <ppr/io/encoding/CharsetEncodingException.hpp>
 #include "ppr/util/ifr/array"
 #include "ppr/util/ifr/p"
 
@@ -39,8 +40,8 @@
 struct ICharsetEncoder : Interface
 {
     virtual int length(p<string> str) = 0 ;
-    virtual p<string> encode(p<string> str, int *enclen) = 0 ;
-    virtual p<string> decode(p<string> str) = 0 ;
+    virtual p<string> encode(p<string> str, int *enclen) throw (CharsetEncodingException) = 0 ;
+    virtual p<string> decode(p<string> str) throw (CharsetEncodingException) = 0 ;
 } ;
 
 /* namespace */

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp?rev=409828&r1=409827&r2=409828&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp Sat May 27 06:57:41 2006
@@ -56,11 +56,10 @@
 
     // Connect to queue
     queue = session->getQueue("FOO.BAR") ;
-
+    
     // Create a consumer and producer
     consumer = session->createConsumer(queue) ;
     producer = session->createProducer(queue) ;
-    producer->setPersistent(true) ;
 
     // Create a message
     reqMessage = session->createTextMessage("Hello World!") ;
@@ -78,17 +77,26 @@
         throw TraceException("Received a null message") ;
     else
     {
+        p<string> str ;
+
         props = rspMessage->getProperties() ;
         item  = (*props)["someHeader"] ;
 
         // Verify message
-        if( rspMessage->getJMSCorrelationID()->compare("abc") != 0 )
+        str = rspMessage->getJMSCorrelationID() ;
+        if( str == NULL || str->compare("abc") != 0 )
             throw TraceException("Returned message has invalid correlation ID") ;
-        if( rspMessage->getJMSXGroupID()->compare("cheese") != 0 )
+
+        str = rspMessage->getJMSXGroupID() ;
+        if( str == NULL || str->compare("cheese") != 0 )
             throw TraceException("Returned message has invalid group ID") ;
-        if( rspMessage->getText()->compare("Hello World!") != 0 )
+
+        str = rspMessage->getText() ;
+        if( str == NULL || str->compare("Hello World!") != 0 )
             throw TraceException("Returned message has altered body text") ;
-        if( item.getString()->compare("James") != 0 )
+
+        str = item.getString() ;
+        if( str == NULL || str->compare("James") != 0 )
             throw TraceException("Returned message has invalid properties") ;
     }
 }