Примеры ошибок, обнаруженных с помощью диагностики V6113
V6113. Suspicious division. Absolute value of the left operand is less than the value of the right operand.
Apache Solr
V6113 The '(val) / (NUM_DOCS)' expression evaluates to 0 because the absolute value of the left operand 'val' is less than the value of the right operand 'NUM_DOCS'. SpellCheckCollatorTest.java 683
Public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
private static final int NUM_DOCS_WITH_TERM_EVERYOTHER = 8;
private static final int NUM_DOCS = 17;
....
@Test
public void testEstimatedHitCounts() {
....
for (int val = 5; val <= 20; val++) {
String hitsXPath = xpathPrefix + "long[@name='hits']";
if (val <= NUM_DOCS_WITH_TERM_EVERYOTHER) {
int max = NUM_DOCS;
int min = (/* min collected */ val) /
(/* max docs possibly scanned */ NUM_DOCS);
hitsXPath += "[" + min + " <= . and . <= " + max + "]";
}
....
}
}
....
}