[jbossws-commits] JBossWS SVN: r3534 - trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Jun 11 12:10:05 EDT 2007


Author: heiko.braun at jboss.com
Date: 2007-06-11 12:10:05 -0400 (Mon, 11 Jun 2007)
New Revision: 3534

Modified:
   trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.java
Log:
Avoid double initialization

Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.java	2007-06-11 14:05:40 UTC (rev 3533)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.java	2007-06-11 16:10:05 UTC (rev 3534)
@@ -80,7 +80,9 @@
 
    private Map<QName, AddressingType> addrTypes = new HashMap<QName, AddressingType>();
 
-   public AttributedURI getTo()
+	private boolean initialized = false;
+	
+	public AttributedURI getTo()
    {
       return to;
    }
@@ -166,10 +168,12 @@
     */
    public void initializeAsDestination(EndpointReference epr)
    {
-      if (epr == null)
+		if(initialized) return;
+		
+		if (epr == null)
          throw new IllegalArgumentException("Invalid null endpoint reference");
 
-      this.to = epr.getAddress();
+		this.to = epr.getAddress();
       
       ReferenceParameters srcParams = epr.getReferenceParameters();
       for (Object obj : srcParams.getElements())
@@ -178,8 +182,10 @@
          soapElement.setAttributeNS(getNamespaceURI(), "wsa:IsReferenceParameter", "true");
          addElement(soapElement);
       }
-   }
 
+		this.initialized = true;
+	}
+
    /**
     * Initialize this <code>AddressingProperties</code> as a reply to the 
     * given message.  As described in the WS-Addressing Core specification.  
@@ -193,7 +199,9 @@
     */
    public void initializeAsReply(AddressingProperties props, boolean isFault)
    {
-      EndpointReference epr = (isFault ? props.getFaultTo() : null);
+		if(initialized) return;
+		
+		EndpointReference epr = (isFault ? props.getFaultTo() : null);
       if (epr == null)
       {
          epr = props.getReplyTo();
@@ -216,8 +224,10 @@
          Relationship rel = builder.newRelationship(props.getMessageID().getURI());
          this.relatesTo = new Relationship[] { rel };
       }
-   }
 
+		this.initialized = true;
+	}
+
    // Map interface ****************************************************************
 
    public int size()




More information about the jbossws-commits mailing list