From 6743d5c87842c0730cfcc4e8ba3884d600c68143 Mon Sep 17 00:00:00 2001 From: viniciusbds Date: Tue, 1 Oct 2019 23:05:24 -0300 Subject: [PATCH] Change strings comparison to use equals comparator --- main/src/com/google/refine/expr/functions/xml/InnerXml.java | 4 ++-- main/src/com/google/refine/expr/functions/xml/ParseXml.java | 4 ++-- .../column/ColumnAdditionByFetchingURLsOperationTests.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main/src/com/google/refine/expr/functions/xml/InnerXml.java b/main/src/com/google/refine/expr/functions/xml/InnerXml.java index 3f9860eb7..49e59ab83 100644 --- a/main/src/com/google/refine/expr/functions/xml/InnerXml.java +++ b/main/src/com/google/refine/expr/functions/xml/InnerXml.java @@ -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."); diff --git a/main/src/com/google/refine/expr/functions/xml/ParseXml.java b/main/src/com/google/refine/expr/functions/xml/ParseXml.java index 3c5239402..047667f1f 100644 --- a/main/src/com/google/refine/expr/functions/xml/ParseXml.java +++ b/main/src/com/google/refine/expr/functions/xml/ParseXml.java @@ -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"); diff --git a/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperationTests.java b/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperationTests.java index 0338e57c0..91c91b004 100644 --- a/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperationTests.java @@ -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