Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
less 'wellformed' calls without asserts
Michael Peter Christen34f4225d7ed6
diff --git a/source/net/yacy/kelondro/index/Row.java b/source/net/yacy/kelondro/index/Row.javaindex 55b559aa5..4e07dee1d 100644--- a/source/net/yacy/kelondro/index/Row.java+++ b/source/net/yacy/kelondro/index/Row.java@@ -153,11 +153,7 @@ public final class Row {public final Entry newEntry(final byte[] rowinstance) {if (rowinstance == null) return null;- //assert (rowinstance[0] != 0);- if (!(this.objectOrder.wellformed(rowinstance, 0, this.primaryKeyLength))) {- Log.logWarning("kelondroRow", "row not well-formed: rowinstance[0] = " + UTF8.String(rowinstance, 0, this.primaryKeyLength) + " / " + NaturalOrder.arrayList(rowinstance, 0, this.primaryKeyLength));- return null;- }+ assert (this.objectOrder.wellformed(rowinstance, 0, this.primaryKeyLength)) : "row not well-formed: rowinstance[0] = " + UTF8.String(rowinstance, 0, this.primaryKeyLength) + " / " + NaturalOrder.arrayList(rowinstance, 0, this.primaryKeyLength);return new Entry(rowinstance, false);}@@ -170,14 +166,11 @@ public final class Row {public final Entry newEntry(final byte[] rowinstance, final int start, final boolean clone) {if (rowinstance == null) return null;- //assert (rowinstance[0] != 0);- final boolean wellformed = this.objectOrder.wellformed(rowinstance, start, this.primaryKeyLength);try {- assert (wellformed) : "rowinstance = " + UTF8.String(rowinstance);+ assert (this.objectOrder.wellformed(rowinstance, start, this.primaryKeyLength)) : "rowinstance = " + UTF8.String(rowinstance);} catch (final Throwable e) {Log.logException(e);}- if (!wellformed) return null;// this method offers the option to clone the content// this is necessary if it is known that the underlying byte array may change and therefore// the reference to the byte array does not contain the original content@@ -210,26 +203,32 @@ public final class Row {this.base = baseOrder;}+ @Overridepublic int compare(final Entry a, final Entry b) {return a.compareTo(b);}+ @Overridepublic boolean equal(final Entry a, final Entry b) {return a.equals(b);}+ @Overridepublic Order<Entry> clone() {return new EntryComparator(this.base);}+ @Overridepublic long cardinal(final Entry key) {return this.base.cardinal(key.bytes(), 0, key.getPrimaryKeyLength());}+ @Overridepublic String signature() {return this.base.signature();}+ @Overridepublic boolean wellformed(final Entry a) {return this.base.wellformed(a.getPrimaryKeyBytes());}@@ -344,6 +343,7 @@ public final class Row {return Row.this.row[column].cellwidth;}+ @Overridepublic final int compareTo(final Entry o) {// compares only the content of the primary keyif (Row.this.objectOrder == null) throw new kelondroException("objects cannot be compared, no order given");@@ -351,6 +351,7 @@ public final class Row {return Row.this.objectOrder.compare(bytes(), o.bytes(), Row.this.primaryKeyLength);}+ @Overridepublic int compare(final Entry o1, final Entry o2) {return o1.compareTo(o2);}