From commits-return-98915-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Thu Feb 15 15:22:49 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2956518064A for ; Thu, 15 Feb 2018 15:22:47 +0100 (CET) Received: (qmail 2291 invoked by uid 500); 15 Feb 2018 14:22:47 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 2277 invoked by uid 99); 15 Feb 2018 14:22:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2018 14:22:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id F1313E0904; Thu, 15 Feb 2018 14:22:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jpountz@apache.org To: commits@lucene.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: lucene-solr:branch_7x: LUCENE-8174: Fixed toString method of (Double|Float|Int|Long)Range classes. Date: Thu, 15 Feb 2018 14:22:46 +0000 (UTC) Repository: lucene-solr Updated Branches: refs/heads/branch_7x 08b9de997 -> 1b62572b5 LUCENE-8174: Fixed toString method of (Double|Float|Int|Long)Range classes. The previous implementation produced an ArrayOutOfBoundsException because of an incorrect calculation of the dimension index. Also, the ranges for each dimension were never appended to the StringBuilder at all (which, however, could not actually be observed due to the exception). Signed-off-by: Adrien Grand Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1b62572b Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1b62572b Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1b62572b Branch: refs/heads/branch_7x Commit: 1b62572b585675f25fc62c2dfd2d6d5bcf82a19b Parents: 08b9de9 Author: Oliver Kaleske Authored: Thu Feb 15 11:30:02 2018 +0100 Committer: Adrien Grand Committed: Thu Feb 15 15:20:19 2018 +0100 ---------------------------------------------------------------------- lucene/CHANGES.txt | 3 +++ .../org/apache/lucene/document/DoubleRange.java | 4 +-- .../org/apache/lucene/document/FloatRange.java | 4 +-- .../org/apache/lucene/document/IntRange.java | 4 +-- .../org/apache/lucene/document/LongRange.java | 4 +-- .../apache/lucene/document/TestDoubleRange.java | 26 +++++++++++++++++++ .../apache/lucene/document/TestFloatRange.java | 27 ++++++++++++++++++++ .../apache/lucene/document/TestIntRange.java | 26 +++++++++++++++++++ .../apache/lucene/document/TestLongRange.java | 26 +++++++++++++++++++ 9 files changed, 116 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/CHANGES.txt ---------------------------------------------------------------------- diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 550805b..bfa7969 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -93,6 +93,9 @@ Bug Fixes * LUCENE-8163: BaseDirectoryTestCase could produce random filenames that fail on Windows (Alan Woodward) +* LUCENE-8174: Fixed {Float,Double,Int,Long}Range.toString(). (Oliver Kaleske + via Adrien Grand) + Other * LUCENE-8111: IndexOrDocValuesQuery Javadoc references outdated method name. http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java b/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java index c1d2dc5..cf308c3 100644 --- a/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java +++ b/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java @@ -244,9 +244,9 @@ public class DoubleRange extends Field { sb.append(':'); byte[] b = ((BytesRef)fieldsData).bytes; toString(b, 0); - for (int d=1; d'); http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/core/src/java/org/apache/lucene/document/FloatRange.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatRange.java b/lucene/core/src/java/org/apache/lucene/document/FloatRange.java index facf23b..9b555d6 100644 --- a/lucene/core/src/java/org/apache/lucene/document/FloatRange.java +++ b/lucene/core/src/java/org/apache/lucene/document/FloatRange.java @@ -244,9 +244,9 @@ public class FloatRange extends Field { sb.append(':'); byte[] b = ((BytesRef)fieldsData).bytes; toString(b, 0); - for (int d=1; d'); http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/core/src/java/org/apache/lucene/document/IntRange.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/java/org/apache/lucene/document/IntRange.java b/lucene/core/src/java/org/apache/lucene/document/IntRange.java index b426613..e67b94f 100644 --- a/lucene/core/src/java/org/apache/lucene/document/IntRange.java +++ b/lucene/core/src/java/org/apache/lucene/document/IntRange.java @@ -244,9 +244,9 @@ public class IntRange extends Field { sb.append(':'); byte[] b = ((BytesRef)fieldsData).bytes; toString(b, 0); - for (int d=1; d'); http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/core/src/java/org/apache/lucene/document/LongRange.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/java/org/apache/lucene/document/LongRange.java b/lucene/core/src/java/org/apache/lucene/document/LongRange.java index 5c1c763..1a1b19a 100644 --- a/lucene/core/src/java/org/apache/lucene/document/LongRange.java +++ b/lucene/core/src/java/org/apache/lucene/document/LongRange.java @@ -242,9 +242,9 @@ public class LongRange extends Field { sb.append(':'); byte[] b = ((BytesRef)fieldsData).bytes; toString(b, 0); - for (int d=1; d'); http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/core/src/test/org/apache/lucene/document/TestDoubleRange.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/test/org/apache/lucene/document/TestDoubleRange.java b/lucene/core/src/test/org/apache/lucene/document/TestDoubleRange.java new file mode 100644 index 0000000..8e27831 --- /dev/null +++ b/lucene/core/src/test/org/apache/lucene/document/TestDoubleRange.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.lucene.document; + +import org.apache.lucene.util.LuceneTestCase; + +public class TestDoubleRange extends LuceneTestCase { + public void testToString() { + DoubleRange range = new DoubleRange("foo", new double[] { 0.1, 1.1, 2.1, 3.1 }, new double[] { .2, 1.2, 2.2, 3.2 }); + assertEquals("DoubleRange ", range.toString()); + } +} http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/core/src/test/org/apache/lucene/document/TestFloatRange.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/test/org/apache/lucene/document/TestFloatRange.java b/lucene/core/src/test/org/apache/lucene/document/TestFloatRange.java new file mode 100644 index 0000000..e36c85a --- /dev/null +++ b/lucene/core/src/test/org/apache/lucene/document/TestFloatRange.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.lucene.document; + +import org.apache.lucene.util.LuceneTestCase; + +public class TestFloatRange extends LuceneTestCase { + public void testToString() { + FloatRange range = new FloatRange("foo", new float[] { 0.1f, 1.1f, 2.1f, 3.1f }, + new float[] { 0.2f, 1.2f, 2.2f, 3.2f }); + assertEquals("FloatRange ", range.toString()); + } +} http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/core/src/test/org/apache/lucene/document/TestIntRange.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/test/org/apache/lucene/document/TestIntRange.java b/lucene/core/src/test/org/apache/lucene/document/TestIntRange.java new file mode 100644 index 0000000..0ee39d4 --- /dev/null +++ b/lucene/core/src/test/org/apache/lucene/document/TestIntRange.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.lucene.document; + +import org.apache.lucene.util.LuceneTestCase; + +public class TestIntRange extends LuceneTestCase { + public void testToString() { + IntRange range = new IntRange("foo", new int[] { 1, 11, 21, 31 }, new int[] { 2, 12, 22, 32 }); + assertEquals("IntRange ", range.toString()); + } +} http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1b62572b/lucene/core/src/test/org/apache/lucene/document/TestLongRange.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/test/org/apache/lucene/document/TestLongRange.java b/lucene/core/src/test/org/apache/lucene/document/TestLongRange.java new file mode 100644 index 0000000..b0ddd46 --- /dev/null +++ b/lucene/core/src/test/org/apache/lucene/document/TestLongRange.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.lucene.document; + +import org.apache.lucene.util.LuceneTestCase; + +public class TestLongRange extends LuceneTestCase { + public void testToString() { + LongRange range = new LongRange("foo", new long[] { 1, 11, 21, 31 }, new long[] { 2, 12, 22, 32 }); + assertEquals("LongRange ", range.toString()); + } +}