Index: src/test/org/apache/lucene/store/MockRAMDirectory.java
===================================================================
--- src/test/org/apache/lucene/store/MockRAMDirectory.java	(revision 500594)
+++ src/test/org/apache/lucene/store/MockRAMDirectory.java	(working copy)
@@ -108,7 +108,7 @@
   /** Provided for testing purposes.  Use sizeInBytes() instead. */
   public synchronized final long getRecomputedSizeInBytes() {
     long size = 0;
-    Iterator it = files.iterator();
+    Iterator it = fileMap.values().iterator();
     while (it.hasNext())
       size += ((RAMFile) it.next()).getSizeInBytes();
     return size;
@@ -122,7 +122,7 @@
 
   final long getRecomputedActualSizeInBytes() {
     long size = 0;
-    Iterator it = files.iterator();
+    Iterator it = fileMap.values().iterator();
     while (it.hasNext())
       size += ((RAMFile) it.next()).length;
     return size;
Index: src/test/org/apache/lucene/index/store/TestRAMDirectory.java
===================================================================
--- src/test/org/apache/lucene/index/store/TestRAMDirectory.java	(revision 500594)
+++ src/test/org/apache/lucene/index/store/TestRAMDirectory.java	(working copy)
@@ -19,7 +19,11 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayOutputStream;
 
+
 import junit.framework.TestCase;
 
 import org.apache.lucene.analysis.WhitespaceAnalyzer;
@@ -190,6 +194,18 @@
     writer.close();
   }
 
+
+  public void testSerializable() throws IOException {
+    Directory dir = new RAMDirectory();
+    ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
+    assertEquals("initially empty", 0, bos.size());
+    ObjectOutput out = new ObjectOutputStream(bos);
+    int headerSize = bos.size();
+    out.writeObject(dir);
+    out.close();
+    assertTrue("contains more then just header", headerSize < bos.size());
+  } 
+
   public void tearDown() {
     // cleanup 
     if (indexDir != null && indexDir.exists()) {
Index: src/java/org/apache/lucene/store/RAMDirectory.java
===================================================================
--- src/java/org/apache/lucene/store/RAMDirectory.java	(revision 500594)
+++ src/java/org/apache/lucene/store/RAMDirectory.java	(working copy)
@@ -39,8 +39,6 @@
   private static final long serialVersionUID = 1l;
 
   HashMap fileMap = new HashMap();
-  private Set fileNames = fileMap.keySet();
-  Collection files = fileMap.values();
   long sizeInBytes = 0;
   
   // *****
@@ -101,6 +99,7 @@
 
   /** Returns an array of strings, one for each file in the directory. */
   public synchronized final String[] list() {
+    Set fileNames = fileMap.keySet();
     String[] result = new String[fileNames.size()];
     int i = 0;
     Iterator it = fileNames.iterator();
@@ -230,8 +229,6 @@
   /** Closes the store to future operations, releasing associated memory. */
   public final void close() {
     fileMap = null;
-    fileNames = null;
-    files = null;
   }
 
 }
