[portal-commits] JBoss Portal SVN: r6048 - in branches/JBoss_Portal_Branch_2_4: api/src/main/org/jboss/portal and 2 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Fri Jan 19 10:30:24 EST 2007


Author: julien at jboss.com
Date: 2007-01-19 10:30:24 -0500 (Fri, 19 Jan 2007)
New Revision: 6048

Modified:
   branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/PortletMode.java
   branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/WindowState.java
   branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/Mode.java
   branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/WindowState.java
   branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/WEB-INF/jboss-web.xml
   branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test-war/WEB-INF/jboss-web.xml
Log:
JBPORTAL-1209 : PortletMode and WindowState should use the correct to lower case conversion

Modified: branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/PortletMode.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/PortletMode.java	2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/PortletMode.java	2007-01-19 15:30:24 UTC (rev 6048)
@@ -22,6 +22,8 @@
  ******************************************************************************/
 package javax.portlet;
 
+import java.util.Locale;
+
 /**
  * The <CODE>PortletMode</CODE> class represents the possible modes that a portlet can assume.
  * <p/>
@@ -93,7 +95,7 @@
       {
          throw new NullPointerException();
       }
-      this.name = name.toLowerCase();
+      this.name = name.toLowerCase(Locale.ENGLISH);
    }
 
    /**
@@ -105,9 +107,14 @@
     */
    public boolean equals(Object o)
    {
+      if (o == this)
+      {
+         return true;
+      }
       if (o instanceof PortletMode)
       {
-         return o == this || name.equals(((PortletMode)o).name);
+         PortletMode that = (PortletMode)o;
+         return name.equals(that.name);
       }
       return false;
    }
@@ -132,5 +139,4 @@
    {
       return name;
    }
-
 }

Modified: branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/WindowState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/WindowState.java	2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/WindowState.java	2007-01-19 15:30:24 UTC (rev 6048)
@@ -22,6 +22,8 @@
  ******************************************************************************/
 package javax.portlet;
 
+import java.util.Locale;
+
 /**
  * The <CODE>WindowState</CODE> class represents the possible window states that a portlet window can assume.
  * <p/>
@@ -77,21 +79,26 @@
       {
          throw new NullPointerException();
       }
-      this.name = name.toLowerCase();
+      this.name = name.toLowerCase(Locale.ENGLISH);
    }
 
    /**
     * Compares the specified object with this window state for equality. Returns <code>true</code> if the Strings
     * <code>equals</code> method for the String representing the two window states returns <code>true</code>.
     *
-    * @param the window state to compare this window state with.
+    * @param o the window state to compare this window state with.
     * @return true, if the specified object is equal with this window state.
     */
    public boolean equals(Object o)
    {
+      if (o == this)
+      {
+         return true;
+      }
       if (o instanceof WindowState)
       {
-         return o == this || name.equals(((WindowState)o).name);
+         WindowState that = (WindowState)o;
+         return name.equals(that.name);
       }
       return false;
    }
@@ -116,5 +123,4 @@
    {
       return name;
    }
-
 }

Modified: branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/Mode.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/Mode.java	2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/Mode.java	2007-01-19 15:30:24 UTC (rev 6048)
@@ -23,6 +23,7 @@
 package org.jboss.portal;
 
 import java.io.Serializable;
+import java.util.Locale;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -53,16 +54,21 @@
    {
       if (name == null)
       {
-         throw new NullPointerException();
+         throw new IllegalArgumentException("Mode cannot be null");
       }
-      this.name = name;
+      this.name = name.toLowerCase(Locale.ENGLISH);
    }
 
    public boolean equals(Object o)
    {
+      if (o == this)
+      {
+         return true;
+      }
       if (o instanceof Mode)
       {
-         return o == this || name.equalsIgnoreCase(((Mode)o).name);
+         Mode that = (Mode)o;
+         return name.equals(that.name);
       }
       return false;
    }
