From: Sebastian B. <bo...@us...> - 2004-08-28 16:20:39
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31687/src/org/exist/xquery/functions/util Modified Files: EvalFunction.java Log Message: return empty sequence instead of failing when "" is passed as expression Index: EvalFunction.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util/EvalFunction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EvalFunction.java 13 Aug 2004 21:28:48 -0000 1.6 --- EvalFunction.java 28 Aug 2004 16:20:23 -0000 1.7 *************** *** 37,40 **** --- 37,41 ---- import org.exist.xquery.XQueryContext; import org.exist.xquery.XPathException; + import org.exist.xquery.value.EmptySequence; import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; *************** *** 63,67 **** "namespace declarations and variable declarations are visible from within the " + "inner expression. The function accepts a second string argument to specify " + ! "the static context collection to which the expression applies.", new SequenceType[] { new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE), --- 64,69 ---- "namespace declarations and variable declarations are visible from within the " + "inner expression. The function accepts a second string argument to specify " + ! "the static context collection to which the expression applies. It will return" + ! "an empty sequence if you pass a whitespace string.", new SequenceType[] { new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE), *************** *** 87,90 **** --- 89,94 ---- // get the query expression String expr = getArgument(0).eval(contextSequence, contextItem).getStringValue(); + if ("".equals(expr.trim())) + return new EmptySequence(); // check optional collection argument DocumentSet oldDocumentSet = null; |