From 8375c971311e976a0fdc372d09791b8250de19fa Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Thu, 5 Nov 2009 17:33:45 +0000 Subject: [PATCH] Fix de-serialization of interned field names git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@833095 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/search/NumericRangeQuery.java | 8 +++++++- src/java/org/apache/lucene/search/SortField.java | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/lucene/search/NumericRangeQuery.java b/src/java/org/apache/lucene/search/NumericRangeQuery.java index b30892e4391..789538c33ee 100644 --- a/src/java/org/apache/lucene/search/NumericRangeQuery.java +++ b/src/java/org/apache/lucene/search/NumericRangeQuery.java @@ -363,8 +363,14 @@ public final class NumericRangeQuery extends MultiTermQuery { (Boolean.valueOf(maxInclusive).hashCode()^0x733fa5fe); } + // field must be interned after reading from stream + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + in.defaultReadObject(); + field = StringHelper.intern(field); + } + // members (package private, to be also fast accessible by NumericRangeTermEnum) - final String field; + String field; final int precisionStep, valSize; final T min, max; final boolean minInclusive,maxInclusive; diff --git a/src/java/org/apache/lucene/search/SortField.java b/src/java/org/apache/lucene/search/SortField.java index a78d4a1f192..eac4dfa00d5 100644 --- a/src/java/org/apache/lucene/search/SortField.java +++ b/src/java/org/apache/lucene/search/SortField.java @@ -354,6 +354,11 @@ implements Serializable { return hash; } + // field must be interned after reading from stream + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + in.defaultReadObject(); + field = StringHelper.intern(field); + } /** Returns the {@link FieldComparator} to use for * sorting.