jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r687441 - /incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiPage.java
Date Wed, 20 Aug 2008 20:11:04 GMT
Author: jalkanen
Date: Wed Aug 20 13:11:04 2008
New Revision: 687441

URL: http://svn.apache.org/viewvc?rev=687441&view=rev
Log:
Clone() was not properly cloning the ACLs.

Modified:
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiPage.java

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiPage.java?rev=687441&r1=687440&r2=687441&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiPage.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiPage.java Wed Aug 20 13:11:04 2008
@@ -21,15 +21,19 @@
 package com.ecyrd.jspwiki;
 
 import java.util.Date;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 
 import com.ecyrd.jspwiki.auth.acl.Acl;
+import com.ecyrd.jspwiki.auth.acl.AclEntry;
+import com.ecyrd.jspwiki.auth.acl.AclImpl;
 import com.ecyrd.jspwiki.providers.WikiPageProvider;
 
 /**
  *  Simple wrapper class for the Wiki page attributes.  The Wiki page
  *  content is moved around in Strings, though.
+ * @param <V>
  */
 
 // FIXME: We need to rethink how metadata is being used - probably the 
@@ -313,28 +317,35 @@
      */
     public Object clone()
     {
-        try
-        {
-            WikiPage p = (WikiPage)super.clone();
+        WikiPage p = new WikiPage( m_engine, m_name );
        
-            p.m_engine = m_engine;
-            p.m_name   = m_name;
-            p.m_wiki   = m_wiki;
+        p.m_wiki         = m_wiki;
+            
+        p.m_author       = m_author;
+        p.m_version      = m_version;
+        p.m_lastModified = m_lastModified != null ? (Date)m_lastModified.clone() : null;
+
+        p.m_fileSize     = m_fileSize;
+
+        for( Map.Entry<String,Object> entry : m_attributes.entrySet() )
+        {
+            p.m_attributes.put( entry.getKey(), 
+                                entry.getValue() );
+        }
+
+        if( m_accessList != null )
+        {
+            p.m_accessList = new AclImpl();
             
-            p.m_author       = m_author;
-            p.m_version      = m_version;
-            p.m_lastModified = m_lastModified != null ? (Date)m_lastModified.clone() : null;
-
-            p.m_fileSize     = m_fileSize;
-                            
-            p.m_attributes.putAll(m_attributes);
+            for( Enumeration entries = m_accessList.entries(); entries.hasMoreElements();
)
+            {
+                AclEntry e = (AclEntry)entries.nextElement();
             
-            return p;
+                p.m_accessList.addEntry( e );
+            }
         }
-        catch( CloneNotSupportedException e )
-        {}
-        
-        return null;
+            
+        return p;
     }
     
     /**



Mime
View raw message