From: mike Date: Wed, 14 Jun 2006 14:36:36 +0000 (+0000) Subject: Bugfixes for decomiling underspecified terms X-Git-Tag: v1.5~146 X-Git-Url: http://jira.indexdata.com/?a=commitdiff_plain;h=18405938a115378cc571d697060ac40775c62fb7;p=cql-java-moved-to-github.git Bugfixes for decomiling underspecified terms Thanks to Rudie Ekkelenkamp --- diff --git a/src/org/z3950/zing/cql/CQLTermNode.java b/src/org/z3950/zing/cql/CQLTermNode.java index aba0b48..a519215 100644 --- a/src/org/z3950/zing/cql/CQLTermNode.java +++ b/src/org/z3950/zing/cql/CQLTermNode.java @@ -1,4 +1,4 @@ -// $Id: CQLTermNode.java,v 1.21 2003-07-29 22:53:02 mike Exp $ +// $Id: CQLTermNode.java,v 1.22 2006-06-14 14:36:36 mike Exp $ package org.z3950.zing.cql; import java.util.Properties; @@ -12,7 +12,7 @@ import java.util.Vector; * these must be provided - you can't have a qualifier without a * relation or vice versa. * - * @version $Id: CQLTermNode.java,v 1.21 2003-07-29 22:53:02 mike Exp $ + * @version $Id: CQLTermNode.java,v 1.22 2006-06-14 14:36:36 mike Exp $ */ public class CQLTermNode extends CQLNode { private String qualifier; @@ -61,7 +61,8 @@ public class CQLTermNode extends CQLNode { String quotedTerm = maybeQuote(term); String res = quotedTerm; - if (!qualifier.equalsIgnoreCase("srw.serverChoice")) { + if (qualifier != null && + !qualifier.equalsIgnoreCase("srw.serverChoice")) { // ### We don't always need spaces around `relation'. res = quotedQualifier + " " + relation.toCQL() + " " + quotedTerm; } @@ -172,6 +173,9 @@ public class CQLTermNode extends CQLNode { } static String maybeQuote(String str) { + if (str == null) + return null; + // There _must_ be a better way to make this test ... if (str.length() == 0 || str.indexOf('"') != -1 ||