[ 
https://issues.apache.org/jira/browse/LUCENE-785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467838
 ] 

Michael McCandless commented on LUCENE-785:
-------------------------------------------

OK, here's a quick unit test that catches the regression:

    public void testSerializable() throws IOException {
        Directory dir = new RAMDirectory();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(bos);
        out.writeObject(dir);
        out.close();
    }

Using this I tracked down the commit that caused serializability to break:

    
http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/RAMDirectory.java?p2=%2Flucene%2Fjava%2Ftrunk%2Fsrc%2Fjava%2Forg%2Fapache%2Flucene%2Fstore%2FRAMDirectory.java&p1=%2Flucene%2Fjava%2Ftrunk%2Fsrc%2Fjava%2Forg%2Fapache%2Flucene%2Fstore%2FRAMDirectory.java&r1=478014&r2=478013&view=diff&pathrev=478014

This commit was for LUCENE-709

> RAMDirectory not Serializable
> -----------------------------
>
>                 Key: LUCENE-785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-785
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 2.1
>            Reporter: Matthias Seidel
>            Priority: Minor
>
> 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();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to