You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mv...@apache.org on 2016/07/25 06:27:17 UTC
[2/2] lucene-solr:branch_6x: LUCENE-7383: Fix 'dimensionNumBytes'
validation
LUCENE-7383: Fix 'dimensionNumBytes' validation
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/dc54f97a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/dc54f97a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/dc54f97a
Branch: refs/heads/branch_6x
Commit: dc54f97a353b241a38c21baccfacf2c60539bb53
Parents: a6655a9
Author: Martijn van Groningen <mv...@apache.org>
Authored: Fri Jul 22 16:26:05 2016 +0200
Committer: Martijn van Groningen <mv...@apache.org>
Committed: Mon Jul 25 08:27:01 2016 +0200
----------------------------------------------------------------------
lucene/CHANGES.txt | 3 +++
lucene/core/src/java/org/apache/lucene/document/FieldType.java | 2 +-
lucene/core/src/test/org/apache/lucene/index/TestPointValues.java | 3 +--
3 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dc54f97a/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index bc727fa..843b704 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -51,6 +51,9 @@ Bug Fixes
wrong default AttributeFactory for new Tokenizers.
(Terry Smith, Uwe Schindler)
+* LUCENE-7389: Fix FieldType.setDimensions(...) validation for the dimensionNumBytes
+ parameter. (Martijn van Groningen)
+
Improvements
* LUCENE-7323: Compound file writing now verifies the incoming
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dc54f97a/lucene/core/src/java/org/apache/lucene/document/FieldType.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/document/FieldType.java b/lucene/core/src/java/org/apache/lucene/document/FieldType.java
index 2c0a62c..e0f058f 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FieldType.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FieldType.java
@@ -374,7 +374,7 @@ public class FieldType implements IndexableFieldType {
if (dimensionNumBytes < 0) {
throw new IllegalArgumentException("dimensionNumBytes must be >= 0; got " + dimensionNumBytes);
}
- if (dimensionCount > PointValues.MAX_NUM_BYTES) {
+ if (dimensionNumBytes > PointValues.MAX_NUM_BYTES) {
throw new IllegalArgumentException("dimensionNumBytes must be <= " + PointValues.MAX_NUM_BYTES + "; got " + dimensionNumBytes);
}
if (dimensionCount == 0) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dc54f97a/lucene/core/src/test/org/apache/lucene/index/TestPointValues.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestPointValues.java b/lucene/core/src/test/org/apache/lucene/index/TestPointValues.java
index 9693c5c..a846c27 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestPointValues.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestPointValues.java
@@ -362,9 +362,8 @@ public class TestPointValues extends LuceneTestCase {
IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));
IndexWriter w = new IndexWriter(dir, iwc);
Document doc = new Document();
- doc.add(new BinaryPoint("dim", new byte[PointValues.MAX_NUM_BYTES+1]));
expectThrows(IllegalArgumentException.class, () -> {
- w.addDocument(doc);
+ doc.add(new BinaryPoint("dim", new byte[PointValues.MAX_NUM_BYTES+1]));
});
Document doc2 = new Document();