Merge pull request #2175 from viniciusbds/master

Change strings comparison to use equals comparator
This commit is contained in:
Antonin Delpeuch 2019-10-02 10:39:53 +02:00 committed by GitHub
commit 1f0c409cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -53,9 +53,9 @@ public class InnerXml implements Function {
Object o1 = args[0];
if (o1 != null && o1 instanceof Element) {
Element e1 = (Element)o1;
if(mode == "xml") {
if(mode.equals("xml")) {
return e1.children().toString();
} else if (mode == "html") {
} else if (mode.equals("html")) {
return e1.html();
} else {
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) {
Object o1 = args[0];
if (o1 != null && o1 instanceof String) {
if (mode == "html") {
if (mode.equals("html")) {
return Jsoup.parse(o1.toString());
} else if (mode == "xml") {
} else if (mode.equals("xml")) {
return Jsoup.parse(o1.toString(), "",Parser.xmlParser());
} else {
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();
if (ref_val.startsWith("HTTP error"))
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++) {
System.out.println("value:" + project.rows.get(i).getCellValue(1));
// all random values should be equal due to caching