Author: chamikara
Date: Tue Dec  5 03:57:41 2006
New Revision: 482610

URL: http://svn.apache.org/viewvc?view=rev&rev=482610
Log:
An fix to the storage manager.


Modified:
    
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java

Modified: 
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java?view=diff&rev=482610&r1=482609&r2=482610
==============================================================================
--- 
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
 (original)
+++ 
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
 Tue Dec  5 03:57:41 2006
@@ -113,7 +113,7 @@
                
                //Now clone the env and set it in the message context
                if (envelope!=null) {
-                       envelope.build();
+                       
                        XMLStreamReader streamReader = 
envelope.cloneOMElement().getXMLStreamReader();
                        SOAPEnvelope clonedEnvelope = new 
StAXSOAPModelBuilder(streamReader, null).getSOAPEnvelope();
                        try {
@@ -147,7 +147,13 @@
                        getContext().setProperty(ENVELOPE_MAP_KEY, envMap);
                }
                
-               envMap.put(key, msgContext.getEnvelope());
+               SOAPEnvelope envelope = msgContext.getEnvelope();
+               //storing a cloned version of the envelope in the Map.
+               if (envelope!=null) {                   
+                       XMLStreamReader streamReader = 
envelope.cloneOMElement().getXMLStreamReader();
+                       SOAPEnvelope clonedEnvelope = new 
StAXSOAPModelBuilder(streamReader, null).getSOAPEnvelope();
+                       envMap.put(key, clonedEnvelope);
+               }
                
        }
 
@@ -165,33 +171,25 @@
                                        
SandeshaMessageKeys.entryNotPresentForUpdating));
                
                HashMap envMap = (HashMap) 
getContext().getProperty(ENVELOPE_MAP_KEY);
-               
-               if(envMap==null) {
-                       throw new SandeshaStorageException 
(SandeshaMessageHelper.getMessage(
-                                       
SandeshaMessageKeys.envelopeMapNotPresent));
-               }
-               
-               oldEntry = envMap.get(key);
-               if (oldEntry==null)
-                       throw new SandeshaStorageException 
(SandeshaMessageHelper.getMessage(
-                                       
SandeshaMessageKeys.entryNotPresentForUpdating));
-               
-               envMap.remove(key);
-               envMap.put(key, msgContext.getEnvelope());
+
+               storageMap.remove(key);
+               if (envMap!=null)
+                       envMap.remove(key);
                
                storeMessageContext(key,msgContext);
        }
        
        public void removeMessageContext(String key) throws 
SandeshaStorageException { 
                HashMap storageMap = (HashMap) 
getContext().getProperty(MESSAGE_MAP_KEY);
+               HashMap envelopeMap = (HashMap) 
getContext().getProperty(ENVELOPE_MAP_KEY);
                
-               if (storageMap==null) {
-                       return;
-               }
-               
-               Object entry = storageMap.get(key);
-               if (entry!=null)
+
+               if (storageMap!=null)
                        storageMap.remove(key);
+               
+               if (envelopeMap!=null)
+                       envelopeMap.remove(key);
+               
        }
        
        public void  initStorage (AxisModule moduleDesc) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to