LUCENE-8345 - add wrapper class constructors to forbiddenapis

This commit is contained in:
Michael Braun 2018-06-03 15:40:50 -04:00
parent 3dc4fa199c
commit fb6574100e
96 changed files with 392 additions and 369 deletions

View File

@ -48,7 +48,7 @@ public class TestWikipediaTokenizerFactory extends BaseTokenStreamFactoryTestCas
public void testTokenizerTokensOnly() throws Exception {
String text = "This is a [[Category:foo]]";
Tokenizer tf = tokenizerFactory(WIKIPEDIA, TOKEN_OUTPUT, new Integer( WikipediaTokenizer.TOKENS_ONLY).toString()).create(newAttributeFactory());
Tokenizer tf = tokenizerFactory(WIKIPEDIA, TOKEN_OUTPUT, Integer.toString(WikipediaTokenizer.TOKENS_ONLY)).create(newAttributeFactory());
tf.setReader(new StringReader(text));
assertTokenStreamContents(tf,
new String[] { "This", "is", "a", "foo" },
@ -64,7 +64,7 @@ public class TestWikipediaTokenizerFactory extends BaseTokenStreamFactoryTestCas
Set<String> untoks = new HashSet<>();
untoks.add(WikipediaTokenizer.CATEGORY);
untoks.add(WikipediaTokenizer.ITALICS);
Tokenizer tf = tokenizerFactory(WIKIPEDIA, TOKEN_OUTPUT, new Integer(WikipediaTokenizer.UNTOKENIZED_ONLY).toString(), UNTOKENIZED_TYPES, WikipediaTokenizer.CATEGORY + ", " + WikipediaTokenizer.ITALICS).create(newAttributeFactory());
Tokenizer tf = tokenizerFactory(WIKIPEDIA, TOKEN_OUTPUT, Integer.toString(WikipediaTokenizer.UNTOKENIZED_ONLY), UNTOKENIZED_TYPES, WikipediaTokenizer.CATEGORY + ", " + WikipediaTokenizer.ITALICS).create(newAttributeFactory());
tf.setReader(new StringReader(test));
assertTokenStreamContents(tf,
new String[] { "a b c d", "e f g", "link", "here", "link",
@ -77,7 +77,7 @@ public class TestWikipediaTokenizerFactory extends BaseTokenStreamFactoryTestCas
public void testTokenizerBoth() throws Exception {
String test = "[[Category:a b c d]] [[Category:e f g]] [[link here]] [[link there]] ''italics here'' something ''more italics'' [[Category:h i j]]";
Tokenizer tf = tokenizerFactory(WIKIPEDIA, TOKEN_OUTPUT, new Integer(WikipediaTokenizer.BOTH).toString(), UNTOKENIZED_TYPES, WikipediaTokenizer.CATEGORY + ", " + WikipediaTokenizer.ITALICS).create(newAttributeFactory());
Tokenizer tf = tokenizerFactory(WIKIPEDIA, TOKEN_OUTPUT, Integer.toString(WikipediaTokenizer.BOTH), UNTOKENIZED_TYPES, WikipediaTokenizer.CATEGORY + ", " + WikipediaTokenizer.ITALICS).create(newAttributeFactory());
tf.setReader(new StringReader(test));
assertTokenStreamContents(tf,
new String[] { "a b c d", "a", "b", "c", "d", "e f g", "e", "f", "g",

View File

@ -159,7 +159,7 @@ public class TestJapaneseAnalyzer extends BaseTokenStreamTestCase {
new String[] { "a", "b", "cd" },
new int[] { 0, 1, 2 },
new int[] { 1, 2, 4 },
new Integer(4)
4
);
a.close();
}

View File

@ -399,14 +399,14 @@ public class
new String[] { "これ", "", "", "", "", "ない" },
new int[] { 0, 2, 3, 4, 5, 6 },
new int[] { 2, 3, 4, 5, 6, 8 },
new Integer(8)
8
);
assertTokenStreamContents(analyzerNoPunct.tokenStream("foo", "これは本ではない "),
new String[] { "これ", "", "", "", "", "ない" },
new int[] { 0, 2, 3, 4, 5, 6, 8 },
new int[] { 2, 3, 4, 5, 6, 8, 9 },
new Integer(12)
12
);
}
@ -417,7 +417,7 @@ public class
new String[] { "関西", "国際", "空港", "", "行っ", "" },
new int[] { 0, 2, 4, 6, 7, 9 },
new int[] { 2, 4, 6, 7, 9, 10 },
new Integer(10)
10
);
}
@ -427,7 +427,7 @@ public class
new String[] { "朝青龍" },
new int[] { 0 },
new int[] { 3 },
new Integer(3)
3
);
}
@ -437,7 +437,7 @@ public class
new String[] { "a", "b", "cd" },
new int[] { 0, 1, 2 },
new int[] { 1, 2, 4 },
new Integer(4)
4
);
}
@ -453,7 +453,7 @@ public class
new String[] { "ab", "cd", "efg", "hij" },
new int[] { 0, 2, 4, 7 },
new int[] { 2, 4, 7, 10 },
new Integer(10)
10
);
}
*/

View File