@@ -79,19 +85,19 @@
 
    private Object readResolve()
    {
-      if (VIEW.name.equalsIgnoreCase(name))
+      if (VIEW.name.equals(name))
       {
          return VIEW;
       }
-      else if (EDIT.name.equalsIgnoreCase(name))
+      else if (EDIT.name.equals(name))
       {
          return EDIT;
       }
-      else if (HELP.name.equalsIgnoreCase(name))
+      else if (HELP.name.equals(name))
       {
          return HELP;
       }
-      else if (EDIT_DEFAULTS.name.equalsIgnoreCase(name))
+      else if (EDIT_DEFAULTS.name.equals(name))
       {
          return EDIT_DEFAULTS;
       }
@@ -103,19 +109,19 @@
 
    public static Mode create(String s)
    {
-      if (Mode.VIEW.name.equalsIgnoreCase(s))
+      if (Mode.VIEW.name.equals(s))
       {
          return Mode.VIEW;
       }
-      else if (Mode.EDIT.name.equalsIgnoreCase(s))
+      else if (Mode.EDIT.name.equals(s))
       {
          return Mode.EDIT;
       }
-      else if (Mode.HELP.name.equalsIgnoreCase(s))
+      else if (Mode.HELP.name.equals(s))
       {
          return Mode.HELP;
       }
-      else if (Mode.EDIT_DEFAULTS.name.equalsIgnoreCase(s))
+      else if (Mode.EDIT_DEFAULTS.name.equals(s))
       {
          return Mode.VIEW;
       }

Modified: branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/WindowState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/WindowState.java	2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/WindowState.java	2007-01-19 15:30:24 UTC (rev 6048)
@@ -23,6 +23,7 @@
 package org.jboss.portal;
 
 import java.io.Serializable;
+import java.util.Locale;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -33,26 +34,38 @@
 
    /** The serialVersionUID */
    private static final long serialVersionUID = -6305311518934458562L;
+
+   /** . */
    public static final WindowState NORMAL = new WindowState("normal");
+
+   /** . */
    public static final WindowState MINIMIZED = new WindowState("minimized");
+
+   /** . */
    public static final WindowState MAXIMIZED = new WindowState("maximized");
 
+   /** . */
    private String name;
 
    public WindowState(String name)
    {
       if (name == null)
       {
-         throw new IllegalArgumentException("Window state name cannot be null.");
+         throw new IllegalArgumentException("Window state name cannot be null");
       }
-      this.name = name;
+      this.name = name.toLowerCase(Locale.ENGLISH);
    }
 
    public boolean equals(Object o)
    {
+      if (o == this)
+      {
+         return true;
+      }
       if (o instanceof WindowState)
       {
-         return o == this || name.equalsIgnoreCase(((WindowState)o).name);
+         WindowState that = (WindowState)o;
+         return name.equals(that.name);
       }
       return false;
    }
@@ -69,15 +82,15 @@
 
    private Object readResolve()
    {
-      if (NORMAL.name.equalsIgnoreCase(name))
+      if (NORMAL.name.equals(name))
       {
          return NORMAL;
       }
-      else if (MAXIMIZED.name.equalsIgnoreCase(name))
+      else if (MAXIMIZED.name.equals(name))
       {
          return MAXIMIZED;
       }
-      else if (MINIMIZED.name.equalsIgnoreCase(name))
+      else if (MINIMIZED.name.equals(name))
       {
          return MINIMIZED;
       }
@@ -89,15 +102,15 @@
 
    public static WindowState create(String s)
    {
-      if (WindowState.NORMAL.toString().equalsIgnoreCase(s))
+      if (WindowState.NORMAL.name.equals(s))
       {
          return WindowState.NORMAL;
       }
-      else if (WindowState.MINIMIZED.toString().equalsIgnoreCase(s))
+      else if (WindowState.MINIMIZED.name.equals(s))
       {
          return WindowState.MINIMIZED;
       }
-      else if (WindowState.MAXIMIZED.toString().equalsIgnoreCase(s))
+      else if (WindowState.MAXIMIZED.name.equals(s))
       {
          return WindowState.MAXIMIZED;
       }

Modified: branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/WEB-INF/jboss-web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/WEB-INF/jboss-web.xml	2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/WEB-INF/jboss-web.xml	2007-01-19 15:30:24 UTC (rev 6048)
@@ -26,7 +26,7 @@
    <security-domain>java:jaas/portal</security-domain>
    <context-root>@portal.web.context-root@</context-root>
    <replication-config>
-      <replication-trigger>SET_AND_GET</replication-trigger>
+      <replication-trigger>SET</replication-trigger>
    </replication-config>
    <resource-ref>
       <res-ref-name>jdbc/PortalDS</res-ref-name>

Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test-war/WEB-INF/jboss-web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test-war/WEB-INF/jboss-web.xml	2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test-war/WEB-INF/jboss-web.xml	2007-01-19 15:30:24 UTC (rev 6048)
@@ -26,6 +26,5 @@
    <security-domain>java:/jaas/other</security-domain>
    <replication-config>
       <replication-trigger>SET</replication-trigger>
-      <replication-type>SYNC</replication-type>
    </replication-config>
 </jboss-web>




More information about the portal-commits mailing list