Change strings comparison to use equals comparator

This commit is contained in:
viniciusbds 2019-10-01 23:05:24 -03:00
parent 1a79176942
commit 6743d5c878
3 changed files with 5 additions and 5 deletions

View File

@ -53,9 +53,9 @@ public class InnerXml implements Function {
Object o1 = args[0]; Object o1 = args[0];
if (o1 != null && o1 instanceof Element) { if (o1 != null && o1 instanceof Element) {
Element e1 = (Element)o1; Element e1 = (Element)o1;
if(mode == "xml") { if(mode.equals("xml")) {
return e1.children().toString(); return e1.children().toString();
} else if (mode == "html") { } else if (mode.equals("html")) {
return e1.html(); return e1.html();
} else { } else {
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " unable to determine whether XML or HTML is being used."); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " unable to determine whether XML or HTML is being used.");

View File

@ -53,9 +53,9 @@ public class ParseXml implements Function {
if (args.length == 1) { if (args.length == 1) {
Object o1 = args[0]; Object o1 = args[0];
if (o1 != null && o1 instanceof String) { if (o1 != null && o1 instanceof String) {
if (mode == "html") { if (mode.equals("html")) {
return Jsoup.parse(o1.toString()); return Jsoup.parse(o1.toString());
} else if (mode == "xml") { } else if (mode.equals("xml")) {
return Jsoup.parse(o1.toString(), "",Parser.xmlParser()); return Jsoup.parse(o1.toString(), "",Parser.xmlParser());
} else { } else {
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " unable to identify which parser to use"); return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " unable to identify which parser to use");

View File

@ -179,7 +179,7 @@ public class ColumnAdditionByFetchingURLsOperationTests extends RefineTest {
String ref_val = (String)project.rows.get(0).getCellValue(1).toString(); String ref_val = (String)project.rows.get(0).getCellValue(1).toString();
if (ref_val.startsWith("HTTP error")) if (ref_val.startsWith("HTTP error"))
return; return;
Assert.assertTrue(ref_val != "apple"); // just to make sure I picked the right column Assert.assertFalse(ref_val.equals("apple")); // just to make sure I picked the right column
for (int i = 1; i < 4; i++) { for (int i = 1; i < 4; i++) {
System.out.println("value:" + project.rows.get(i).getCellValue(1)); System.out.println("value:" + project.rows.get(i).getCellValue(1));
// all random values should be equal due to caching // all random values should be equal due to caching