Author: j16sdiz
Date: 2009-01-05 12:04:02 +0000 (Mon, 05 Jan 2009)
New Revision: 24914

Modified:
   trunk/plugins/XMLSpider/db/Config.java
Log:
just use super.clone(), Persistent have override it

Modified: trunk/plugins/XMLSpider/db/Config.java
===================================================================
--- trunk/plugins/XMLSpider/db/Config.java      2009-01-05 12:03:51 UTC (rev 
24913)
+++ trunk/plugins/XMLSpider/db/Config.java      2009-01-05 12:04:02 UTC (rev 
24914)
@@ -6,6 +6,7 @@
 import plugins.XMLSpider.org.garret.perst.Persistent;
 import plugins.XMLSpider.org.garret.perst.Storage;
 import freenet.node.RequestStarter;
+import freenet.support.Logger;
 
 public class Config extends Persistent implements Cloneable {
        /**
@@ -23,7 +24,7 @@
        private int maxParallelRequests;
        private String[] badlistedExtensions;
        private short requestPriority;
-       
+
        private boolean debug;
 
        public Config() {
@@ -43,8 +44,8 @@
                maxParallelRequests = 100;
 
                badlistedExtensions = new String[] { //
-               ".ico", ".bmp", ".png", ".jpg", ".gif", // image
-                       ".zip", ".jar", ".gz", ".bz2", ".rar", // archive
+                               ".ico", ".bmp", ".png", ".jpg", ".gif", // image
+                               ".zip", ".jar", ".gz", ".bz2", ".rar", // 
archive
                        ".7z", ".rar", ".arj", ".rpm", ".deb", //
                        ".xpi", ".ace", ".cab", ".lza", ".lzh", //
                        ".ace", ".exe", ".iso", // binary
@@ -53,39 +54,21 @@
                };
 
                requestPriority = 
RequestStarter.IMMEDIATE_SPLITFILE_PRIORITY_CLASS;
-               
+
                storage.makePersistent(this);
        }
 
-       public synchronized void setValue(Config config) {
-               synchronized (config) {
-                       indexDir = config.indexDir;
-                       indexMaxEntries = config.indexMaxEntries;
-                       indexSubindexMaxSize = config.indexSubindexMaxSize;
-
-                       indexTitle = config.indexTitle;
-                       indexOwner = config.indexOwner;
-                       indexOwnerEmail = config.indexOwnerEmail;
-
-                       maxShownURIs = config.maxShownURIs;
-
-                       maxParallelRequests = config.maxParallelRequests;
-
-                       badlistedExtensions = config.badlistedExtensions;
-
-                       requestPriority = config.requestPriority;
+       public synchronized Config clone() {
+               try {
+                       Config config = (Config) super.clone();
+                       assert !config.isPersistent();
+                       return config;
+               } catch (CloneNotSupportedException e) {
+                       Logger.error(this, "Impossible exception", e);
+                       throw new RuntimeException(e);
                }
-               
-               if (isPersistent())
-                       modify();
        }
 
-       public synchronized Config clone() {
-               Config newConfig = new Config();
-               newConfig.setValue(this);
-               return newConfig;
-       }
-
        public synchronized void setIndexDir(String indexDir) {
                assert !isPersistent();
                this.indexDir = indexDir;
@@ -175,7 +158,7 @@
        public synchronized short getRequestPriority() {
                return requestPriority;
        }
-       
+
        public synchronized boolean isDebug() {
                return debug;
        }

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to