Fix string comparisons
This commit is contained in:
parent
351e363047
commit
d594f8ac11
9 changed files with 16 additions and 12 deletions
|
@ -191,7 +191,7 @@ public class DumpTestController extends FreemarkerHttpServlet {
|
|||
}
|
||||
|
||||
public String getName(String which) {
|
||||
return which == "first" ? firstName : lastName;
|
||||
return "first".equals(which) ? firstName : lastName;
|
||||
}
|
||||
|
||||
public String getMiddleName() {
|
||||
|
|
|
@ -17,6 +17,7 @@ import javax.servlet.annotation.WebServlet;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -86,7 +87,7 @@ public class ViewLabelsServlet extends FreemarkerHttpServlet{
|
|||
for(Literal l: labels) {
|
||||
String languageTag = l.getLanguage();
|
||||
String languageName = "";
|
||||
if(languageTag == "") {
|
||||
if(StringUtils.isEmpty(languageTag)) {
|
||||
languageName = "untyped";
|
||||
}
|
||||
else if(localeCodeToNameMap.containsKey(languageTag)) {
|
||||
|
@ -95,7 +96,7 @@ public class ViewLabelsServlet extends FreemarkerHttpServlet{
|
|||
log.warn("This language tag " + languageTag + " does not have corresponding name in the system and was not processed");
|
||||
}
|
||||
|
||||
if(languageName != "") {
|
||||
if(!StringUtils.isEmpty(languageName)) {
|
||||
if(!labelsHash.containsKey(languageName)) {
|
||||
labelsHash.put(languageName, new ArrayList<LabelInformation>());
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class VClassGroupDaoFiltering extends BaseFiltering implements VClassGrou
|
|||
public LinkedHashMap<String, VClassGroup> getClassGroupMap() {
|
||||
LinkedHashMap<String, VClassGroup> lhm = innerDao.getClassGroupMap();
|
||||
Set<String> keys = lhm.keySet();
|
||||
for( Object key : keys){
|
||||
for( String key : keys){
|
||||
VClassGroup vcg = (VClassGroup)lhm.get(key);
|
||||
if( vcg == null || !filters.getVClassGroupFilter().fn(vcg) ){
|
||||
lhm.remove(key);
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -291,7 +292,7 @@ public class RDFServiceGraph implements GraphWithPerform {
|
|||
literalBuff.append("\"");
|
||||
if (node.getLiteralDatatypeURI() != null) {
|
||||
literalBuff.append("^^<").append(node.getLiteralDatatypeURI()).append(">");
|
||||
} else if (node.getLiteralLanguage() != null && node.getLiteralLanguage() != "") {
|
||||
} else if (!StringUtils.isEmpty(node.getLiteralLanguage())) {
|
||||
literalBuff.append("@").append(node.getLiteralLanguage());
|
||||
}
|
||||
return literalBuff.toString();
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.http.HttpClientFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.HttpResponse;
|
||||
|
@ -233,7 +234,7 @@ public class SparqlGraph implements GraphWithPerform {
|
|||
literalBuff.append("\"");
|
||||
if (node.getLiteralDatatypeURI() != null) {
|
||||
literalBuff.append("^^<").append(node.getLiteralDatatypeURI()).append(">");
|
||||
} else if (node.getLiteralLanguage() != null && node.getLiteralLanguage() != "") {
|
||||
} else if (!StringUtils.isEmpty(node.getLiteralLanguage())) {
|
||||
literalBuff.append("@").append(node.getLiteralLanguage());
|
||||
}
|
||||
return literalBuff.toString();
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Map;
|
|||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -251,7 +252,7 @@ public class ManageLabelsForIndividualGenerator extends BaseEditConfigurationGen
|
|||
//for selection when creating a new label
|
||||
//The assumption here is we don't want to allow the user to add a new label when a label
|
||||
//already exists in that language
|
||||
if(languageName != "untyped" && !existingLabelsLanguageNames.contains(languageName)) {
|
||||
if(!"untyped".equals(languageName) && !existingLabelsLanguageNames.contains(languageName)) {
|
||||
availableLocales.add(localeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +303,7 @@ public class ManageLabelsForIndividualGenerator extends BaseEditConfigurationGen
|
|||
for(Literal l: labels) {
|
||||
String languageTag = l.getLanguage();
|
||||
String languageName = "";
|
||||
if(languageTag == "") {
|
||||
if(StringUtils.isEmpty(languageTag)) {
|
||||
languageName = "untyped";
|
||||
}
|
||||
else if(localeCodeToNameMap.containsKey(languageTag)) {
|
||||
|
@ -311,7 +312,7 @@ public class ManageLabelsForIndividualGenerator extends BaseEditConfigurationGen
|
|||
log.warn("This language tag " + languageTag + " does not have corresponding name in the system and was not processed");
|
||||
}
|
||||
|
||||
if(languageName != "") {
|
||||
if(!StringUtils.isEmpty(languageName)) {
|
||||
if(!labelsHash.containsKey(languageName)) {
|
||||
labelsHash.put(languageName, new ArrayList<LabelInformation>());
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public class ManagePagePreprocessor extends
|
|||
for(String uriName: uriKeys) {
|
||||
//these values should never be overwritten or deleted
|
||||
//if(uriName != "page" && uriName != "menuItem" && !uriName.startsWith("dataGetter")) {
|
||||
if(uriName != "page") {
|
||||
if(!"page".equals(uriName)) {
|
||||
boolean hasuv = submission.hasUriValue(uriName);
|
||||
if(!submission.hasUriValue(uriName)) {
|
||||
submission.addUriToForm(editConfiguration,
|
||||
|
|
|
@ -101,7 +101,7 @@ public class GadgetSpec {
|
|||
if ('R' == req.getOwnerReq()) {
|
||||
show &= isRegisteredTo(ownerId, ds);
|
||||
} else if ('S' == req.getOwnerReq()) {
|
||||
show &= (viewerId == ownerId);
|
||||
show &= (viewerId.equals(ownerId));
|
||||
}
|
||||
}
|
||||
return show;
|
||||
|
|
|
@ -1085,7 +1085,7 @@ public class DumpDirectiveTest {
|
|||
}
|
||||
|
||||
public String getName(String which) {
|
||||
return which == "first" ? firstName : lastName;
|
||||
return "first".equals(which) ? firstName : lastName;
|
||||
}
|
||||
|
||||
public String getMiddleName() {
|
||||
|
|
Loading…
Add table
Reference in a new issue