From c1272c83bce458cf05743fec54a7fd2e14dc7ea5 Mon Sep 17 00:00:00 2001 From: Shai Erera Date: Mon, 21 Jan 2013 08:06:36 +0000 Subject: [PATCH] add assert to CategoryPath private constructor git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1436219 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/lucene/facet/taxonomy/CategoryPath.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java index f277c054d68..61bd1548032 100644 --- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java +++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java @@ -48,6 +48,12 @@ public class CategoryPath implements Comparable { // Used by subpath private CategoryPath(CategoryPath copyFrom, int prefixLen) { + // while the code which calls this method is safe, at some point a test + // tripped on AIOOBE in toString, but we failed to reproduce. adding the + // assert as a safety check. + assert prefixLen > 0 && prefixLen <= copyFrom.components.length : + "prefixLen cannot be negative nor larger than the given components' length: prefixLen=" + prefixLen + + " components.length=" + copyFrom.components.length; this.components = copyFrom.components; length = prefixLen; }