You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2009/11/24 01:03:57 UTC

svn commit: r883553 - /incubator/jspwiki/trunk/src/java/org/apache/wiki/content/WikiPath.java

Author: jalkanen
Date: Tue Nov 24 00:03:55 2009
New Revision: 883553

URL: http://svn.apache.org/viewvc?rev=883553&view=rev
Log:
Equality is now determined in a case-insensitive manner.

Modified:
    incubator/jspwiki/trunk/src/java/org/apache/wiki/content/WikiPath.java

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/WikiPath.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/WikiPath.java?rev=883553&r1=883552&r2=883553&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/WikiPath.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/WikiPath.java Tue Nov 24 00:03:55 2009
@@ -193,22 +193,24 @@
      * String representation. This is to fulfil the general contract of
      * equals().
      * 
-     * @return int
+     * @return {@inheritDoc}
      */
+    // FIXME: Slow, since it creates a new String every time.
     public int hashCode()
     {
-        return m_stringRepresentation.hashCode();
+        return m_stringRepresentation.toLowerCase().hashCode();
     }
 
     /**
      * A WikiPath is compared using it's toString() method.
      * 
      * @param o The Object to compare against.
-     * @return int
+     * @return {@inheritDoc}
      */
+    // FIXME: Slow, since it creates a new String every time.
     public int compareTo( WikiPath o )
     {
-        return toString().compareTo( o.toString() );
+        return toString().toLowerCase().compareTo( o.toString().toLowerCase() );
     }
 
     /**
@@ -226,11 +228,11 @@
         {
             WikiPath n = (WikiPath) o;
 
-            return m_space.equals( n.m_space ) && m_path.equals( n.m_path );
+            return m_space.equalsIgnoreCase( n.m_space ) && m_path.equalsIgnoreCase( n.m_path );
         }
         else if( o instanceof String )
         {
-            return toString().equals( o );
+            return toString().equalsIgnoreCase( (String)o );
         }
         return false;
     }