From 41d9e0c6649eaded87c38347b1d6b67b609e30bb Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Thu, 7 May 2015 12:16:47 +0200 Subject: [PATCH] Accepts missing value in filter expr, mkjsf-16 Would raise JSF/Ajax error on SearchCommand.filter attribute when entering 'pz:id=' (for instance). This is a legitimate interim entry however, since the user could leave the field in that state to cut and paste a target ID from somewhere else. A value of 'pz:id=' at time of search would currently result in 'no targets' error from pazpar2. --- .../com/indexdata/mkjsf/pazpar2/commands/Expression.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Expression.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Expression.java index 1961bae..af10e9b 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Expression.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Expression.java @@ -56,10 +56,14 @@ public class Expression implements Serializable { */ public Expression (String expressionString) { String[] parts = expressionString.split("[=~]"); - this.leftEntity = parts[0]; - this.operator = expressionString.contains("=") ? "=" : "~"; - this.rightEntity = parts[1]; - this.label=rightEntity; + if (parts.length>0) { + this.leftEntity = parts[0]; + this.operator = expressionString.contains("=") ? "=" : "~"; + } + if (parts.length>1) { + this.rightEntity = parts[1]; + this.label=rightEntity; + } } /** -- 1.7.10.4