diff --git a/main/src/com/google/refine/expr/functions/html/InnerHtml.java b/main/src/com/google/refine/expr/functions/html/InnerHtml.java index 5ccafdc6b..5e9853d46 100644 --- a/main/src/com/google/refine/expr/functions/html/InnerHtml.java +++ b/main/src/com/google/refine/expr/functions/html/InnerHtml.java @@ -48,7 +48,7 @@ public class InnerHtml implements Function { @Override public Object call(Properties bindings, Object[] args) { - if (args.length >= 1) { + if (args.length == 1) { Object o1 = args[0]; if (o1 != null && o1 instanceof Element) { return new InnerXml().call(bindings, args, "html"); @@ -56,7 +56,7 @@ public class InnerHtml implements Function { return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element. Please first use parseHtml(string) and select(query) prior to using this function"); } } - return null; + return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single String as an argument"); } diff --git a/main/src/com/google/refine/expr/functions/html/ParseHtml.java b/main/src/com/google/refine/expr/functions/html/ParseHtml.java index 28bf387eb..14ae4b3cd 100644 --- a/main/src/com/google/refine/expr/functions/html/ParseHtml.java +++ b/main/src/com/google/refine/expr/functions/html/ParseHtml.java @@ -37,7 +37,6 @@ import java.util.Properties; import org.json.JSONException; import org.json.JSONWriter; -import org.jsoup.Jsoup; import com.google.refine.expr.EvalError; import com.google.refine.expr.functions.xml.ParseXml; diff --git a/main/src/com/google/refine/expr/functions/xml/OwnText.java b/main/src/com/google/refine/expr/functions/xml/OwnText.java index b4df9c6d1..8066b9473 100644 --- a/main/src/com/google/refine/expr/functions/xml/OwnText.java +++ b/main/src/com/google/refine/expr/functions/xml/OwnText.java @@ -47,17 +47,17 @@ public class OwnText implements Function { @Override public Object call(Properties bindings, Object[] args) { - if (args.length >= 1) { + if (args.length == 1) { Object o1 = args[0]; if (o1 != null && o1 instanceof Element) { Element e1 = (Element)o1; return e1.ownText(); }else{ - return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an HTML Element. Please first use parseHtml(string) and select(query) prior to using this function"); + return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an XML or HTML Element. Please first use parseHtml(string) and select(query) prior to using this function"); } } - return null; + return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single XML or HTML element as an argument"); } diff --git a/main/src/com/google/refine/expr/functions/xml/XmlAttr.java b/main/src/com/google/refine/expr/functions/xml/XmlAttr.java index 269cb6796..c4746038d 100644 --- a/main/src/com/google/refine/expr/functions/xml/XmlAttr.java +++ b/main/src/com/google/refine/expr/functions/xml/XmlAttr.java @@ -47,7 +47,7 @@ public class XmlAttr implements Function { @Override public Object call(Properties bindings, Object[] args) { - if (args.length >= 2) { + if (args.length == 2) { Object o1 = args[0]; Object o2 = args[1]; if (o1 != null && o1 instanceof Element) { @@ -59,7 +59,7 @@ public class XmlAttr implements Function { return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an XML or HTML Element. Please first use parseXml() or parseHtml() and select() prior to using this function"); } } - return null; + return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects two arguments"); } diff --git a/main/src/com/google/refine/expr/functions/xml/XmlText.java b/main/src/com/google/refine/expr/functions/xml/XmlText.java index 90dd0fa41..014eb8016 100644 --- a/main/src/com/google/refine/expr/functions/xml/XmlText.java +++ b/main/src/com/google/refine/expr/functions/xml/XmlText.java @@ -47,7 +47,7 @@ public class XmlText implements Function { @Override public Object call(Properties bindings, Object[] args) { - if (args.length >= 1) { + if (args.length == 1) { Object o1 = args[0]; if (o1 != null && o1 instanceof Element) { Element e1 = (Element)o1; @@ -57,7 +57,7 @@ public class XmlText implements Function { return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " failed as the first parameter is not an XML or HTML Element. Please first use parseXml() or parseHtml() and select(query) prior to using this function"); } } - return null; + return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a single XML or HTML element as an argument"); }