[seam-commits] Seam SVN: r8400 - in trunk/examples/wiki/src/main/org/jboss/seam/wiki/core: model and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sun Jun 22 05:19:17 EDT 2008


Author: christian.bauer at jboss.com
Date: 2008-06-22 05:19:16 -0400 (Sun, 22 Jun 2008)
New Revision: 8400

Modified:
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTextMacro.java
Log:
Don't sync profile on registration, avoid NPE

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java	2008-06-20 18:44:11 UTC (rev 8399)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java	2008-06-22 09:19:16 UTC (rev 8400)
@@ -166,8 +166,7 @@
     public String persist() {
 
         // Validate
-        if (!validateWikiTextEditors() ||
-            !isUniqueUsername() ||
+        if (!isUniqueUsername() ||
             !passwordAndControlNotNull() ||
             !passwordMatchesRegex() ||
             !passwordMatchesControl()) {
@@ -179,8 +178,6 @@
             return null;
         }
 
-        syncWikiTextEditorsToInstance();
-
         // Assign default role
         getInstance().getRoles().add(defaultRole);
 

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java	2008-06-20 18:44:11 UTC (rev 8399)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java	2008-06-22 09:19:16 UTC (rev 8400)
@@ -73,7 +73,7 @@
     }
 
     public void setBio(String bio) {
-        this.bio = bio.length() > 0 ? bio : null;
+        this.bio = bio != null && bio.length() > 0 ? bio : null;
     }
 
     public String getWebsite() {
@@ -81,7 +81,7 @@
     }
 
     public void setWebsite(String website) {
-        this.website = website.length() > 0 ? website : null;
+        this.website = website != null && website.length() > 0 ? website : null;
     }
 
     public String getLocation() {
@@ -89,7 +89,7 @@
     }
 
     public void setLocation(String location) {
-        this.location = location.length() > 0 ? location : null;
+        this.location = location != null && location.length() > 0 ? location : null;
     }
 
     public String getOccupation() {
@@ -97,7 +97,7 @@
     }
 
     public void setOccupation(String occupation) {
-        this.occupation = occupation.length() > 0 ? occupation : null;
+        this.occupation = occupation  != null && occupation.length() > 0 ? occupation : null;
     }
 
     public String getSignature() {
@@ -105,7 +105,7 @@
     }
 
     public void setSignature(String signature) {
-        this.signature = signature.length() > 0 ? signature : null;
+        this.signature = signature != null && signature.length() > 0 ? signature : null;
     }
 
     public byte[] getImage() {

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTextMacro.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTextMacro.java	2008-06-20 18:44:11 UTC (rev 8399)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTextMacro.java	2008-06-22 09:19:16 UTC (rev 8400)
@@ -8,6 +8,7 @@
 
 import java.util.TreeMap;
 import java.util.SortedMap;
+import java.util.Map;
 import java.io.Serializable;
 
 /**
@@ -70,6 +71,13 @@
         this.params = params;
     }
 
+    public String getParamValue(String paramName) {
+        for (Map.Entry<String, String> param : params.entrySet()) {
+            if (param.getKey().equals(paramName)) return param.getValue();
+        }
+        return null;
+    }
+
     public boolean equals(Object o) {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;




More information about the seam-commits mailing list