LUCENE-3294: Some code still compares string equality instead using equals

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1144280 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-07-08 12:15:04 +00:00
parent 74cb0a71bc
commit 13f9f590ec
4 changed files with 5 additions and 6 deletions

View File

@ -124,7 +124,7 @@ public class InstantiatedIndexReader extends IndexReader {
private Map<String,List<NormUpdate>> uncommittedNormsByFieldNameAndDocumentNumber = null;
private class NormUpdate {
private static class NormUpdate {
private int doc;
private byte value;
@ -380,7 +380,7 @@ public class InstantiatedIndexReader extends IndexReader {
if (upto >= orderedTerms.length) {
return null;
}
} while(orderedTerms[upto].field() == currentField);
} while(orderedTerms[upto].field().equals(currentField));
currentField = orderedTerms[upto].field();
return currentField;
@ -410,7 +410,7 @@ public class InstantiatedIndexReader extends IndexReader {
// do it up front & cache
long sum = 0;
int upto = i;
while(upto < orderedTerms.length && orderedTerms[i].field() == field) {
while(upto < orderedTerms.length && orderedTerms[i].equals(field)) {
sum += orderedTerms[i].getTotalTermFreq();
upto++;
}

View File

@ -1194,7 +1194,7 @@ public class MemoryIndex {
public byte[] norms(String fieldName) {
byte[] norms = cachedNorms;
SimilarityProvider sim = getSimilarityProvider();
if (fieldName != cachedFieldName || sim != cachedSimilarity) { // not cached?
if (!fieldName.equals(cachedFieldName) || sim != cachedSimilarity) { // not cached?
Info info = getInfo(fieldName);
Similarity fieldSim = sim.get(fieldName);
int numTokens = info != null ? info.numTokens : 0;

View File

@ -46,7 +46,7 @@ public class CoreDescriptor {
if(coreContainer.getZkController() != null) {
this.cloudDesc = new CloudDescriptor();
// cloud collection defaults to core name
cloudDesc.setCollectionName(name == "" ? coreContainer.getDefaultCoreName() : name);
cloudDesc.setCollectionName(name.isEmpty() ? coreContainer.getDefaultCoreName() : name);
this.cloudDesc.setShardId(coreContainer.getZkController().getNodeName() + "_" + name);
}

View File

@ -170,7 +170,6 @@ public abstract class AnalysisRequestHandlerBase extends RequestHandlerBase {
// for backwards compatibility, add all "common" attributes
tokenStream.addAttribute(OffsetAttribute.class);
tokenStream.addAttribute(TypeAttribute.class);
final BytesRef bytes = new BytesRef();
try {
tokenStream.reset();
int position = 0;