Author: sshafroi
Date: 2009-01-06 15:02:37 +0100 (Tue, 06 Jan 2009)
New Revision: 7130
Modified:
branches/2.18/site-spi/src/main/java/no/sesat/search/site/Site.java
Log:
Site class is marked as Serializable but had siteContext member that was not
initialized when deserialized. This could lead to users beeing locked out if a
server was restarted. We have seen this happen with one of the pingdome tests.
Modified: branches/2.18/site-spi/src/main/java/no/sesat/search/site/Site.java
===================================================================
--- branches/2.18/site-spi/src/main/java/no/sesat/search/site/Site.java
2009-01-06 13:51:44 UTC (rev 7129)
+++ branches/2.18/site-spi/src/main/java/no/sesat/search/site/Site.java
2009-01-06 14:02:37 UTC (rev 7130)
@@ -117,22 +117,15 @@
*/
private final Site parent;
- private transient final SiteContext siteContext;
+ private transient SiteContext siteContext;
- /** No-argument constructor for deserialization. */
private Site() {
siteName = null;
cxtName = null;
locale = Locale.getDefault();
uniqueName = null;
parent = null;
-
- final Site thisSite = this;
- siteContext = new SiteContext() {
- public Site getSite() {
- return thisSite;
- }
- };
+ init();
}
/** Creates a new instance of Site.
@@ -154,12 +147,7 @@
locale = theLocale;
uniqueName = getUniqueName(siteName, locale);
- final Site thisSite = this;
- siteContext = new SiteContext() {
- public Site getSite() {
- return thisSite;
- }
- };
+ init();
final String parentSiteName;
if(null != cxt){
@@ -207,6 +195,20 @@
}
}
+ private void readObject(java.io.ObjectInputStream in) throws IOException,
ClassNotFoundException {
+ in.defaultReadObject();
+ init();
+ }
+
+ private void init() {
+ final Site thisSite = this;
+ siteContext = new SiteContext() {
+ public Site getSite() {
+ return thisSite;
+ }
+ };
+ }
+
/**
* Get a SiteContext for this site.
*
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits