Author: ieb
Date: Wed Aug 27 12:07:33 2008
New Revision: 689567

URL: http://svn.apache.org/viewvc?rev=689567&view=rev
Log:
Some of the default implementations of teh model are leaking mutable objects 
via the interface that
will encourage mutation of those object. In turn this will lead to inconsisten 
behaviour depending on
the SPI implementation.

Modified:
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityImpl.java
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/OrganizationImpl.java
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityImpl.java?rev=689567&r1=689566&r2=689567&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityImpl.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityImpl.java
 Wed Aug 27 12:07:33 2008
@@ -94,11 +94,18 @@
   }
 
   public Date getUpdated() {
-    return updated;
+    if ( updated == null ) {
+      return null;
+    }
+    return new Date(updated.getTime());
   }
 
   public void setUpdated(Date updated) {
-    this.updated = updated;
+    if ( updated == null ) {
+      this.updated = null;
+    } else {
+      this.updated = new Date(updated.getTime());
+    }
   }
 
   public List<MediaItem> getMediaItems() {

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/OrganizationImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/OrganizationImpl.java?rev=689567&r1=689566&r2=689567&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/OrganizationImpl.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/OrganizationImpl.java
 Wed Aug 27 12:07:33 2008
@@ -53,11 +53,18 @@
   }
 
   public Date getEndDate() {
-    return endDate;
+    if ( endDate == null ) {
+      return null;
+    }
+    return new Date(endDate.getTime());
   }
 
   public void setEndDate(Date endDate) {
-    this.endDate = endDate;
+    if ( endDate == null ) {
+      this.endDate = null;
+    } else {
+      this.endDate = new Date(endDate.getTime());
+    }
   }
 
   public String getField() {
@@ -85,11 +92,18 @@
   }
 
   public Date getStartDate() {
-    return startDate;
+    if ( startDate == null ) {
+      return null;
+    } 
+    return new Date(startDate.getTime());
   }
 
   public void setStartDate(Date startDate) {
-    this.startDate = startDate;
+    if ( startDate == null ) {
+      this.startDate = null;
+    } else {
+      this.startDate = new Date(startDate.getTime());
+    }
   }
 
   public String getSubField() {

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java?rev=689567&r1=689566&r2=689567&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
 Wed Aug 27 12:07:33 2008
@@ -186,11 +186,18 @@
   }
 
   public Date getBirthday() {
-    return birthday;
+    if ( birthday == null ) {
+      return null;
+    } 
+    return new Date(birthday.getTime());
   }
 
   public void setBirthday(Date birthday) {
-    this.birthday = birthday;
+    if ( birthday == null ) {
+      this.birthday = null;
+    } else {
+      this.birthday = new Date(birthday.getTime());
+    }
   }
 
   public Enum<Enum.Drinker> getDrinker() {
@@ -314,11 +321,18 @@
   }
 
   public Date getUpdated() {
-    return updated;
+    if ( updated == null ) {
+      return null;
+    }
+    return new Date(updated.getTime());
   }
 
   public void setUpdated(Date updated) {
-    this.updated = updated;
+    if ( updated == null ) {
+      this.updated = updated;
+    } else {
+      this.updated = new Date(updated.getTime());
+    }
   }
 
   public String getLivingArrangement() {


Reply via email to