Two spots I found in which we commonly instatiate a non-trivial number of zero length arrays.
This commit is contained in:
parent
df555bb470
commit
d22dd437f1
|
@ -87,11 +87,13 @@ public class ReplicationResponse extends ActionResponse {
|
||||||
total = in.readVInt();
|
total = in.readVInt();
|
||||||
successful = in.readVInt();
|
successful = in.readVInt();
|
||||||
int size = in.readVInt();
|
int size = in.readVInt();
|
||||||
|
if (size > 0) {
|
||||||
failures = new Failure[size];
|
failures = new Failure[size];
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
failures[i] = new Failure(in);
|
failures[i] = new Failure(in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ShardInfo(int total, int successful, Failure... failures) {
|
public ShardInfo(int total, int successful, Failure... failures) {
|
||||||
assert total >= 0 && successful >= 0;
|
assert total >= 0 && successful >= 0;
|
||||||
|
@ -223,9 +225,9 @@ public class ReplicationResponse extends ActionResponse {
|
||||||
private static final String STATUS = "status";
|
private static final String STATUS = "status";
|
||||||
private static final String PRIMARY = "primary";
|
private static final String PRIMARY = "primary";
|
||||||
|
|
||||||
private ShardId shardId;
|
private final ShardId shardId;
|
||||||
private String nodeId;
|
private final String nodeId;
|
||||||
private boolean primary;
|
private final boolean primary;
|
||||||
|
|
||||||
public Failure(StreamInput in) throws IOException {
|
public Failure(StreamInput in) throws IOException {
|
||||||
shardId = new ShardId(in);
|
shardId = new ShardId(in);
|
||||||
|
@ -244,9 +246,6 @@ public class ReplicationResponse extends ActionResponse {
|
||||||
this.primary = primary;
|
this.primary = primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
Failure() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShardId fullShardId() {
|
public ShardId fullShardId() {
|
||||||
return shardId;
|
return shardId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,10 +306,16 @@ public class Lucene {
|
||||||
TotalHits totalHits = readTotalHits(in);
|
TotalHits totalHits = readTotalHits(in);
|
||||||
float maxScore = in.readFloat();
|
float maxScore = in.readFloat();
|
||||||
|
|
||||||
ScoreDoc[] scoreDocs = new ScoreDoc[in.readVInt()];
|
final int scoreDocCount = in.readVInt();
|
||||||
|
final ScoreDoc[] scoreDocs;
|
||||||
|
if (scoreDocCount == 0) {
|
||||||
|
scoreDocs = EMPTY_SCORE_DOCS;
|
||||||
|
} else {
|
||||||
|
scoreDocs = new ScoreDoc[scoreDocCount];
|
||||||
for (int i = 0; i < scoreDocs.length; i++) {
|
for (int i = 0; i < scoreDocs.length; i++) {
|
||||||
scoreDocs[i] = new ScoreDoc(in.readVInt(), in.readFloat());
|
scoreDocs[i] = new ScoreDoc(in.readVInt(), in.readFloat());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return new TopDocsAndMaxScore(new TopDocs(totalHits, scoreDocs), maxScore);
|
return new TopDocsAndMaxScore(new TopDocs(totalHits, scoreDocs), maxScore);
|
||||||
} else if (type == 1) {
|
} else if (type == 1) {
|
||||||
TotalHits totalHits = readTotalHits(in);
|
TotalHits totalHits = readTotalHits(in);
|
||||||
|
|
Loading…
Reference in New Issue