Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-785

RAMDirectory not Serializable

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: core/store
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      The current implementation of RAMDirectory throws a NotSerializableException when trying to serialize, due to the inner class KeySet of HashMap not being serializable (god knows why)

      java.io.NotSerializableException: java.util.HashMap$KeySet
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)

      Caused by line 43:

      private Set fileNames = fileMap.keySet();

      EDIT:

      while we're at it: same goes for inner class Values

      java.io.NotSerializableException: java.util.HashMap$Values
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)

      Collection files = fileMap.values();

        Attachments

        1. ramdir.serializable.diff
          3 kB
          Chris M. Hostetter

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              matthias.seidel Matthias Seidel
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: