lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy (JIRA)" <j...@apache.org>
Subject [jira] Created: (LUCENENET-100) Problem with remoting of IComparable[] in FieldDoc.cs
Date Wed, 19 Sep 2007 16:22:12 GMT
Problem with remoting of IComparable[] in FieldDoc.cs
-----------------------------------------------------

                 Key: LUCENENET-100
                 URL: https://issues.apache.org/jira/browse/LUCENENET-100
             Project: Lucene.Net
          Issue Type: Bug
            Reporter: Digy
            Priority: Minor
         Attachments: FieldDoc.patch

Hi George,

There are two problems related with remoting of IComparable[] in FieldDoc.cs

	1- IComparable[] can not be remoted with BinaryFormatter.
When trying,the follwing error occurs:
"Binary stream '99' does not contain a valid BinaryHeader. Possible causes are invalid stream
or object version change between serialization and  deserialization."

[See "Hongwei Shen" bug report in 
http://mail-archives.apache.org/mod_mbox/incubator-lucene-net-dev/200709.mbox/ajax/%3c547A9F771909EA48A8E06238B6DD94E702C59100@MAIL1.corp.geosign.com%3e
]

	Sample Code
        ============
	    MemoryStream m = new MemoryStream();
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            IComparable[] arr = new IComparable[1];
            arr[0] = 123.45;
            formatter.Serialize(m, arr);

            m.Seek(0, SeekOrigin.Begin);

            IComparable[] arr2 = (IComparable[])formatter.Deserialize(m);
            Console.WriteLine(arr2[0].ToString() + " " + arr2[0].GetType().ToString());
            Console.ReadLine();




	2-When it is remoted with SoapFormatter, all items in it are converted to string-type (like
123.45f -> "123.45") Therefore 

FieldDocSortedHitQueue.LessThan method fails with "specified cast is no valid" when evaluating
SortField.SCORE, SortField.DOC, SortField.INT and 
SortField.FLOAT.(At least in my and Michael Garski's case (I know you don't get this error)
http://mail-archives.apache.org/mod_mbox/incubator-lucene-net-dev/200709.mbox/ajax/%3c46F062BC.4090707@mac.com%3e)
[See  LUCENENET-86 and LUCENENET-94]

	Sample Code
        ============

	    MemoryStream m = new MemoryStream();
            System.Runtime.Serialization.Formatters.Soap.SoapFormatter formatter = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter();
            IComparable[] arr = new IComparable[1];
            arr[0] = 123.45;
            formatter.Serialize(m, arr);

            m.Seek(0, SeekOrigin.Begin);

            IComparable[] arr2 = (IComparable[])formatter.Deserialize(m);
            Console.WriteLine(arr2[0].ToString() + " " + arr2[0].GetType().ToString());
            Console.ReadLine();


To Test this Patch I used TestSort in NUnite test where TestNormalizedScores and TestRemoteSort
fail


DIGY

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


Mime
View raw message