@ -135,7 +135,7 @@ public class Trie {
boolean br = false;
for (int i = 0; i < key.length() - 1; i++) {
Character ch = new Character(e.next());
Character ch = e.next();
w = now.getCmd(ch);
if (w >= 0) {
int n = w;
@ -158,7 +158,7 @@ public class Trie {
}
}
if (br == false) {
w = now.getCmd(new Character(e.next()));
w = now.getCmd(e.next());
if (w >= 0) {
int n = w;
for (int j = 0; j < resc; j++) {
@ -235,7 +235,7 @@ public class Trie {
Character aux = null;
for (int i = 0; i < key.length();) {
ch = new Character(e.next());
ch = e.next();
i++;
c = now.at(ch);
@ -247,7 +247,7 @@ public class Trie {
for (int skip = c.skip; skip > 0; skip--) {
if (i < key.length()) {
aux = new Character(e.next());
aux = e.next();
} else {
return null;
}
@ -278,7 +278,7 @@ public class Trie {
StrEnum e = new StrEnum(key, forward);
for (int i = 0; i < key.length() - 1; i++) {
Character ch = new Character(e.next());
Character ch = e.next();
w = now.getCmd(ch);
if (w >= 0) {
last = cmds.get(w);
@ -290,7 +290,7 @@ public class Trie {
return last;
}
}
w = now.getCmd(new Character(e.next()));
w = now.getCmd(e.next());
return (w >= 0) ? cmds.get(w) : last;
}
@ -351,7 +351,7 @@ public class Trie {
StrEnum e = new StrEnum(key, forward);
for (int i = 0; i < e.length() - 1; i++) {
Character ch = new Character(e.next());
Character ch = e.next();
node = r.getRef(ch);
if (node >= 0) {
r = getRow(node);
@ -363,7 +363,7 @@ public class Trie {
r = n;
}
}
r.setCmd(new Character(e.next()), id_cmd);
r.setCmd(e.next(), id_cmd);
}
/**

View File

@ -371,7 +371,7 @@ public class Config {
StringTokenizer st = new StringTokenizer(s, ":");
while (st.hasMoreTokens()) {
String t = st.nextToken();
a.add(new Boolean(t));
a.add(Boolean.valueOf(t));
}
boolean res[] = new boolean[a.size()];
for (int i = 0; i < a.size(); i++) {

View File

@ -520,9 +520,7 @@ final class SloppyPhraseMatcher extends PhraseMatcher {
HashMap<Term,Integer> tcnt = new HashMap<>();
for (PhrasePositions pp : phrasePositions) {
for (Term t : pp.terms) {
Integer cnt0 = tcnt.get(t);
Integer cnt = cnt0==null ? new Integer(1) : new Integer(1+cnt0.intValue());
tcnt.put(t, cnt);
Integer cnt = tcnt.compute(t, (key, old) -> old == null ? 1 : 1 + old);
if (cnt==2) {
tord.put(t,tord.size());
}

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import org.apache.lucene.store.DataInput;
import org.apache.lucene.store.DataOutput;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.SuppressForbidden;
/**
* An FST {@link Outputs} implementation where each output
@ -29,7 +30,7 @@ import org.apache.lucene.util.RamUsageEstimator;
*
* @lucene.experimental
*/
@SuppressForbidden(reason = "Uses a Long instance as a marker")
public final class PositiveIntOutputs extends Outputs<Long> {
private final static Long NO_OUTPUT = new Long(0);

View File

@ -21,6 +21,7 @@ import java.util.*;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.SuppressForbidden;
public class TestCharArraySet extends LuceneTestCase {
@ -56,7 +57,8 @@ public class TestCharArraySet extends LuceneTestCase {
assertTrue(set.contains(findme, 1, 4));
assertTrue(set.contains(new String(findme,1,4)));
}
@SuppressForbidden(reason = "Explicitly checking new Integers")
public void testObjectContains() {
CharArraySet set = new CharArraySet(10, true);
Integer val = Integer.valueOf(1);

View File

@ -144,7 +144,7 @@ public class TestPriorityQueue extends LuceneTestCase {
// Basic insertion of new content
ArrayList<Integer> sds = new ArrayList<Integer>(numDocsInPQ);
for (int i = 0; i < numDocsInPQ * 10; i++) {
Integer newEntry = new Integer(Math.abs(random.nextInt()));
Integer newEntry = Math.abs(random.nextInt());
sds.add(newEntry);
Integer evicted = pq.insertWithOverflow(newEntry);
pq.checkValidity();
@ -174,7 +174,7 @@ public class TestPriorityQueue extends LuceneTestCase {
assertTrue(sds.remove(element) == objectToRemove);
assertTrue(pq.remove(objectToRemove));
pq.checkValidity();
Integer newEntry = new Integer(Math.abs(random.nextInt()));
Integer newEntry = Math.abs(random.nextInt());
sds.add(newEntry);
assertNull(pq.insertWithOverflow(newEntry));
pq.checkValidity();
@ -237,7 +237,7 @@ public class TestPriorityQueue extends LuceneTestCase {
final List<Integer> expected = new ArrayList<>();
for (int iter = 0; iter < iters; ++iter) {
if (queue.size() == 0 || (queue.size() < maxSize && random().nextBoolean())) {
final Integer value = new Integer(random().nextInt(10));
final Integer value = random().nextInt(10);
queue.add(value);
expected.add(value);
} else {

View File

@ -37,7 +37,7 @@ public class TestSetOnce extends LuceneTestCase {
public void run() {
try {
sleep(RAND.nextInt(10)); // sleep for a short time
set.set(new Integer(Integer.parseInt(getName().substring(2))));
set.set(Integer.valueOf(getName().substring(2)));
success = true;
} catch (InterruptedException e) {
// ignore
@ -57,17 +57,17 @@ public class TestSetOnce extends LuceneTestCase {
@Test(expected=AlreadySetException.class)
public void testSettingCtor() throws Exception {
SetOnce<Integer> set = new SetOnce<>(new Integer(5));
SetOnce<Integer> set = new SetOnce<>(5);
assertEquals(5, set.get().intValue());
set.set(new Integer(7));
set.set(7);
}
@Test(expected=AlreadySetException.class)
public void testSetOnce() throws Exception {
SetOnce<Integer> set = new SetOnce<>();
set.set(new Integer(5));
set.set(5);
assertEquals(5, set.get().intValue());
set.set(new Integer(7));
set.set(7);
}
@Test

View File

@ -105,7 +105,7 @@ public class LruTaxonomyWriterCache implements TaxonomyWriterCache {
@Override
public synchronized boolean put(FacetLabel categoryPath, int ordinal) {
boolean ret = cache.put(categoryPath, new Integer(ordinal));
boolean ret = cache.put(categoryPath, ordinal);
// If the cache is full, we need to clear one or more old entries
// from the cache. However, if we delete from the cache a recent
// addition that isn't yet in our reader, for this entry to be

View File

@ -35,12 +35,12 @@ public class NameHashIntCacheLRU extends NameIntCacheLRU {
@Override
Object key(FacetLabel name) {
return new Long(name.longHashCode());
return name.longHashCode();
}
@Override
Object key(FacetLabel name, int prefixLen) {
return new Long(name.subpath(prefixLen).longHashCode());
return name.subpath(prefixLen).longHashCode();
}
}

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import org.apache.lucene.store.DataInput;
import org.apache.lucene.store.DataOutput;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.SuppressForbidden;
/**
* An FST {@link Outputs} implementation where each output
@ -46,6 +47,7 @@ import org.apache.lucene.util.RamUsageEstimator;
* @lucene.experimental
*/
@SuppressForbidden(reason = "Uses a Long instance as a marker")
public final class UpToTwoPositiveIntOutputs extends Outputs<Object> {
/** Holds two long outputs. */

View File

@ -35,7 +35,7 @@ public class TestFunctionQueryExplanations extends BaseExplanationTestCase {
}
public void testMapFunction() throws Exception {
ValueSource rff = new RangeMapFloatFunction(new ConstValueSource(3), 0, 1, 2, new Float(4));
ValueSource rff = new RangeMapFloatFunction(new ConstValueSource(3), 0, 1, 2, 4f);
Query q = new FunctionQuery(rff);
qtest(q, new int[] { 0,1,2,3 });
assertEquals("map(const(3.0),0.0,1.0,const(2.0),const(4.0))", rff.description());

View File

@ -582,7 +582,7 @@ class GeoDegeneratePath extends GeoBasePath {
synchronized (fullDistanceCache) {
Double dist = fullDistanceCache.get(distanceStyle);
if (dist == null) {
dist = new Double(distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, end.x, end.y, end.z)));
dist = distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, end.x, end.y, end.z));
fullDistanceCache.put(distanceStyle, dist);
}
return dist.doubleValue();

View File

@ -874,7 +874,7 @@ class GeoStandardPath extends GeoBasePath {
synchronized (fullDistanceCache) {
Double dist = fullDistanceCache.get(distanceStyle);
if (dist == null) {
dist = new Double(distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, end.x, end.y, end.z)));
dist = distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, end.x, end.y, end.z));
fullDistanceCache.put(distanceStyle, dist);
}
return dist.doubleValue();

View File

@ -206,11 +206,11 @@ public class XYZBounds implements Bounds {
public Bounds addXValue(final double x) {
final double small = x - FUDGE_FACTOR;
if (minX == null || minX > small) {
minX = new Double(small);
minX = small;
}
final double large = x + FUDGE_FACTOR;
if (maxX == null || maxX < large) {
maxX = new Double(large);
maxX = large;
}
return this;
}
@ -227,11 +227,11 @@ public class XYZBounds implements Bounds {
public Bounds addYValue(final double y) {
final double small = y - FUDGE_FACTOR;
if (minY == null || minY > small) {
minY = new Double(small);
minY = small;
}
final double large = y + FUDGE_FACTOR;
if (maxY == null || maxY < large) {
maxY = new Double(large);
maxY = large;
}
return this;
}
@ -248,11 +248,11 @@ public class XYZBounds implements Bounds {
public Bounds addZValue(final double z) {
final double small = z - FUDGE_FACTOR;
if (minZ == null || minZ > small) {
minZ = new Double(small);
minZ = small;
}
final double large = z + FUDGE_FACTOR;
if (maxZ == null || maxZ < large) {
maxZ = new Double(large);
maxZ = large;
}
return this;
}

View File

@ -234,7 +234,7 @@ public class JaspellTernarySearchTrie implements Accountable {
try {
String word;
int pos;
Float occur, one = new Float(1);
Float occur, one = 1f;
while ((word = in.readLine()) != null) {
pos = word.indexOf("\t");
occur = one;
@ -421,9 +421,9 @@ public class JaspellTernarySearchTrie implements Accountable {
}
Float aux = (Float) (node.data);
if (aux == null) {
aux = new Float(1);
aux = 1f;
} else {
aux = new Float(aux.intValue() + 1);
aux = (float) (aux.intValue() + 1);
}
put(key2, aux);
return aux;

View File

@ -109,7 +109,7 @@ public class TestMockAnalyzer extends BaseTokenStreamTestCase {
new int[] { 0, 2 },
new int[] { 2, 4 },
new int[] { 1, 1 },
new Integer(5)
5
);
checkRandomData(random(), a, 100);
}
@ -130,7 +130,7 @@ public class TestMockAnalyzer extends BaseTokenStreamTestCase {
new int[] { 0 },
new int[] { 3 },
new int[] { 1 },
new Integer(5)
5
);
checkRandomData(random(), a, 100);
}
@ -198,13 +198,13 @@ public class TestMockAnalyzer extends BaseTokenStreamTestCase {
new String[] { "test", "123", "toolo", "ng", "ok" },
new int[] { 0, 5, 9, 14, 17 },
new int[] { 4, 8, 14, 16, 19 },
new Integer(20));
20);
assertTokenStreamContents(whitespace.tokenStream("bogus", "test 123 toolo"),
new String[] { "test", "123", "toolo" },
new int[] { 0, 5, 9 },
new int[] { 4, 8, 14 },
new Integer(14));
14);
}
public void testLUCENE_3042() throws Exception {

View File

@ -40,3 +40,21 @@ java.util.Collections#shuffle(java.util.List) @ Use shuffle(List, Random) instea
java.util.Locale#forLanguageTag(java.lang.String) @ use new Locale.Builder().setLanguageTag(...).build() which has error handling
java.util.Locale#toString() @ use Locale#toLanguageTag() for a standardized BCP47 locale name
@defaultMessage Constructors for wrapper classes of Java primitives should be avoided in favor of the public static methods available or autoboxingT
java.lang.Integer#<init>(int)
java.lang.Integer#<init>(java.lang.String)
java.lang.Byte#<init>(byte)
java.lang.Byte#<init>(java.lang.String)
java.lang.Short#<init>(short)
java.lang.Short#<init>(java.lang.String)
java.lang.Long#<init>(long)
java.lang.Long#<init>(java.lang.String)
java.lang.Boolean#<init>(boolean)
java.lang.Boolean#<init>(java.lang.String)
java.lang.Character#<init>(char)
java.lang.Float#<init>(float)
java.lang.Float#<init>(double)
java.lang.Float#<init>(java.lang.String)
java.lang.Double#<init>(double)
java.lang.Double#<init>(java.lang.String)

View File

@ -544,11 +544,11 @@ public class LibVersionsCheckTask extends Task {
Integer sm1 = SPECIAL_MEANINGS.get(parts1[i].toLowerCase(Locale.ROOT));
Integer sm2 = SPECIAL_MEANINGS.get(parts2[i].toLowerCase(Locale.ROOT));
if (sm1 != null) {
sm2 = sm2 == null ? new Integer(0) : sm2;
sm2 = sm2 == null ? 0 : sm2;
return sm1.compareTo(sm2);
}
if (sm2 != null) {
return new Integer(0).compareTo(sm2);
return Integer.valueOf(0).compareTo(sm2);
}
return parts1[i].compareTo(parts2[i]);
}

View File

@ -283,7 +283,7 @@ class IntegerFacetRangeGenerator extends FacetRangeGenerator<Integer> {
}
@Override
public Integer parseAndAddGap(Integer value, String gap) {
return new Integer(value.intValue() + Integer.valueOf(gap).intValue());
return value.intValue() + Integer.valueOf(gap).intValue();
}
}
class LongFacetRangeGenerator extends FacetRangeGenerator<Long> {
@ -295,7 +295,7 @@ class LongFacetRangeGenerator extends FacetRangeGenerator<Long> {
}
@Override
public Long parseAndAddGap(Long value, String gap) {
return new Long(value.longValue() + Long.valueOf(gap).longValue());
return value.longValue() + Long.valueOf(gap).longValue();
}
}
@ -308,7 +308,7 @@ class FloatFacetRangeGenerator extends FacetRangeGenerator<Float> {
}
@Override
public Float parseAndAddGap(Float value, String gap) {
return new Float(value.floatValue() + Float.valueOf(gap).floatValue());
return value.floatValue() + Float.valueOf(gap).floatValue();
}
}
@ -321,7 +321,7 @@ class DoubleFacetRangeGenerator extends FacetRangeGenerator<Double> {
}
@Override
public Double parseAndAddGap(Double value, String gap) {
return new Double(value.doubleValue() + Double.valueOf(gap).doubleValue());
return value.doubleValue() + Double.valueOf(gap).doubleValue();
}
}
class DateFacetRangeGenerator extends FacetRangeGenerator<Date> {

View File

@ -343,13 +343,13 @@ public class FillMissingFunctionTest extends SolrTestCaseJ4 {
assertTrue(func.exists());
val.setExists(false);
filler.setValue(new Boolean(true)).setExists(true);
assertEquals(new Boolean(true), func.getObject());
filler.setValue(Boolean.TRUE).setExists(true);
assertEquals(Boolean.TRUE, func.getObject());
assertTrue(func.exists());
val.setValue(new Long(234)).setExists(true);
val.setValue(234L).setExists(true);
filler.setExists(false);
assertEquals(new Long(234), func.getObject());
assertEquals(234L, func.getObject());
assertTrue(func.exists());
}
@ -688,7 +688,7 @@ public class FillMissingFunctionTest extends SolrTestCaseJ4 {
// Values exist
val.setValues("asdfs");
filler.setValues(new Date(12312), new Long(213123L));
filler.setValues(new Date(12312), 213123L);
Iterator<Object> values1 = Arrays.<Object>asList("asdfs").iterator();
func.streamObjects( value -> {
assertTrue(values1.hasNext());
@ -697,17 +697,17 @@ public class FillMissingFunctionTest extends SolrTestCaseJ4 {
assertFalse(values1.hasNext());
val.setValues();
filler.setValues(new Double(3234.42), "replacement");
Iterator<Object> values2 = Arrays.<Object>asList(new Double(3234.42), "replacement").iterator();
filler.setValues(3234.42d, "replacement");
Iterator<Object> values2 = Arrays.<Object>asList(3234.42d, "replacement").iterator();
func.streamObjects( value -> {
assertTrue(values2.hasNext());
assertEquals(values2.next(), value);
});
assertFalse(values2.hasNext());
val.setValues(new Date(3), "3", new Float(3F));
val.setValues(new Date(3), "3", 3F);
filler.setValues();
Iterator<Object> values3 = Arrays.<Object>asList(new Date(3), "3", new Float(3F)).iterator();
Iterator<Object> values3 = Arrays.<Object>asList(new Date(3), "3", 3F).iterator();
func.streamObjects( value -> {
assertTrue(values3.hasNext());
assertEquals(values3.next(), value);

View File

@ -417,9 +417,9 @@ public class FilterFunctionTest extends SolrTestCaseJ4 {
assertFalse(func.exists());
// Value exists
val.setValue(new Long(3)).setExists(true);
val.setValue(3L).setExists(true);
filter.setValue(true).setExists(true);
assertEquals(new Long(3), func.getObject());
assertEquals(3L, func.getObject());
assertTrue(func.exists());
val.setValue(new Date(2)).setExists(true);
@ -974,7 +974,7 @@ public class FilterFunctionTest extends SolrTestCaseJ4 {
assertTrue("There should be no values to stream", false);
});
val.setValues(new Integer(3), "3", new Date(3));
val.setValues(3, "3", new Date(3));
filter.setExists(false);
func.streamObjects( value -> {
assertTrue("There should be no values to stream", false);
@ -1012,7 +1012,7 @@ public class FilterFunctionTest extends SolrTestCaseJ4 {
assertFalse(values2.hasNext());
// Multiple values
val.setValues(new Integer(3), "3", new Date(3));
val.setValues(3, "3", new Date(3));
filter.setValue(false).setExists(true);
func.streamObjects( value -> {
@ -1020,7 +1020,7 @@ public class FilterFunctionTest extends SolrTestCaseJ4 {
});
filter.setValue(true).setExists(true);
Iterator<Object> values3 = Arrays.<Object>asList(new Integer(3), "3", new Date(3)).iterator();
Iterator<Object> values3 = Arrays.<Object>asList(3, "3", new Date(3)).iterator();
func.streamObjects( value -> {
assertTrue(values3.hasNext());
assertEquals(values3.next(), value);

View File

@ -463,19 +463,19 @@ public class IfFunctionTest extends SolrTestCaseJ4 {
cond.setExists(false);
then.setValue("if the value is true").setExists(true);
els.setValue(new Boolean(false)).setExists(true);
els.setValue(Boolean.FALSE).setExists(true);
func.getObject();
assertFalse(func.exists());
// Result doesn't exist
cond.setValue(true).setExists(true);
then.setExists(false);
els.setValue(new Long(123421324L)).setExists(true);
els.setValue(123421324L).setExists(true);
func.getObject();
assertFalse(func.exists());
cond.setValue(false).setExists(true);
then.setValue(new Float(1234324.454F)).setExists(true);
then.setValue(1234324.454F).setExists(true);
els.setExists(false);
func.getObject();
assertFalse(func.exists());
@ -949,8 +949,8 @@ public class IfFunctionTest extends SolrTestCaseJ4 {
});
cond.setExists(false);
then.setValues(new Date(142341), "abcsdafasd", new Double(1234.1324123));
els.setValues(new Float(324923.0234F), new Integer(123), new Boolean(true), "if statement");
then.setValues(new Date(142341), "abcsdafasd", 1234.1324123);
els.setValues(324923.0234F, 123, Boolean.TRUE, "if statement");
func.streamObjects( value -> {
assertTrue("There should be no values to stream", false);
});
@ -958,13 +958,13 @@ public class IfFunctionTest extends SolrTestCaseJ4 {
// Result doesn't exist
cond.setValue(true).setExists(true);
then.setValues();
els.setValues(new Float(324923.0234F), new Integer(123), new Boolean(true), "if statement");
els.setValues(324923.0234F, 123, Boolean.TRUE, "if statement");
func.streamObjects( value -> {
assertTrue("There should be no values to stream", false);
});
cond.setValue(false).setExists(true);
then.setValues(new Date(142341), "abcsdafasd", new Double(1234.1324123));
then.setValues(new Date(142341), "abcsdafasd", 1234.1324123);
els.setValues();
func.streamObjects( value -> {
assertTrue("There should be no values to stream", false);
@ -972,9 +972,9 @@ public class IfFunctionTest extends SolrTestCaseJ4 {
// Values exist
cond.setValue(true).setExists(true);
then.setValues(new Date(142341), "abcsdafasd", new Double(1234.1324123));
els.setValues(new Float(324923.0234F), new Integer(123), new Boolean(true), "if statement");
Iterator<Object> values1 = Arrays.<Object>asList(new Date(142341), "abcsdafasd", new Double(1234.1324123)).iterator();
then.setValues(new Date(142341), "abcsdafasd", 1234.1324123);
els.setValues(324923.0234F, 123, Boolean.TRUE, "if statement");
Iterator<Object> values1 = Arrays.<Object>asList(new Date(142341), "abcsdafasd", 1234.1324123).iterator();
func.streamObjects( value -> {
assertTrue(values1.hasNext());
assertEquals(values1.next(), value);
@ -982,9 +982,9 @@ public class IfFunctionTest extends SolrTestCaseJ4 {
assertFalse(values1.hasNext());
cond.setValue(false).setExists(true);
then.setValues(new Date(142341), "abcsdafasd", new Double(1234.1324123));
els.setValues(new Float(324923.0234F), new Integer(123), new Boolean(true), "if statement");
Iterator<Object> values2 = Arrays.<Object>asList(new Float(324923.0234F), new Integer(123), new Boolean(true), "if statement").iterator();
then.setValues(new Date(142341), "abcsdafasd", 1234.1324123);
els.setValues(324923.0234F, 123, Boolean.TRUE, "if statement");
Iterator<Object> values2 = Arrays.<Object>asList(324923.0234F, 123, Boolean.TRUE, "if statement").iterator();
func.streamObjects( value -> {
assertTrue(values2.hasNext());
assertEquals(values2.next(), value);

View File

@ -367,7 +367,7 @@ public class RemoveFunctionTest extends SolrTestCaseJ4 {
assertFalse(func.exists());
val.setExists(false);
remover.setValue(new Boolean(true)).setExists(true);
remover.setValue(Boolean.TRUE).setExists(true);
func.getObject();
assertFalse(func.exists());
@ -377,14 +377,14 @@ public class RemoveFunctionTest extends SolrTestCaseJ4 {
assertEquals("abc123", func.getObject());
assertTrue(func.exists());
val.setValue(new Double(23423.0)).setExists(true);
remover.setValue(new Double(23423.0)).setExists(true);
val.setValue(23423.0d).setExists(true);
remover.setValue(23423.0d).setExists(true);
func.getObject();
assertFalse(func.exists());
val.setValue(new Long(234)).setExists(true);
val.setValue(234L).setExists(true);
remover.setExists(false);
assertEquals(new Long(234), func.getObject());
assertEquals(234L, func.getObject());
assertTrue(func.exists());
}
@ -813,27 +813,27 @@ public class RemoveFunctionTest extends SolrTestCaseJ4 {
});
// Values exist
val.setValues("asdfs", new Date(12312), new Long(213123L), new Date(12312));
val.setValues("asdfs", new Date(12312), 213123L, new Date(12312));
remover.setValue(new Date(12312)).setExists(true);
Iterator<Object> values1 = Arrays.<Object>asList("asdfs", new Long(213123L)).iterator();
Iterator<Object> values1 = Arrays.<Object>asList("asdfs", 213123L).iterator();
func.streamObjects( value -> {
assertTrue(values1.hasNext());
assertEquals(values1.next(), value);
});
assertFalse(values1.hasNext());
val.setValues("asdfs", new Date(12312), new Long(213123L), new Date(12312));
val.setValues("asdfs", new Date(12312), 213123L, new Date(12312));
remover.setExists(false);
Iterator<Object> values2 = Arrays.<Object>asList("asdfs", new Date(12312), new Long(213123L), new Date(12312)).iterator();
Iterator<Object> values2 = Arrays.<Object>asList("asdfs", new Date(12312), 213123L, new Date(12312)).iterator();
func.streamObjects( value -> {
assertTrue(values2.hasNext());
assertEquals(values2.next(), value);
});
assertFalse(values2.hasNext());
val.setValues(new Date(3), "3", new Float(3F));
val.setValues(new Date(3), "3", 3F);
remover.setValue(new Date(4)).setExists(true);
Iterator<Object> values3 = Arrays.<Object>asList(new Date(3), "3", new Float(3F)).iterator();
Iterator<Object> values3 = Arrays.<Object>asList(new Date(3), "3", 3F).iterator();
func.streamObjects( value -> {
assertTrue(values3.hasNext());
assertEquals(values3.next(), value);

View File

@ -484,7 +484,7 @@ public class ReplaceFunctionTest extends SolrTestCaseJ4 {
assertFalse(func.exists());
val.setExists(false);
comp.setValue(new Boolean(true)).setExists(true);
comp.setValue(Boolean.TRUE).setExists(true);
fill.setValue("abc").setExists(true);
func.getObject();
assertFalse(func.exists());
@ -499,7 +499,7 @@ public class ReplaceFunctionTest extends SolrTestCaseJ4 {
// Value exists
// Comp != Val
val.setValue(new Date(1234)).setExists(true);
comp.setValue(new Integer(1234)).setExists(true);
comp.setValue(1234).setExists(true);
fill.setValue("not used").setExists(true);
assertEquals(new Date(1234), func.getObject());
@ -510,8 +510,8 @@ public class ReplaceFunctionTest extends SolrTestCaseJ4 {
assertTrue(func.exists());
// Comp == Val
val.setValue(new Float(2342.324F)).setExists(true);
comp.setValue(new Float(2342.324F)).setExists(true);
val.setValue(2342.324F).setExists(true);
comp.setValue(2342.324F).setExists(true);
fill.setExists(false);
func.getObject();
@ -956,10 +956,10 @@ public class ReplaceFunctionTest extends SolrTestCaseJ4 {
});
// Comp doesn't exist
val.setValues("asdfs", new Date(12312), new Long(213123L), new Date(12312));
val.setValues("asdfs", new Date(12312), 213123L, new Date(12312));
comp.setExists(false);
fill.setValue("won't show up").setExists(true);
Iterator<Object> values1 = Arrays.<Object>asList("asdfs", new Date(12312), new Long(213123L), new Date(12312)).iterator();
Iterator<Object> values1 = Arrays.<Object>asList("asdfs", new Date(12312), 213123L, new Date(12312)).iterator();
func.streamObjects( value -> {
assertTrue(values1.hasNext());
assertEquals(values1.next(), value);
@ -967,20 +967,20 @@ public class ReplaceFunctionTest extends SolrTestCaseJ4 {
assertFalse(values1.hasNext());
// Values exist
val.setValues("asdfs", new Date(12312), new Long(213123L), new Date(12312));
val.setValues("asdfs", new Date(12312), 213123L, new Date(12312));
comp.setValue("asdfs").setExists(true);
fill.setExists(false);
Iterator<Object> values2 = Arrays.<Object>asList(new Date(12312), new Long(213123L), new Date(12312)).iterator();
Iterator<Object> values2 = Arrays.<Object>asList(new Date(12312), 213123L, new Date(12312)).iterator();
func.streamObjects( value -> {
assertTrue(values2.hasNext());
assertEquals(values2.next(), value);
});
assertFalse(values2.hasNext());
val.setValues("asdfs", new Date(12312), new Long(213123L), new Date(12312));
val.setValues("asdfs", new Date(12312), 213123L, new Date(12312));
comp.setValue(new Date(12312)).setExists(true);
fill.setValue(new Boolean(false)).setExists(true);
Iterator<Object> values3 = Arrays.<Object>asList("asdfs", new Boolean(false), new Long(213123L), new Boolean(false)).iterator();
fill.setValue(Boolean.FALSE).setExists(true);
Iterator<Object> values3 = Arrays.<Object>asList("asdfs", Boolean.FALSE, 213123L, Boolean.FALSE).iterator();
func.streamObjects( value -> {
assertTrue(values3.hasNext());
assertEquals(values3.next(), value);

View File

@ -61,10 +61,10 @@ public class LegacyNoFacetTest extends LegacyAbstractAnalyticsTest {
public static void beforeClass() throws Exception {
initCore("solrconfig-analytics.xml","schema-analytics.xml");
h.update("<delete><query>*:*</query></delete>");
defaults.put("int_id", new Integer(0));
defaults.put("long_ld", new Long(0));
defaults.put("float_fd", new Float(0));
defaults.put("double_dd", new Double(0));
defaults.put("int_id", 0);
defaults.put("long_ld", 0L);
defaults.put("float_fd", (float) 0);
defaults.put("double_dd", (double) 0);
defaults.put("date_dtd", "1800-12-31T23:59:59Z");
defaults.put("string_sd", "str0");

View File

@ -90,11 +90,11 @@ public class LegacyFieldFacetTest extends LegacyAbstractAnalyticsFacetTest{
public static void beforeClass() throws Exception {
initCore("solrconfig-analytics.xml","schema-analytics.xml");
h.update("<delete><query>*:*</query></delete>");
defaults.put("int", new Integer(0));
defaults.put("long", new Long(0));
defaults.put("float", new Float(0));
defaults.put("double", new Double(0));
defaults.put("int", 0);
defaults.put("long", 0L);
defaults.put("float", (float) 0);
defaults.put("double", (double) 0);
defaults.put("date", "1800-12-31T23:59:59Z");
defaults.put("string", "str0");

View File

@ -67,7 +67,7 @@ public class LegacyQueryFacetTest extends LegacyAbstractAnalyticsFacetTest {
int dt = j%DATE;
int s = j%STRING;
assertU(adoc("id", "1000" + j, "int_id", "" + i, "long_ld", "" + l, "float_fd", "" + f,
"double_dd", "" + d, "date_dtd", (1800+dt) + "-12-31T23:59:59.999Z", "string_sd", "abc" + new Integer(s).toString().charAt(0)));
"double_dd", "" + d, "date_dtd", (1800+dt) + "-12-31T23:59:59.999Z", "string_sd", "abc" + Integer.toString(s).charAt(0)));
if (f<=50) {
int1TestStart.get(0).add(i);
@ -75,10 +75,10 @@ public class LegacyQueryFacetTest extends LegacyAbstractAnalyticsFacetTest {
if (f<=30) {
int2TestStart.get(0).add(i);
}
if (new Integer(s).toString().charAt(0)=='1') {
if (Integer.toString(s).charAt(0)=='1') {
longTestStart.get(0).add(l);
}
if (new Integer(s).toString().charAt(0)=='2') {
if (Integer.toString(s).charAt(0)=='2') {
longTestStart.get(1).add(l);
}
if (l>=30) {

View File

@ -63,7 +63,7 @@ public class CastingBooleanValueStreamTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValues(false, true, false);
Iterator<Object> values = Arrays.<Object>asList(new Boolean(false), new Boolean(true), new Boolean(false)).iterator();
Iterator<Object> values = Arrays.<Object>asList(Boolean.FALSE, Boolean.TRUE, Boolean.FALSE).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -51,11 +51,11 @@ public class CastingBooleanValueTest extends SolrTestCaseJ4 {
AnalyticsValue casted = (AnalyticsValue)val;
val.setValue(false).setExists(true);
assertEquals(new Boolean(false), casted.getObject());
assertEquals(Boolean.FALSE, casted.getObject());
assertTrue(casted.exists());
val.setValue(true).setExists(true);
assertEquals(new Boolean(true), casted.getObject());
assertEquals(Boolean.TRUE, casted.getObject());
assertTrue(casted.exists());
}
@ -120,7 +120,7 @@ public class CastingBooleanValueTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValue(false).setExists(true);
Iterator<Object> values = Arrays.<Object>asList(new Boolean(false)).iterator();
Iterator<Object> values = Arrays.<Object>asList(Boolean.FALSE).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -63,7 +63,7 @@ public class CastingDoubleValueStreamTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValues(20.0, -3.32, 42.5);
Iterator<Object> values = Arrays.<Object>asList(new Double(20.0), new Double(-3.32), new Double(42.5)).iterator();
Iterator<Object> values = Arrays.<Object>asList(20.0, -3.32, 42.5).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -51,11 +51,11 @@ public class CastingDoubleValueTest extends SolrTestCaseJ4 {
AnalyticsValue casted = (AnalyticsValue)val;
val.setValue(20.0).setExists(true);
assertEquals(new Double(20.0), casted.getObject());
assertEquals(20.0d, casted.getObject());
assertTrue(casted.exists());
val.setValue(1234.0).setExists(true);
assertEquals(new Double(1234.0), casted.getObject());
assertEquals(1234.0d, casted.getObject());
assertTrue(casted.exists());
}
@ -120,7 +120,7 @@ public class CastingDoubleValueTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValue(20.0).setExists(true);
Iterator<Object> values = Arrays.<Object>asList(new Double(20.0)).iterator();
Iterator<Object> values = Arrays.<Object>asList(20.0d).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -86,7 +86,7 @@ public class CastingFloatValueStreamTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValues(20F, -3.32F, 42.5F);
Iterator<Object> values = Arrays.<Object>asList(new Float(20F), new Float(-3.32F), new Float(42.5F)).iterator();
Iterator<Object> values = Arrays.<Object>asList(20F, -3.32F, 42.5F).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -67,11 +67,11 @@ public class CastingFloatValueTest extends SolrTestCaseJ4 {
AnalyticsValue casted = (AnalyticsValue)val;
val.setValue(20F).setExists(true);
assertEquals(new Float(20F), casted.getObject());
assertEquals(20F, casted.getObject());
assertTrue(casted.exists());
val.setValue(1234F).setExists(true);
assertEquals(new Float(1234F), casted.getObject());
assertEquals(1234F, casted.getObject());
assertTrue(casted.exists());
}
@ -159,7 +159,7 @@ public class CastingFloatValueTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValue(20F).setExists(true);
Iterator<Object> values = Arrays.<Object>asList(new Float(20F)).iterator();
Iterator<Object> values = Arrays.<Object>asList(20F).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -132,7 +132,7 @@ public class CastingIntValueStreamTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValues(20, -3, 42);
Iterator<Object> values = Arrays.<Object>asList(new Integer(20), new Integer(-3), new Integer(42)).iterator();
Iterator<Object> values = Arrays.<Object>asList(20, -3, 42).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -99,11 +99,11 @@ public class CastingIntValueTest extends SolrTestCaseJ4 {
AnalyticsValue casted = (AnalyticsValue)val;
val.setValue(20).setExists(true);
assertEquals(new Integer(20), casted.getObject());
assertEquals(20, casted.getObject());
assertTrue(casted.exists());
val.setValue(1234).setExists(true);
assertEquals(new Integer(1234), casted.getObject());
assertEquals(1234, casted.getObject());
assertTrue(casted.exists());
}
@ -237,7 +237,7 @@ public class CastingIntValueTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValue(20).setExists(true);
Iterator<Object> values = Arrays.<Object>asList(new Integer(20)).iterator();
Iterator<Object> values = Arrays.<Object>asList(20).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -86,7 +86,7 @@ public class CastingLongValueStreamTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValues(20L, -3L, 42L);
Iterator<Object> values = Arrays.<Object>asList(new Long(20L), new Long(-3L), new Long(42L)).iterator();
Iterator<Object> values = Arrays.<Object>asList(20L, -3L, 42L).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -67,11 +67,11 @@ public class CastingLongValueTest extends SolrTestCaseJ4 {
AnalyticsValue casted = (AnalyticsValue)val;
val.setValue(20L).setExists(true);
assertEquals(new Long(20), casted.getObject());
assertEquals(20L, casted.getObject());
assertTrue(casted.exists());
val.setValue(1234L).setExists(true);
assertEquals(new Long(1234), casted.getObject());
assertEquals(1234L, casted.getObject());
assertTrue(casted.exists());
}
@ -159,7 +159,7 @@ public class CastingLongValueTest extends SolrTestCaseJ4 {
// Multiple Values
val.setValue(20L).setExists(true);
Iterator<Object> values = Arrays.<Object>asList(new Long(20L)).iterator();
Iterator<Object> values = Arrays.<Object>asList(20L).iterator();
casted.streamObjects( value -> {
assertTrue(values.hasNext());
assertEquals(values.next(), value);

View File

@ -100,7 +100,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
assertTrue(val.exists());
assertEquals(true, val.getBoolean());
assertEquals("true", val.getString());
assertEquals(new Boolean(true), val.getObject());
assertEquals(Boolean.TRUE, val.getObject());
TestIntValue counter = new TestIntValue();
counter.setValue(0);
@ -117,7 +117,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
});
counter.setValue(0);
val.streamObjects( value -> {
assertEquals(new Boolean(true), value);
assertEquals(Boolean.TRUE, value);
assertEquals(0, counter.getInt());
counter.setValue(1);
});
@ -128,7 +128,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
assertTrue(val.exists());
assertEquals(false, val.getBoolean());
assertEquals("false", val.getString());
assertEquals(new Boolean(false), val.getObject());
assertEquals(Boolean.FALSE, val.getObject());
counter.setValue(0);
val.streamBooleans( value -> {
@ -144,7 +144,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
});
counter.setValue(0);
val.streamObjects( value -> {
assertEquals(new Boolean(false), value);
assertEquals(Boolean.FALSE, value);
assertEquals(0, counter.getInt());
counter.setValue(1);
});
@ -160,7 +160,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
assertEquals(24F, val.getFloat(), .00001);
assertEquals(24.0, val.getDouble(), .00001);
assertEquals("24", val.getString());
assertEquals(new Integer(24), val.getObject());
assertEquals(24, val.getObject());
TestIntValue counter = new TestIntValue();
counter.setValue(0);
@ -195,7 +195,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
});
counter.setValue(0);
val.streamObjects( value -> {
assertEquals(new Integer(24), value);
assertEquals(24, value);
assertEquals(0, counter.getInt());
counter.setValue(1);
});
@ -209,7 +209,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
assertEquals(24L, val.getLong());
assertEquals(24.0, val.getDouble(), .00001);
assertEquals("24", val.getString());
assertEquals(new Long(24L), val.getObject());
assertEquals(24L, val.getObject());
TestIntValue counter = new TestIntValue();
counter.setValue(0);
@ -232,7 +232,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
});
counter.setValue(0);
val.streamObjects( value -> {
assertEquals(new Long(24L), value);
assertEquals(24L, value);
assertEquals(0, counter.getInt());
counter.setValue(1);
});
@ -246,7 +246,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
assertEquals(24F, val.getFloat(), .00001);
assertEquals(24.0, val.getDouble(), .00001);
assertEquals("24.0", val.getString());
assertEquals(new Float(24F), val.getObject());
assertEquals(24F, val.getObject());
TestIntValue counter = new TestIntValue();
counter.setValue(0);
@ -269,7 +269,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
});
counter.setValue(0);
val.streamObjects( value -> {
assertEquals(new Float(24F), value);
assertEquals(24F, value);
assertEquals(0, counter.getInt());
counter.setValue(1);
});
@ -282,7 +282,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
assertTrue(val.exists());
assertEquals(24.0, val.getDouble(), .00001);
assertEquals("24.0", val.getString());
assertEquals(new Double(24.0), val.getObject());
assertEquals(24.0, val.getObject());
TestIntValue counter = new TestIntValue();
counter.setValue(0);
@ -299,7 +299,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
});
counter.setValue(0);
val.streamObjects( value -> {
assertEquals(new Double(24.0), value);
assertEquals(24.0, value);
assertEquals(0, counter.getInt());
counter.setValue(1);
});

View File

@ -141,7 +141,7 @@ public class ClusteringComponent extends SearchComponent implements SolrCoreAwar
list.add( doc );
if( ids != null ) {
ids.put( doc, new Integer(docid) );
ids.put( doc, docid );
}
}
return list;

View File

@ -148,7 +148,7 @@ public class SolrEntityProcessor extends EntityProcessorBase {
nextPage();
}
} else {
Boolean cursor = new Boolean(context
boolean cursor = Boolean.parseBoolean(context
.getResolvedEntityAttribute(CursorMarkParams.CURSOR_MARK_PARAM));
rowIterator = !cursor ? new SolrDocumentListIterator(new SolrDocumentList())
: new SolrDocumentListCursor(new SolrDocumentList(), CursorMarkParams.CURSOR_MARK_START);

View File

@ -55,14 +55,14 @@ public class AbstractDIHCacheTestCase {
// The first row needs to have all non-null fields,
// otherwise we would have to always send the fieldTypes & fieldNames as CacheProperties when building.
data = new ArrayList<>();
data.add(new ControlData(new Object[] { new Integer(1), new BigDecimal(Math.PI), "A", "Apple", new Float(1.11), Feb21_2011, APPLE }));
data.add(new ControlData(new Object[] { new Integer(2), new BigDecimal(Math.PI), "B", "Ball", new Float(2.22), Feb21_2011, null }));
data.add(new ControlData(new Object[] { new Integer(4), new BigDecimal(Math.PI), "D", "Dog", new Float(4.44), Feb21_2011, null }));
data.add(new ControlData(new Object[] { new Integer(3), new BigDecimal(Math.PI), "C", "Cookie", new Float(3.33), Feb21_2011, null }));
data.add(new ControlData(new Object[] { new Integer(4), new BigDecimal(Math.PI), "D", "Daisy", new Float(4.44), Feb21_2011, null }));
data.add(new ControlData(new Object[] { new Integer(4), new BigDecimal(Math.PI), "D", "Drawing", new Float(4.44), Feb21_2011, null }));
data.add(new ControlData(new Object[] { new Integer(5), new BigDecimal(Math.PI), "E",
Arrays.asList("Eggplant", "Ear", "Elephant", "Engine"), new Float(5.55), Feb21_2011, null }));
data.add(new ControlData(new Object[] {1, new BigDecimal(Math.PI), "A", "Apple", 1.11f, Feb21_2011, APPLE }));
data.add(new ControlData(new Object[] {2, new BigDecimal(Math.PI), "B", "Ball", 2.22f, Feb21_2011, null }));
data.add(new ControlData(new Object[] {4, new BigDecimal(Math.PI), "D", "Dog", 4.44f, Feb21_2011, null }));
data.add(new ControlData(new Object[] {3, new BigDecimal(Math.PI), "C", "Cookie", 3.33f, Feb21_2011, null }));
data.add(new ControlData(new Object[] {4, new BigDecimal(Math.PI), "D", "Daisy", 4.44f, Feb21_2011, null }));
data.add(new ControlData(new Object[] {4, new BigDecimal(Math.PI), "D", "Drawing", 4.44f, Feb21_2011, null }));
data.add(new ControlData(new Object[] {5, new BigDecimal(Math.PI), "E",
Arrays.asList("Eggplant", "Ear", "Elephant", "Engine"), 5.55f, Feb21_2011, null }));
}
@After

View File

@ -89,7 +89,7 @@ public class TestBuiltInEvaluators extends AbstractDataImportHandlerTestCase {
return null;
}
}).parseParams(" 1 , a.b, 'hello!', 'ds,o,u\'za',",vr);
assertEquals(new Double(1),l.get(0));
assertEquals(1d,l.get(0));
assertEquals("B",((Evaluator.VariableWrapper)l.get(1)).resolve());
assertEquals("hello!",l.get(2));
assertEquals("ds,o,u'za",l.get(3));

View File

@ -48,8 +48,8 @@ public class TestNumberFormatTransformer extends AbstractDataImportHandlerTestCa
Context c = getContext(null, null, null, Context.FULL_DUMP, l, null);
Map<String,Object> m = createMap("num", "123" + GROUPING_SEP + "567", "localizedNum", "123" + GERMAN_GROUPING_SEP + "567");
new NumberFormatTransformer().transformRow(m, c);
assertEquals(new Long(123567), m.get("num"));
assertEquals(new Long(123567), m.get("localizedNum"));
assertEquals(123567L, m.get("num"));
assertEquals(123567L, m.get("localizedNum"));
}
@Test
@ -73,8 +73,8 @@ public class TestNumberFormatTransformer extends AbstractDataImportHandlerTestCa
new NumberFormatTransformer().transformRow(row, context);
List<Long> output = new ArrayList<>();
output.add(new Long(123567));
output.add(new Long(245678));
output.add(123567L);
output.add(245678L);
Map<String, Object> outputRow = createMap("inputs", inputs, "outputs", output);
assertEquals(outputRow, row);
@ -155,6 +155,6 @@ public class TestNumberFormatTransformer extends AbstractDataImportHandlerTestCa
Context c = getContext(null, null, null, Context.FULL_DUMP, l, null);
Map<String, Object> m = createMap("num", "123" + GROUPING_SEP + GROUPING_SEP + "789");
new NumberFormatTransformer().transformRow(m, c);
assertEquals(new Long(123789), m.get("num"));
assertEquals(123789L, m.get("num"));
}
}

View File

@ -126,12 +126,12 @@ public class TestSortedMapBackedCache extends AbstractDIHCacheTestCase {
int j = 0;
for (int i = 0; i < data.size(); i++) {
// We'll be deleting a_id=1 so remove it from the control data.
if (data.get(i).data[0].equals(new Integer(1))) {
if (data.get(i).data[0].equals(1)) {
continue;
}
// We'll be changing "Cookie" to "Carrot" in a_id=3 so change it in the control data.
if (data.get(i).data[0].equals(new Integer(3))) {
if (data.get(i).data[0].equals(3)) {
newIdEqualsThree = new Object[data.get(i).data.length];
System.arraycopy(data.get(i).data, 0, newIdEqualsThree, 0, newIdEqualsThree.length);
newIdEqualsThree[3] = "Carrot";
@ -146,8 +146,8 @@ public class TestSortedMapBackedCache extends AbstractDIHCacheTestCase {
}
// These new rows of data will get added to the cache, so add them to the control data too.
Object[] newDataRow1 = new Object[] { new Integer(99), new BigDecimal(Math.PI), "Z", "Zebra", new Float(99.99), Feb21_2011, null };
Object[] newDataRow2 = new Object[] { new Integer(2), new BigDecimal(Math.PI), "B", "Ballerina", new Float(2.22), Feb21_2011, null };
Object[] newDataRow1 = new Object[] {99, new BigDecimal(Math.PI), "Z", "Zebra", 99.99f, Feb21_2011, null };
Object[] newDataRow2 = new Object[] {2, new BigDecimal(Math.PI), "B", "Ballerina", 2.22f, Feb21_2011, null };
newControlData.add(new ControlData(newDataRow1));
newControlData.add(new ControlData(newDataRow2));
@ -156,11 +156,11 @@ public class TestSortedMapBackedCache extends AbstractDIHCacheTestCase {
cache.open(getContext(new HashMap<String,String>()));
// Delete a_id=1 from the cache.
cache.delete(new Integer(1));
cache.delete(1);
// Because the cache allows duplicates, the only way to update is to
// delete first then add.
cache.delete(new Integer(3));
cache.delete(3);
cache.add(controlDataToMap(new ControlData(newIdEqualsThree), fieldNames, false));
// Add this row with a new Primary key.

View File

@ -177,7 +177,7 @@ public class LTRRescorer extends Rescorer {
scorer.docID();
scorer.iterator().advance(targetDoc);
scorer.getDocInfo().setOriginalDocScore(new Float(hit.score));
scorer.getDocInfo().setOriginalDocScore(hit.score);
hit.score = scorer.score();
if (hitUpto < topN) {
reranked[hitUpto] = hit;

View File

@ -78,7 +78,7 @@ public class LinearModel extends LTRScoringModel {
for (int ii = 0; ii < features.size(); ++ii) {
final String key = features.get(ii).getName();
final Double val = modelWeights.get(key);
featureToWeight[ii] = (val == null ? null : new Float(val.floatValue()));
featureToWeight[ii] = (val == null ? null : val.floatValue());
}
}

View File

@ -246,11 +246,11 @@ public class MultipleAdditiveTreesModel extends LTRScoringModel {
private RegressionTreeNode root;
public void setWeight(float weight) {
this.weight = new Float(weight);
this.weight = weight;
}
public void setWeight(String weight) {
this.weight = new Float(weight);
this.weight = Float.valueOf(weight);
}
public void setRoot(Object root) {

View File

@ -256,7 +256,7 @@ public class LTRFeatureLoggerTransformerFactory extends TransformerFactory {
@Override
public void transform(SolrDocument doc, int docid, float score)
throws IOException {
implTransform(doc, docid, new Float(score));
implTransform(doc, docid, score);
}
@Override

View File

@ -279,7 +279,7 @@ public class TestLTRReRankingPipeline extends LuceneTestCase {
LTRScoringQuery query = new LTRScoringQuery(ltrScoringModel);
LTRScoringQuery.ModelWeight wgt = query.createWeight(null, ScoreMode.COMPLETE, 1f);
LTRScoringQuery.ModelWeight.ModelScorer modelScr = wgt.scorer(null);
modelScr.getDocInfo().setOriginalDocScore(new Float(1f));
modelScr.getDocInfo().setOriginalDocScore(1f);
for (final Scorer.ChildScorer feat : modelScr.getChildren()) {
assertNotNull(((Feature.FeatureWeight.FeatureScorer) feat.child).getDocInfo().getOriginalDocScore());
}
@ -295,7 +295,7 @@ public class TestLTRReRankingPipeline extends LuceneTestCase {
query = new LTRScoringQuery(ltrScoringModel);
wgt = query.createWeight(null, ScoreMode.COMPLETE, 1f);
modelScr = wgt.scorer(null);
modelScr.getDocInfo().setOriginalDocScore(new Float(1f));
modelScr.getDocInfo().setOriginalDocScore(1f);
for (final Scorer.ChildScorer feat : modelScr.getChildren()) {
assertNotNull(((Feature.FeatureWeight.FeatureScorer) feat.child).getDocInfo().getOriginalDocScore());
}

View File

@ -44,28 +44,28 @@ public class TestFeatureExtractionFromMultipleSegments extends TestRerankBase {
setuptest("solrconfig-multiseg.xml", "schema.xml");
// index 400 documents
for(int i = 0; i<400;i=i+20) {
assertU(adoc("id", new Integer(i).toString(), "popularity", "201", "description", "apple is a company " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+1).toString(), "popularity", "201", "description", "d " + randomString(i%6+3), "normHits", "0.11"));
assertU(adoc("id", Integer.toString(i), "popularity", "201", "description", "apple is a company " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+1), "popularity", "201", "description", "d " + randomString(i%6+3), "normHits", "0.11"));
assertU(adoc("id", new Integer(i+2).toString(), "popularity", "201", "description", "apple is a company too " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+3).toString(), "popularity", "201", "description", "new york city is big apple " + randomString(i%6+3), "normHits", "0.11"));
assertU(adoc("id", Integer.toString(i+2), "popularity", "201", "description", "apple is a company too " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+3), "popularity", "201", "description", "new york city is big apple " + randomString(i%6+3), "normHits", "0.11"));
assertU(adoc("id", new Integer(i+6).toString(), "popularity", "301", "description", "function name " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+7).toString(), "popularity", "301", "description", "function " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+6), "popularity", "301", "description", "function name " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+7), "popularity", "301", "description", "function " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+8).toString(), "popularity", "301", "description", "This is a sample function for testing " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+9).toString(), "popularity", "301", "description", "Function to check out stock prices "+randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+10).toString(),"popularity", "301", "description", "Some descriptions "+randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+8), "popularity", "301", "description", "This is a sample function for testing " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+9), "popularity", "301", "description", "Function to check out stock prices "+randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+10),"popularity", "301", "description", "Some descriptions "+randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+11).toString(), "popularity", "201", "description", "apple apple is a company " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+12).toString(), "popularity", "201", "description", "Big Apple is New York.", "normHits", "0.01"));
assertU(adoc("id", new Integer(i+13).toString(), "popularity", "201", "description", "New some York is Big. "+ randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+11), "popularity", "201", "description", "apple apple is a company " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+12), "popularity", "201", "description", "Big Apple is New York.", "normHits", "0.01"));
assertU(adoc("id", Integer.toString(i+13), "popularity", "201", "description", "New some York is Big. "+ randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+14).toString(), "popularity", "201", "description", "apple apple is a company " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+15).toString(), "popularity", "201", "description", "Big Apple is New York.", "normHits", "0.01"));
assertU(adoc("id", new Integer(i+16).toString(), "popularity", "401", "description", "barack h", "normHits", "0.0"));
assertU(adoc("id", new Integer(i+17).toString(), "popularity", "201", "description", "red delicious apple " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", new Integer(i+18).toString(), "popularity", "201", "description", "nyc " + randomString(i%6+3), "normHits", "0.11"));
assertU(adoc("id", Integer.toString(i+14), "popularity", "201", "description", "apple apple is a company " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+15), "popularity", "201", "description", "Big Apple is New York.", "normHits", "0.01"));
assertU(adoc("id", Integer.toString(i+16), "popularity", "401", "description", "barack h", "normHits", "0.0"));
assertU(adoc("id", Integer.toString(i+17), "popularity", "201", "description", "red delicious apple " + randomString(i%6+3), "normHits", "0.1"));
assertU(adoc("id", Integer.toString(i+18), "popularity", "201", "description", "nyc " + randomString(i%6+3), "normHits", "0.11"));
}
assertU(commit());
@ -85,7 +85,7 @@ public class TestFeatureExtractionFromMultipleSegments extends TestRerankBase {
query.setQuery("{!edismax qf='description^1' boost='sum(product(pow(normHits, 0.7), 1600), .1)' v='apple'}");
// request 100 rows, if any rows are fetched from the second or subsequent segments the tests should succeed if LTRRescorer::extractFeaturesInfo() advances the doc iterator properly
int numRows = 100;
query.add("rows", (new Integer(numRows)).toString());
query.add("rows", Integer.toString(numRows));
query.add("wt", "json");
query.add("fq", "popularity:201");
query.add("fl", "*, score,id,normHits,description,fv:[features store='feature-store-6' format='dense' efi.user_text='apple']");

View File

@ -461,7 +461,7 @@ public class HdfsDirectoryFactory extends CachingDirectoryFactory implements Sol
}
synchronized (HdfsDirectoryFactory.class) {
if (kerberosInit == null) {
kerberosInit = new Boolean(true);
kerberosInit = Boolean.TRUE;
final Configuration conf = getConf();
final String authVal = conf.get(HADOOP_SECURITY_AUTHENTICATION);
final String kerberos = "kerberos";

View File

@ -574,7 +574,7 @@ public class IndexFetcher {
reloadCore = true; // reload update log
}
final long timeTakenSeconds = getReplicationTimeElapsed();
final Long bytesDownloadedPerSecond = (timeTakenSeconds != 0 ? new Long(bytesDownloaded/timeTakenSeconds) : null);
final Long bytesDownloadedPerSecond = (timeTakenSeconds != 0 ? Long.valueOf(bytesDownloaded / timeTakenSeconds) : null);
LOG.info("Total time taken for download (fullCopy={},bytesDownloaded={}) : {} secs ({} bytes/sec) to {}",
isFullCopyNeeded, bytesDownloaded, timeTakenSeconds, bytesDownloadedPerSecond, tmpIndexDir);

View File

@ -666,7 +666,7 @@ public class RangeFacetRequest extends FacetComponent.FacetBase {
@Override
public Float parseAndAddGap(Float value, String gap) {
return new Float(value.floatValue() + Float.parseFloat(gap));
return value.floatValue() + Float.parseFloat(gap);
}
}
@ -684,7 +684,7 @@ public class RangeFacetRequest extends FacetComponent.FacetBase {
@Override
public Double parseAndAddGap(Double value, String gap) {
return new Double(value.doubleValue() + Double.parseDouble(gap));
return value.doubleValue() + Double.parseDouble(gap);
}
}
@ -702,7 +702,7 @@ public class RangeFacetRequest extends FacetComponent.FacetBase {
@Override
public Integer parseAndAddGap(Integer value, String gap) {
return new Integer(value.intValue() + Integer.parseInt(gap));
return value.intValue() + Integer.parseInt(gap);
}
}
@ -720,7 +720,7 @@ public class RangeFacetRequest extends FacetComponent.FacetBase {
@Override
public Long parseAndAddGap(Long value, String gap) {
return new Long(value.longValue() + Long.parseLong(gap));
return value.longValue() + Long.parseLong(gap);
}
}

View File

@ -419,7 +419,7 @@ public class TermVectorComponent extends SearchComponent implements SolrCoreAwar
result = new ArrayList<>(vals.length);
for (int i = 0; i < vals.length; i++) {
try {
result.add(new Integer(vals[i]));
result.add(Integer.valueOf(vals[i]));
} catch (NumberFormatException e) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e.getMessage(), e);
}

View File

@ -269,7 +269,7 @@ public abstract class TextResponseWriter implements PushWriter {
DocList ids = res.getDocList();
Iterator<SolrDocument> docsStreamer = res.getProcessedDocuments();
writeStartDocumentList(name, ids.offset(), ids.size(), ids.matches(),
res.wantsScores() ? new Float(ids.maxScore()) : null);
res.wantsScores() ? ids.maxScore() : null);
int idx = 0;
while (docsStreamer.hasNext()) {

View File

@ -541,7 +541,7 @@ class FacetRangeProcessor extends FacetProcessor<FacetRange> {
}
@Override
public Float parseAndAddGap(Comparable value, String gap) {
return new Float(((Number)value).floatValue() + Float.parseFloat(gap));
return ((Number) value).floatValue() + Float.parseFloat(gap);
}
}
private static class DoubleCalc extends Calc {
@ -566,7 +566,7 @@ class FacetRangeProcessor extends FacetProcessor<FacetRange> {
}
@Override
public Double parseAndAddGap(Comparable value, String gap) {
return new Double(((Number)value).doubleValue() + Double.parseDouble(gap));
return ((Number) value).doubleValue() + Double.parseDouble(gap);
}
}
private static class IntCalc extends Calc {
@ -582,7 +582,7 @@ class FacetRangeProcessor extends FacetProcessor<FacetRange> {
}
@Override
public Integer parseAndAddGap(Comparable value, String gap) {
return new Integer(((Number)value).intValue() + Integer.parseInt(gap));
return ((Number) value).intValue() + Integer.parseInt(gap);
}
}
private static class LongCalc extends Calc {
@ -594,7 +594,7 @@ class FacetRangeProcessor extends FacetProcessor<FacetRange> {
}
@Override
public Long parseAndAddGap(Comparable value, String gap) {
return new Long(((Number)value).longValue() + Long.parseLong(gap));
return ((Number) value).longValue() + Long.parseLong(gap);
}
}
private static class DateCalc extends Calc {

View File

@ -60,7 +60,7 @@ public class RequestContinuesRecorderAuthenticationHandler implements Authentica
HttpServletResponse response)
throws IOException, AuthenticationException {
boolean result = authHandler.managementOperation(token, request, response);
request.setAttribute(RequestContinuesRecorderAuthenticationHandler.REQUEST_CONTINUES_ATTR, new Boolean(result).toString());
request.setAttribute(RequestContinuesRecorderAuthenticationHandler.REQUEST_CONTINUES_ATTR, Boolean.toString(result));
return result;
}

View File

@ -3332,7 +3332,7 @@ public class SolrCLI {
int attempts = 3;
while (value != null && --attempts > 0) {
try {
inputAsInt = new Integer(value);
inputAsInt = Integer.valueOf(value);
if (min != null) {
if (inputAsInt < min) {
@ -4342,8 +4342,8 @@ public class SolrCLI {
out("Rotating solr logs, keeping a max of "+generations+" generations");
try (Stream<Path> files = Files.find(logsPath, 1,
(f, a) -> a.isRegularFile() && String.valueOf(f.getFileName()).startsWith("solr.log."))
.sorted((b,a) -> new Integer(a.getFileName().toString().substring(9))
.compareTo(new Integer(b.getFileName().toString().substring(9))))) {
.sorted((b,a) -> Integer.valueOf(a.getFileName().toString().substring(9))
.compareTo(Integer.valueOf(b.getFileName().toString().substring(9))))) {
files.forEach(p -> {
try {
int number = Integer.parseInt(p.getFileName().toString().substring(9));

View File

@ -289,9 +289,9 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
"facet.range.end",900,
"facet.range.other","all");
assertEquals(tlong, response.getFacetRanges().get(0).getName());
assertEquals(new Integer(6), response.getFacetRanges().get(0).getBefore());
assertEquals(new Integer(5), response.getFacetRanges().get(0).getBetween());
assertEquals(new Integer(2), response.getFacetRanges().get(0).getAfter());
assertEquals(6, response.getFacetRanges().get(0).getBefore());
assertEquals(5, response.getFacetRanges().get(0).getBetween());
assertEquals(2, response.getFacetRanges().get(0).getAfter());
// Test mincounts. Do NOT want to go through all the stuff where with validateControlData in query() method
// Purposely packing a _bunch_ of stuff together here to insure that the proper level of mincount is used for
@ -448,7 +448,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
// long
FieldStatsInfo s = rsp.getFieldStatsInfo().get(tlong);
assertNotNull("missing stats", s);
assertEquals("wrong cardinality", new Long(13), s.getCardinality());
assertEquals("wrong cardinality", Long.valueOf(13), s.getCardinality());
//
assertNull("expected null for min", s.getMin());
assertNull("expected null for mean", s.getMean());
@ -464,7 +464,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
// string
s = rsp.getFieldStatsInfo().get(oddField);
assertNotNull("missing stats", s);
assertEquals("wrong cardinality", new Long(1), s.getCardinality());
assertEquals("wrong cardinality", Long.valueOf(1), s.getCardinality());
//
assertNull("expected null for min", s.getMin());
assertNull("expected null for mean", s.getMean());
@ -727,7 +727,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
assertNotNull(p+" no stats for " + i1, s);
//
assertEquals(p+" wrong min", -987.0D, (Double)s.getMin(), 0.0001D );
assertEquals(p+" wrong calcDistinct", new Long(13), s.getCountDistinct());
assertEquals(p+" wrong calcDistinct", Long.valueOf(13), s.getCountDistinct());
assertNotNull(p+" expected non-null list for distinct vals", s.getDistinctValues());
assertEquals(p+" expected list for distinct vals", 13, s.getDistinctValues().size());
//

View File

@ -708,7 +708,7 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
protected void assertDocNotExists(HttpSolrClient solr, String coll, String docId) throws Exception {
NamedList rsp = realTimeGetDocId(solr, docId);
String match = JSONTestUtil.matchObj("/id", rsp.get("doc"), new Integer(docId));
String match = JSONTestUtil.matchObj("/id", rsp.get("doc"), Integer.valueOf(docId));
assertTrue("Doc with id=" + docId + " is found in " + solr.getBaseURL()
+ " due to: " + match + "; rsp="+rsp, match != null);
}

View File

@ -61,7 +61,7 @@ class SegmentTerminateEarlyTestState {
for (int cc = 1; cc <= numCommits; ++cc) {
for (int nn = 1; nn <= numDocsPerCommit; ++nn) {
++numDocs;
final Integer docKey = new Integer(numDocs);
final Integer docKey = numDocs;
SolrInputDocument doc = new SolrInputDocument();
doc.setField(KEY_FIELD, ""+docKey);
final int MM = rand.nextInt(60); // minutes
@ -69,17 +69,17 @@ class SegmentTerminateEarlyTestState {
if (minTimestampMM != null && MM < minTimestampMM.intValue()) {
minTimestampDocKeys.clear();
}
minTimestampMM = new Integer(MM);
minTimestampMM = MM;
minTimestampDocKeys.add(docKey);
}
if (maxTimestampMM == null || maxTimestampMM.intValue() <= MM) {
if (maxTimestampMM != null && maxTimestampMM.intValue() < MM) {
maxTimestampDocKeys.clear();
}
maxTimestampMM = new Integer(MM);
maxTimestampMM = MM;
maxTimestampDocKeys.add(docKey);
}
doc.setField(TIMESTAMP_FIELD, (Integer)MM);
doc.setField(TIMESTAMP_FIELD, MM);
doc.setField(ODD_FIELD, ""+(numDocs % 2));
doc.setField(QUAD_FIELD, ""+(numDocs % 4)+1);
cloudSolrClient.add(doc);
@ -94,7 +94,7 @@ class SegmentTerminateEarlyTestState {
void queryTimestampDescending(CloudSolrClient cloudSolrClient) throws Exception {
TestSegmentSorting.assertFalse(maxTimestampDocKeys.isEmpty());
TestSegmentSorting.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(maxTimestampDocKeys.iterator().next().intValue()%2);
final Long oddFieldValue = (long) (maxTimestampDocKeys.iterator().next().intValue() % 2);
final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
@ -120,13 +120,13 @@ class SegmentTerminateEarlyTestState {
void queryTimestampDescendingSegmentTerminateEarlyYes(CloudSolrClient cloudSolrClient) throws Exception {
TestSegmentSorting.assertFalse(maxTimestampDocKeys.isEmpty());
TestSegmentSorting.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(maxTimestampDocKeys.iterator().next().intValue()%2);
final Long oddFieldValue = (long) (maxTimestampDocKeys.iterator().next().intValue() % 2);
final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
final int rowsWanted = 1;
query.setRows(rowsWanted);
final Boolean shardsInfoWanted = (rand.nextBoolean() ? null : new Boolean(rand.nextBoolean()));
final Boolean shardsInfoWanted = (rand.nextBoolean() ? null : rand.nextBoolean());
if (shardsInfoWanted != null) {
query.set(ShardParams.SHARDS_INFO, shardsInfoWanted.booleanValue());
}
@ -170,12 +170,12 @@ class SegmentTerminateEarlyTestState {
void queryTimestampDescendingSegmentTerminateEarlyNo(CloudSolrClient cloudSolrClient) throws Exception {
TestSegmentSorting.assertFalse(maxTimestampDocKeys.isEmpty());
TestSegmentSorting.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(maxTimestampDocKeys.iterator().next().intValue()%2);
final Long oddFieldValue = (long) (maxTimestampDocKeys.iterator().next().intValue() % 2);
final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
query.setRows(1);
final Boolean shardsInfoWanted = (rand.nextBoolean() ? null : new Boolean(rand.nextBoolean()));
final Boolean shardsInfoWanted = (rand.nextBoolean() ? null : rand.nextBoolean());
if (shardsInfoWanted != null) {
query.set(ShardParams.SHARDS_INFO, shardsInfoWanted.booleanValue());
}
@ -217,7 +217,7 @@ class SegmentTerminateEarlyTestState {
void queryTimestampDescendingSegmentTerminateEarlyYesGrouped(CloudSolrClient cloudSolrClient) throws Exception {
TestSegmentSorting.assertFalse(maxTimestampDocKeys.isEmpty());
TestSegmentSorting.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(maxTimestampDocKeys.iterator().next().intValue()%2);
final Long oddFieldValue = (long) (maxTimestampDocKeys.iterator().next().intValue() % 2);
final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
@ -247,7 +247,7 @@ class SegmentTerminateEarlyTestState {
void queryTimestampAscendingSegmentTerminateEarlyYes(CloudSolrClient cloudSolrClient) throws Exception {
TestSegmentSorting.assertFalse(minTimestampDocKeys.isEmpty());
TestSegmentSorting.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(minTimestampDocKeys.iterator().next().intValue()%2);
final Long oddFieldValue = (long) (minTimestampDocKeys.iterator().next().intValue() % 2);
final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.asc); // a sort order that is _not_ compatible with the merge sort order
query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);

View File

@ -206,10 +206,10 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {
Map<String, Object> configJson = SolrCLI.getJson(configUrl);
Object maxTimeFromConfig = SolrCLI.atPath("/config/updateHandler/autoSoftCommit/maxTime", configJson);
assertNotNull(maxTimeFromConfig);
assertEquals(new Long(-1L), maxTimeFromConfig);
assertEquals(-1L, maxTimeFromConfig);
String prop = "updateHandler.autoSoftCommit.maxTime";
Long maxTime = new Long(3000L);
Long maxTime = 3000L;
String[] args = new String[]{
"-collection", testCollectionName,
"-property", prop,

View File

@ -752,25 +752,25 @@ public class TestCloudPivotFacet extends AbstractFullDistribZkTestBase {
private void sanityCheckAssertNumerics() {
assertNumerics("Null?", null, null);
assertNumerics("large a",
new Double(2.3005390038169265E9),
new Double(2.300539003816927E9));
assertNumerics("large a",
2.3005390038169265E9,
2.300539003816927E9);
assertNumerics("large b",
new Double(1.2722582464444444E9),
new Double(1.2722582464444442E9));
assertNumerics("small",
new Double(2.3005390038169265E-9),
new Double(2.300539003816927E-9));
1.2722582464444444E9,
1.2722582464444442E9);
assertNumerics("small",
2.3005390038169265E-9,
2.300539003816927E-9);
assertNumerics("large a negative",
new Double(-2.3005390038169265E9),
new Double(-2.300539003816927E9));
assertNumerics("large a negative",
-2.3005390038169265E9,
-2.300539003816927E9);
assertNumerics("large b negative",
new Double(-1.2722582464444444E9),
new Double(-1.2722582464444442E9));
assertNumerics("small negative",
new Double(-2.3005390038169265E-9),
new Double(-2.300539003816927E-9));
-1.2722582464444444E9,
-1.2722582464444442E9);
assertNumerics("small negative",
-2.3005390038169265E-9,
-2.300539003816927E-9);
assertNumerics("high long", Long.MAX_VALUE, Long.MAX_VALUE);
assertNumerics("high int", Integer.MAX_VALUE, Integer.MAX_VALUE);
@ -803,15 +803,15 @@ public class TestCloudPivotFacet extends AbstractFullDistribZkTestBase {
} catch (AssertionError e) {}
try {
assertNumerics("diff",
new Double(2.3005390038169265E9),
new Double(2.267272520100462E9));
assertNumerics("diff",
2.3005390038169265E9,
2.267272520100462E9);
throw new RuntimeException("did not get assertion failure when args are big & too diff");
} catch (AssertionError e) {}
try {
assertNumerics("diff",
new Double(2.3005390038169265E-9),
new Double(2.267272520100462E-9));
assertNumerics("diff",
2.3005390038169265E-9,
2.267272520100462E-9);
throw new RuntimeException("did not get assertion failure when args are small & too diff");
} catch (AssertionError e) {}

View File

@ -105,7 +105,7 @@ public class TestSolrCloudWithKerberosAlt extends SolrCloudTestCase {
System.setProperty("authenticationPlugin", "org.apache.solr.security.KerberosPlugin");
boolean enableDt = random().nextBoolean();
log.info("Enable delegation token: " + enableDt);
System.setProperty("solr.kerberos.delegation.token.enabled", new Boolean(enableDt).toString());
System.setProperty("solr.kerberos.delegation.token.enabled", Boolean.toString(enableDt));
// Extracts 127.0.0.1 from HTTP/127.0.0.1@EXAMPLE.COM
System.setProperty("solr.kerberos.name.rules", "RULE:[1:$1@$0](.*EXAMPLE.COM)s/@.*//"
+ "\nRULE:[2:$2@$0](.*EXAMPLE.COM)s/@.*//"

View File

@ -78,7 +78,7 @@ public class ResourceLoaderTest extends SolrTestCaseJ4 {
// Make sure it throws an error for invalid objects
Object[] invalid = new Object[] {
// new NGramTokenFilter( null ),
"hello", new Float( 12.3f ),
"hello", 12.3f,
new LukeRequestHandler(),
new JSONResponseWriter()
};
@ -100,7 +100,7 @@ public class ResourceLoaderTest extends SolrTestCaseJ4 {
// Make sure it throws an error for invalid objects
invalid = new Object[] {
new NGramFilterFactory(new HashMap<>()),
"hello", new Float( 12.3f ),
"hello", 12.3f,
new KeywordTokenizerFactory(new HashMap<>())
};
for( Object obj : invalid ) {

View File

@ -34,9 +34,9 @@ public abstract class AnalysisRequestHandlerTestBase extends SolrTestCaseJ4 {
assertEquals(info.getRawText(), token.get("raw_text"));
}
assertEquals(info.getType(), token.get("type"));
assertEquals(new Integer(info.getStart()), token.get("start"));
assertEquals(new Integer(info.getEnd()), token.get("end"));
assertEquals(new Integer(info.getPosition()), token.get("position"));
assertEquals(info.getStart(), token.get("start"));
assertEquals(info.getEnd(), token.get("end"));
assertEquals(info.getPosition(), token.get("position"));
assertArrayEquals(info.getPositionHistory(), ArrayUtils.toPrimitive((Integer[]) token.get("positionHistory")));
if (info.isMatch()) {
assertEquals(Boolean.TRUE, token.get("match"));

View File

@ -19,6 +19,7 @@ package org.apache.solr.handler.component;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.lucene.util.TestUtil;
import org.apache.solr.common.util.SuppressForbidden;
import java.util.List;
import java.util.Arrays;
@ -86,6 +87,7 @@ public class TestPivotHelperCode extends SolrTestCaseJ4{
}
@SuppressForbidden(reason = "Checking object equality for Long instance")
public void testCompareWithNullLast() throws Exception {
Long a = random().nextLong();
Long b = random().nextLong();

View File

@ -56,8 +56,8 @@ public class TestLegacyTerms extends LuceneTestCase {
IndexReader r = w.getReader();
Terms terms = MultiFields.getTerms(r, "field");
assertEquals(new Integer(minValue), LegacyNumericUtils.getMinInt(terms));
assertEquals(new Integer(maxValue), LegacyNumericUtils.getMaxInt(terms));
assertEquals(Integer.valueOf(minValue), LegacyNumericUtils.getMinInt(terms));
assertEquals(Integer.valueOf(maxValue), LegacyNumericUtils.getMaxInt(terms));
r.close();
w.close();
@ -87,8 +87,8 @@ public class TestLegacyTerms extends LuceneTestCase {
IndexReader r = w.getReader();
Terms terms = MultiFields.getTerms(r, "field");
assertEquals(new Long(minValue), LegacyNumericUtils.getMinLong(terms));
assertEquals(new Long(maxValue), LegacyNumericUtils.getMaxLong(terms));
assertEquals(Long.valueOf(minValue), LegacyNumericUtils.getMinLong(terms));
assertEquals(Long.valueOf(maxValue), LegacyNumericUtils.getMaxLong(terms));
r.close();
w.close();

View File

@ -1530,9 +1530,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
final String meta = pre + "/../";
String start = "0.0";
String gap = (new Double( (double)Float.MAX_VALUE )).toString();
String end = (new Double( ((double)Float.MAX_VALUE) * 3D )).toString();
String mid = (new Double( ((double)Float.MAX_VALUE) * 2D )).toString();
String gap = Double.toString(Float.MAX_VALUE );
String end = Double.toString(((double) Float.MAX_VALUE) * 3D);
String mid = Double.toString(((double) Float.MAX_VALUE) * 2D);
assertQ(f+": checking counts for lower",
req( "q", "id_i1:[30 TO 60]"
@ -1807,9 +1807,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
final String meta = pre + "/../";
String start = "0";
String gap = (new Long( (long)Integer.MAX_VALUE )).toString();
String end = (new Long( ((long)Integer.MAX_VALUE) * 3L )).toString();
String mid = (new Long( ((long)Integer.MAX_VALUE) * 2L )).toString();
String gap = Long.toString(Integer.MAX_VALUE );
String end = Long.toString( ((long)Integer.MAX_VALUE) * 3L );
String mid = Long.toString(((long)Integer.MAX_VALUE) * 2L );
assertQ(f+": checking counts for lower",
req( "q", "id_i1:[30 TO 60]"

View File

@ -396,7 +396,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
assertTrue(!usedcollations.contains(multipleCollation));
usedcollations.add(multipleCollation);
assertEquals(new Long(1L), expandedCollation.get("hits"));
assertEquals(1L, expandedCollation.get("hits"));
NamedList misspellingsAndCorrections = (NamedList) expandedCollation.get("misspellingsAndCorrections");
assertTrue(misspellingsAndCorrections.size() == 3);

View File

@ -146,8 +146,8 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {
doc = new SolrInputDocument();
doc.setField("id", "1001");
List<Long> removeList = new ArrayList<Long>();
removeList.add(new Long(222));
removeList.add(new Long(333));
removeList.add(222L);
removeList.add(333L);
doc.setField("intRemove", ImmutableMap.of("remove", removeList)); //behavior when hitting Solr through ZK
assertU(adoc(doc));
assertU(commit());
@ -158,8 +158,8 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {
doc = new SolrInputDocument();
doc.setField("id", "1021");
removeList = new ArrayList<Long>();
removeList.add(new Long(222));
removeList.add(new Long(333));
removeList.add(222L);
removeList.add(333L);
doc.setField("intRemove", ImmutableMap.of("remove", removeList)); //behavior when hitting Solr through ZK
assertU(adoc(doc));
assertU(commit());
@ -214,8 +214,8 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {
doc = new SolrInputDocument();
doc.setField("id", "1001");
List<Long> removeList = new ArrayList<Long>();
removeList.add(new Long(222));
removeList.add(new Long(333));
removeList.add(222L);
removeList.add(333L);
doc.setField("intRemove", ImmutableMap.of("remove", removeList)); //behavior when hitting Solr through ZK
assertU(adoc(doc));
assertU(commit());
@ -226,8 +226,8 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {
doc = new SolrInputDocument();
doc.setField("id", "1021");
removeList = new ArrayList<Long>();
removeList.add(new Long(222));
removeList.add(new Long(333));
removeList.add(222L);
removeList.add(333L);
doc.setField("intRemove", ImmutableMap.of("remove", removeList)); //behavior when hitting Solr through ZK
assertU(adoc(doc));
assertU(commit());

View File

@ -49,10 +49,10 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
"XXXX", "Adam", "Sam"),
f("all_authors_s1",
"XXXX", "Adam", "Sam"),
f("foo_is", countMe, new Integer(42)),
f("first_foo_l", countMe, new Integer(-34)),
f("max_foo_l", countMe, new Integer(-34)),
f("min_foo_l", countMe, new Integer(-34))));
f("foo_is", countMe, 42),
f("first_foo_l", countMe, -34),
f("max_foo_l", countMe, -34),
f("min_foo_l", countMe, -34)));
assertU(commit());
@ -74,7 +74,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
doc(f("id", "1111"),
f("name", " Hoss ", new StringBuilder(" Man")),
f("foo_t", " some text ", "other Text\t"),
f("foo_d", new Integer(42)),
f("foo_d", 42),
field("foo_s", " string ")));
assertNotNull(d);
@ -88,7 +88,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
// slightly more interesting
assertEquals("processor borked non string value",
new Integer(42), d.getFieldValue("foo_d"));
42, d.getFieldValue("foo_d"));
}
public void testUniqValues() throws Exception {
@ -281,7 +281,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
f("foo_s", "string1", ""),
f("bar_dt", "string2", "", "string3"),
f("yak_t", ""),
f("foo_d", new Integer(42))));
f("foo_d", 42)));
assertNotNull(d);
@ -292,7 +292,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
assertFalse("shouldn't be any values for yak_t",
d.containsKey("yak_t"));
assertEquals("processor borked non string value",
new Integer(42), d.getFieldValue("foo_d"));
42, d.getFieldValue("foo_d"));
}
@ -303,7 +303,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
f("foo_s", "string1", "string222"),
f("bar_dt", "string3"),
f("yak_t", ""),
f("foo_d", new Integer(42))));
f("foo_d", 42)));
assertNotNull(d);
@ -312,23 +312,23 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
assertEquals("string3", d.getFieldValue("bar_dt"));
assertEquals("", d.getFieldValue("yak_t"));
assertEquals("processor borked non string value",
new Integer(42), d.getFieldValue("foo_d"));
42, d.getFieldValue("foo_d"));
d = processAdd("length-some",
doc(f("id", "1111"),
f("foo_s", "string1", "string222"),
f("bar_dt", "string3"),
f("yak_t", ""),
f("foo_d", new Integer(42))));
f("foo_d", 42)));
assertNotNull(d);
assertEquals(Arrays.asList(new Integer(7), new Integer(9)),
assertEquals(Arrays.asList(7, 9),
d.getFieldValues("foo_s"));
assertEquals("string3", d.getFieldValue("bar_dt"));
assertEquals(new Integer(0), d.getFieldValue("yak_t"));
assertEquals(0, d.getFieldValue("yak_t"));
assertEquals("processor borked non string value",
new Integer(42), d.getFieldValue("foo_d"));
42, d.getFieldValue("foo_d"));
}
public void testRegexReplace() throws Exception {
@ -515,7 +515,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
ignoreException(".*Unable to mutate field.*");
d = processAdd("min-value",
doc(f("id", "1111"),
f("foo_s", "zzz", new Integer(42), "bbb"),
f("foo_s", "zzz", 42, "bbb"),
f("bar_s", "aaa"),
f("yak_t", "aaa", "bbb")));
} catch (SolrException e) {
@ -556,7 +556,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
ignoreException(".*Unable to mutate field.*");
d = processAdd("min-value",
doc(f("id", "1111"),
f("foo_s", "zzz", new Integer(42), "bbb"),
f("foo_s", "zzz", 42, "bbb"),
f("bar_s", "aaa"),
f("yak_t", "aaa", "bbb")));
} catch (SolrException e) {
@ -786,7 +786,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
f("foo_s1", "string3", "string4"),
f("bar_dt", "string5", "string6"),
f("bar_HOSS_s", "string7", "string8"),
f("foo_d", new Integer(42))));
f("foo_d", 42)));
assertNotNull(d);
@ -799,7 +799,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
assertEquals(Arrays.asList("string7","string8"),
d.getFieldValues("bar_HOSS_s"));
assertEquals("processor borked non string value",
new Integer(42), d.getFieldValue("foo_d"));
42, d.getFieldValue("foo_d"));
}
@ -816,7 +816,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
d = processAdd(chain,
doc(f("id", "1111"),
f("foo_t", "string1", "string2"),
f("foo_d", new Integer(42)),
f("foo_d", 42),
field("foo_s", "string3", "string4")));
assertNotNull(d);
@ -827,7 +827,7 @@ public class FieldMutatingUpdateProcessorTest extends UpdateProcessorTestBase {
// slightly more interesting
assertEquals("processor borked non string value",
new Integer(42), d.getFieldValue("foo_d"));
42, d.getFieldValue("foo_d"));
}
}

View File

@ -47,7 +47,7 @@ public class IgnoreCommitOptimizeUpdateProcessorFactoryTest extends SolrTestCase
rsp = processCommit("ignore-optimize-only-from-client-403", true);
assertNotNull("Sending an optimize should have resulted in an exception in the response", rsp.getException());
// commit should happen if DistributedUpdateProcessor.COMMIT_END_POINT == true
rsp = processCommit("ignore-commit-from-client-403", false, new Boolean(true));
rsp = processCommit("ignore-commit-from-client-403", false, Boolean.TRUE);
shouldBeNull = rsp.getException();
assertNull("Sending a commit should NOT have resulted in an exception in the response: "+shouldBeNull, shouldBeNull);
}

View File

@ -300,7 +300,7 @@ public class SignatureUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
UnusualList<Integer> ints = new UnusualList<>(3);
for (int val : new int[] {42, 66, 34}) {
docA.addField("ints_is", new Integer(val));
docA.addField("ints_is", val);
ints.add(val);
}
docB.addField("ints_is", ints);
@ -318,7 +318,7 @@ public class SignatureUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
doc.addField("v_t", "same");
doc.addField("weight", 3.0f);
for (int val : new int[] {66, 42, 34}) {
doc.addField("ints_is", new Integer(val));
doc.addField("ints_is", val);
}
ureq.add(doc);
}

View File

@ -133,8 +133,8 @@ public class StatelessScriptUpdateProcessorFactoryTest extends UpdateProcessorTe
assertEquals(chain + " didn't add Double field",
42.3d, d.getFieldValue("script_added_d"));
assertEquals(chain + " didn't add integer field",
new Integer(42), d.getFieldValue("script_added_i"));
assertEquals(chain + " didn't add integer field",
42, d.getFieldValue("script_added_i"));
processCommit("run-no-scripts");
@ -211,8 +211,8 @@ public class StatelessScriptUpdateProcessorFactoryTest extends UpdateProcessorTe
"i went for it", d.getFieldValue("script_added_s"));
assertEquals(chain +" didn't add Double field",
42.3d, d.getFieldValue("script_added_d"));
assertEquals(chain + " didn't add integer field",
new Integer(42), d.getFieldValue("script_added_i"));
assertEquals(chain + " didn't add integer field",
42, d.getFieldValue("script_added_i"));
}
}
@ -227,8 +227,8 @@ public class StatelessScriptUpdateProcessorFactoryTest extends UpdateProcessorTe
assertEquals(chain +" didn't add Double field",
42.3d, d.getFieldValue("script_added_d"));
assertEquals(chain + " didn't add integer field",
new Integer(42), d.getFieldValue("script_added_i"));
assertEquals(chain + " didn't add integer field",
42, d.getFieldValue("script_added_i"));
}
public void testPropogatedException() throws Exception {

View File

@ -31,18 +31,18 @@ public class CircularListTest extends LuceneTestCase {
public void testCircularList() throws IOException {
CircularList<Integer> list = new CircularList<>(10);
for(int i=0;i<10; i++) {
list.add(new Integer(i));
list.add(i);
}
assertEquals("within list", new Integer(0), list.get(0));
assertEquals("within list", Integer.valueOf(0), list.get(0));
for(int i=10;i<20; i++) {
list.add(new Integer(i));
assertEquals("within list", new Integer(i-9), list.get(0));
list.add(i);
assertEquals("within list", Integer.valueOf(i - 9), list.get(0));
}
// now try the resize
list.resize(5);
assertEquals(new Integer(15), list.get(0));
assertEquals(Integer.valueOf(15), list.get(0));
list.resize(10);
assertEquals(new Integer(15), list.get(0));
assertEquals(Integer.valueOf(15), list.get(0));
}
}

View File

@ -415,7 +415,7 @@ public class SolrPluginUtilsTest extends SolrTestCaseJ4 {
@Test
public void testInvokeSetters() {
final Float theFloat = new Float(random().nextFloat());
final Float theFloat = random().nextFloat();
implTestInvokeSetters(theFloat, theFloat);
implTestInvokeSetters(theFloat, theFloat.toString());
}

View File

@ -119,7 +119,7 @@ public class TestUtils extends SolrTestCaseJ4 {
map.add( "test", 10 );
SimpleOrderedMap<Integer> clone = map.clone();
assertEquals( map.toString(), clone.toString() );
assertEquals( new Integer(10), clone.get( "test" ) );
assertEquals(Integer.valueOf(10), clone.get( "test" ) );
Map<String,Integer> realMap = new HashMap<>();
realMap.put( "one", 1 );
@ -138,7 +138,7 @@ public class TestUtils extends SolrTestCaseJ4 {
assertEquals( "one", map.getName(0) );
map.setName( 0, "ONE" );
assertEquals( "ONE", map.getName(0) );
assertEquals( new Integer(100), map.get( "one", 1 ) );
assertEquals(Integer.valueOf(100), map.get( "one", 1 ) );
assertEquals( 4, map.indexOf( null, 1 ) );
assertEquals( null, map.get( null, 1 ) );
@ -156,8 +156,8 @@ public class TestUtils extends SolrTestCaseJ4 {
} catch( UnsupportedOperationException ignored) {}
}
// the values should be bigger
assertEquals( new Integer(10), map.get( "one" ) );
assertEquals( new Integer(20), map.get( "two" ) );
assertEquals(Integer.valueOf(10), map.get( "one" ) );
assertEquals(Integer.valueOf(20), map.get( "two" ) );
}
public void testNumberUtils()

View File

@ -53,6 +53,6 @@ public class ConvolutionEvaluator extends RecursiveNumericEvaluator implements T
((List)first).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray(),
((List)second).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray()
)
).mapToObj(Double::new).collect(Collectors.toList());
).boxed().collect(Collectors.toList());
}
}

View File

@ -44,7 +44,7 @@ public class NormalizeEvaluator extends RecursiveObjectEvaluator implements OneV
return null;
}
else if(value instanceof List){
return Arrays.stream(StatUtils.normalize(((List<?>)value).stream().mapToDouble(innerValue -> ((Number)innerValue).doubleValue()).toArray())).mapToObj(Double::new).collect(Collectors.toList());
return Arrays.stream(StatUtils.normalize(((List<?>)value).stream().mapToDouble(innerValue -> ((Number)innerValue).doubleValue()).toArray())).boxed().collect(Collectors.toList());
} else if (value instanceof Matrix) {
Matrix matrix = (Matrix) value;
double[][] data = matrix.getData();

View File

@ -44,7 +44,7 @@ public class RankEvaluator extends RecursiveNumericEvaluator implements OneValue
}
else if(value instanceof List){
NaturalRanking rank = new NaturalRanking();
return Arrays.stream(rank.rank(((List<?>)value).stream().mapToDouble(innerValue -> ((Number)innerValue).doubleValue()).toArray())).mapToObj(Double::new).collect(Collectors.toList());
return Arrays.stream(rank.rank(((List<?>)value).stream().mapToDouble(innerValue -> ((Number)innerValue).doubleValue()).toArray())).boxed().collect(Collectors.toList());
}
else{
return doWork(Arrays.asList((Number)value));

View File

@ -57,6 +57,6 @@ public class ScaleEvaluator extends RecursiveNumericEvaluator implements TwoValu
scaleOver = ((List<?>)second).stream().mapToDouble(value -> ((Number)value).doubleValue()).toArray();
}
return Arrays.stream(MathArrays.scale(((Number)first).doubleValue(), scaleOver)).mapToObj(Double::new).collect(Collectors.toList());
return Arrays.stream(MathArrays.scale(((Number)first).doubleValue(), scaleOver)).boxed().collect(Collectors.toList());
}
}

View File

@ -87,7 +87,7 @@ public abstract class ContentStreamBase implements ContentStream
contentType = conn.getContentType();
name = url.toExternalForm();
size = new Long( conn.getContentLength() );
size = (long) conn.getContentLength();
return conn.getInputStream();
}
}
@ -155,7 +155,7 @@ public abstract class ContentStreamBase implements ContentStream
this.contentType = contentType;
name = null;
try {
size = new Long( str.getBytes(DEFAULT_CHARSET).length );
size = (long) str.getBytes(DEFAULT_CHARSET).length;
} catch (UnsupportedEncodingException e) {
// won't happen
throw new RuntimeException(e);
@ -277,7 +277,7 @@ public abstract class ContentStreamBase implements ContentStream
this.contentType = contentType;
name = source;
size = new Long(bytes.length);
size = (long) bytes.length;
sourceInfo = source;
}

View File

@ -743,8 +743,8 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
assertEquals( 23.0, ((Double)stats.getMin()).doubleValue(), 0 );
assertEquals(94.0, ((Double) stats.getMax()).doubleValue(), 0);
assertEquals( new Long(nums.length), stats.getCount() );
assertEquals( new Long(0), stats.getMissing() );
assertEquals(Long.valueOf(nums.length), stats.getCount() );
assertEquals(Long.valueOf(0), stats.getMissing() );
assertEquals( "26.4", stats.getStddev().toString().substring(0, 4) );
// now lets try again with a new set... (odd median)
@ -769,8 +769,8 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
assertEquals(5.0, ((Double) stats.getMin()).doubleValue(), 0);
assertEquals( 20.0, ((Double)stats.getMax()).doubleValue(), 0 );
assertEquals(new Long(nums.length), stats.getCount());
assertEquals( new Long(0), stats.getMissing() );
assertEquals(Long.valueOf(nums.length), stats.getCount());
assertEquals(Long.valueOf(0), stats.getMissing() );
// Now try again with faceting
//---------------------------------

View File

@ -249,7 +249,7 @@ abstract public class SolrExampleTestsBase extends SolrJettyTestBase {
// Make sure the transformer works for streaming
Float score = (Float) doc.get("score");
assertEquals("should have score", new Float(1.0), score);
assertEquals("should have score", Float.valueOf(1.0f), score);
}
});

View File

@ -646,23 +646,23 @@ public class GraphExpressionTest extends SolrCloudTestCase {
Collections.sort(tuples, new FieldComparator("node", ComparatorOrder.ASCENDING));
assertTrue(tuples.size() == 4);
assertTrue(tuples.get(0).getString("node").equals("bill"));
assertTrue(tuples.get(0).getLong("level").equals(new Long(0)));
assertTrue(tuples.get(0).getLong("level").equals(0L));
assertTrue(tuples.get(0).getStrings("ancestors").size() == 0);
assertTrue(tuples.get(1).getString("node").equals("jim"));
assertTrue(tuples.get(1).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(1).getLong("level").equals(1L));
List<String> ancestors = tuples.get(1).getStrings("ancestors");
System.out.println("##################### Ancestors:"+ancestors);
assert(ancestors.size() == 1);
assert(ancestors.get(0).equals("bill"));
assertTrue(tuples.get(2).getString("node").equals("max"));
assertTrue(tuples.get(2).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(2).getLong("level").equals(1L));
ancestors = tuples.get(2).getStrings("ancestors");
assert(ancestors.size() == 1);
assert(ancestors.get(0).equals("bill"));
assertTrue(tuples.get(3).getString("node").equals("sam"));
assertTrue(tuples.get(3).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(3).getLong("level").equals(1L));
ancestors = tuples.get(3).getStrings("ancestors");
assert(ancestors.size() == 1);
assert(ancestors.get(0).equals("bill"));
@ -705,13 +705,13 @@ public class GraphExpressionTest extends SolrCloudTestCase {
Collections.sort(tuples, new FieldComparator("node", ComparatorOrder.ASCENDING));
assertTrue(tuples.size() == 4);
assertTrue(tuples.get(0).getString("node").equals("bill"));
assertTrue(tuples.get(0).getLong("level").equals(new Long(0)));
assertTrue(tuples.get(0).getLong("level").equals(0L));
assertTrue(tuples.get(1).getString("node").equals("jim"));
assertTrue(tuples.get(1).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(1).getLong("level").equals(1L));
assertTrue(tuples.get(2).getString("node").equals("max"));
assertTrue(tuples.get(2).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(2).getLong("level").equals(1L));
assertTrue(tuples.get(3).getString("node").equals("sam"));
assertTrue(tuples.get(3).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(3).getLong("level").equals(1L));
expr = "gatherNodes(collection1, " +
"search(collection1, q=\"message_t:jim\", fl=\"from_s\", sort=\"from_s asc\"),"+
@ -777,19 +777,19 @@ public class GraphExpressionTest extends SolrCloudTestCase {
assertTrue(tuples.size() == 7);
assertTrue(tuples.get(0).getString("node").equals("ann"));
assertTrue(tuples.get(0).getLong("level").equals(new Long(2)));
assertTrue(tuples.get(0).getLong("level").equals(2L));
assertTrue(tuples.get(1).getString("node").equals("bill"));
assertTrue(tuples.get(1).getLong("level").equals(new Long(0)));
assertTrue(tuples.get(1).getLong("level").equals(0L));
assertTrue(tuples.get(2).getString("node").equals("jim"));
assertTrue(tuples.get(2).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(2).getLong("level").equals(1L));
assertTrue(tuples.get(3).getString("node").equals("kip"));
assertTrue(tuples.get(3).getLong("level").equals(new Long(2)));
assertTrue(tuples.get(3).getLong("level").equals(2L));
assertTrue(tuples.get(4).getString("node").equals("max"));
assertTrue(tuples.get(4).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(4).getLong("level").equals(1L));
assertTrue(tuples.get(5).getString("node").equals("sam"));
assertTrue(tuples.get(5).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(5).getLong("level").equals(1L));
assertTrue(tuples.get(6).getString("node").equals("steve"));
assertTrue(tuples.get(6).getLong("level").equals(new Long(2)));
assertTrue(tuples.get(6).getLong("level").equals(2L));
//Add a cycle from jim to bill
new UpdateRequest()
@ -817,10 +817,10 @@ public class GraphExpressionTest extends SolrCloudTestCase {
assertTrue(tuples.size() == 7);
assertTrue(tuples.get(0).getString("node").equals("ann"));
assertTrue(tuples.get(0).getLong("level").equals(new Long(2)));
assertTrue(tuples.get(0).getLong("level").equals(2L));
//Bill should now have one ancestor
assertTrue(tuples.get(1).getString("node").equals("bill"));
assertTrue(tuples.get(1).getLong("level").equals(new Long(0)));
assertTrue(tuples.get(1).getLong("level").equals(0L));
assertTrue(tuples.get(1).getStrings("ancestors").size() == 2);
List<String> anc = tuples.get(1).getStrings("ancestors");
@ -829,15 +829,15 @@ public class GraphExpressionTest extends SolrCloudTestCase {
assertTrue(anc.get(1).equals("sam"));
assertTrue(tuples.get(2).getString("node").equals("jim"));
assertTrue(tuples.get(2).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(2).getLong("level").equals(1L));
assertTrue(tuples.get(3).getString("node").equals("kip"));
assertTrue(tuples.get(3).getLong("level").equals(new Long(2)));
assertTrue(tuples.get(3).getLong("level").equals(2L));
assertTrue(tuples.get(4).getString("node").equals("max"));
assertTrue(tuples.get(4).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(4).getLong("level").equals(1L));
assertTrue(tuples.get(5).getString("node").equals("sam"));
assertTrue(tuples.get(5).getLong("level").equals(new Long(1)));
assertTrue(tuples.get(5).getLong("level").equals(1L));
assertTrue(tuples.get(6).getString("node").equals("steve"));
assertTrue(tuples.get(6).getLong("level").equals(new Long(2)));
assertTrue(tuples.get(6).getLong("level").equals(2L));
cache.close();

View File

@ -474,7 +474,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
UpdateRequest update = new UpdateRequest();
for(int idx = 0; idx < 1000; ++idx){
String idxString = new Integer(idx).toString();
String idxString = Integer.toString(idx);
update.add(id,idxString, "a_s", "hello" + idxString, "a_i", idxString, "a_f", idxString);
}
update.commit(cluster.getSolrClient(), COLLECTIONORALIAS);

View File

@ -57,10 +57,10 @@ public class NormalizeEvaluatorTest extends LuceneTestCase {
values.put("singleInt", singleInt);
Tuple tuple = new Tuple(values);
assertSimilar(StatUtils.normalize(Arrays.stream(ints).mapToDouble(Double::new).toArray()), factory.constructEvaluator("norm(ints)").evaluate(tuple));
assertSimilar(StatUtils.normalize(Arrays.stream(longs).mapToDouble(Double::new).toArray()), factory.constructEvaluator("norm(longs)").evaluate(tuple));
assertSimilar(StatUtils.normalize(Arrays.stream(ints).mapToDouble(Double::valueOf).toArray()), factory.constructEvaluator("norm(ints)").evaluate(tuple));
assertSimilar(StatUtils.normalize(Arrays.stream(longs).mapToDouble(Double::valueOf).toArray()), factory.constructEvaluator("norm(longs)").evaluate(tuple));
assertSimilar(StatUtils.normalize(doubles), factory.constructEvaluator("norm(doubles)").evaluate(tuple));
assertSimilar(StatUtils.normalize(Arrays.stream(singleInt).mapToDouble(Double::new).toArray()), factory.constructEvaluator("norm(singleInt)").evaluate(tuple));
assertSimilar(StatUtils.normalize(Arrays.stream(singleInt).mapToDouble(Double::valueOf).toArray()), factory.constructEvaluator("norm(singleInt)").evaluate(tuple));
}
private void assertSimilar(double[] expected, Object actual){

View File

@ -122,7 +122,7 @@ public class TestDelegationTokenResponse extends LuceneTestCase {
}
// valid
Long expirationTime = new Long(Long.MAX_VALUE);
Long expirationTime = Long.MAX_VALUE;
delegationTokenResponse(renewRequest, renewResponse,
getMapJson("long", expirationTime));
assertEquals(expirationTime, renewResponse.getExpirationTime());

View File

@ -33,7 +33,7 @@ public class SolrDocumentTest extends LuceneTestCase
{
public void testSimple()
{
Float fval = new Float( 10.01f );
Float fval = 10.01f;
Boolean bval = Boolean.TRUE;
String sval = "12qwaszx";
@ -184,9 +184,9 @@ public class SolrDocumentTest extends LuceneTestCase
public void testDuplicate()
{
Float fval0 = new Float( 10.01f );
Float fval1 = new Float( 11.01f );
Float fval2 = new Float( 12.01f );
Float fval0 = 10.01f;
Float fval1 = 11.01f;
Float fval2 = 12.01f;
// Set up a simple document
SolrInputDocument doc = new SolrInputDocument();

View File

@ -187,8 +187,8 @@ public class SolrParamTest extends LuceneTestCase {
final String pstr = "string";
final Boolean pbool = Boolean.TRUE;
final Integer pint = new Integer( 100 );
final Float pfloat = new Float( 10.6f );
final Integer pint = 100;
final Float pfloat = 10.6f;
// Make sure they parse ok
assertEquals( pstr , params.get( "str" ) );
@ -285,7 +285,7 @@ public class SolrParamTest extends LuceneTestCase {
assertEquals( pstr , defaults.get( "str" ) );
// in default, not in params
assertEquals( "default" , defaults.get( "dstr" ) );
assertEquals( new Integer(123) , defaults.getInt( "dint" ) );
assertEquals(Integer.valueOf(123), defaults.getInt( "dint" ) );
// in params, overriding defaults
assertEquals( pint , defaults.getInt( "int" ) );
// in neither params nor defaults

View File

@ -33,7 +33,7 @@ public class TestNamedListCodec extends LuceneTestCase {
public void testSimple() throws Exception{
NamedList nl = new NamedList();
Float fval = new Float( 10.01f );
Float fval = 10.01f;
Boolean bval = Boolean.TRUE;
String sval = "12qwaszx";
@ -95,7 +95,7 @@ public class TestNamedListCodec extends LuceneTestCase {
public void testIterator() throws Exception{
NamedList nl = new NamedList();
Float fval = new Float( 10.01f );
Float fval = 10.01f;
Boolean bval = Boolean.TRUE;
String sval = "12qwaszx";

View File

@ -37,7 +37,7 @@ public class TestValidatingJsonMap extends SolrTestCaseJ4 {
"c", makeMap("d", "D")));
assertEquals(Boolean.TRUE, m.getBool("a", Boolean.FALSE));
assertEquals(Boolean.FALSE, m.getBool("b", Boolean.TRUE));
assertEquals(new Integer(10), m.getInt("i",0));
assertEquals(Integer.valueOf(10), m.getInt("i",0));
try {
m.getList("l", ENUM_OF, ImmutableSet.of("X", "Z"));
fail("Must have failed with unexpected type");