[Commits] (bcm) bug #2582: updating a user was resetting his dateCreated to null, which was

commits at osafoundation.org commits at osafoundation.org
Mon Apr 11 17:10:08 PDT 2005


Commit by: bcm
Modified files:
server/web/src/org/osaf/cosmo/ui/UserAction.java 1.2 1.3

Log message:
bug #2582: updating a user was resetting his dateCreated to null, which was
causing hibernate to bomb. switched database from hsqldb to mysql, whose
driver gave a much more useful exception message. fixed, tho in a non-optimal
manner that needs to be addressed.


Bugzilla links:
http://bugzilla.osafoundation.org/show_bug.cgi?id=2582

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/server/web/src/org/osaf/cosmo/ui/UserAction.java.diff?r1=text&tr1=1.2&r2=text&tr2=1.3

Index: server/web/src/org/osaf/cosmo/ui/UserAction.java
diff -u server/web/src/org/osaf/cosmo/ui/UserAction.java:1.2 server/web/src/org/osaf/cosmo/ui/UserAction.java:1.3
--- server/web/src/org/osaf/cosmo/ui/UserAction.java:1.2	Fri Apr  8 16:53:28 2005
+++ server/web/src/org/osaf/cosmo/ui/UserAction.java	Mon Apr 11 17:10:06 2005
@@ -266,6 +266,17 @@
             Role role = mgr.getRole(roles[i]);
             user.addRole(role);
         }
+
+        // XXX: here's an ugly hack to work around the fact that the
+        // form does not contain the user's creation date. it's
+        // probably cleaner to just put the username and email fields
+        // into the form directly and stop having the form pass around
+        // a User, since the current approach makes us think the
+        // form's User is capable of being used directly for an
+        // update, and as this method shows, it's clearly not.
+        User storedUser = mgr.getUser(user.getUsername());
+        user.setDateCreated(storedUser.getDateCreated());
+
         return user;
     }
 



More information about the Commits mailing list