]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6001: Handle trailing user-provided wildcard as a SQL wildcard, rather than...
authorAron Roberts <aron@socrates.berkeley.edu>
Thu, 16 May 2013 02:37:40 +0000 (19:37 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Thu, 16 May 2013 02:37:40 +0000 (19:37 -0700)
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java

index b2aa40722bb191d6be0c250a7f40b03cd012a55d..b2843cf40d1692dbf7636f61561a186febbff5fc 100644 (file)
@@ -1793,8 +1793,8 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      * Replaces user-supplied wildcards with SQL wildcards, in a partial term
      * matching search expression.
      * 
-     * The scope of this replacement excludes the beginning and ending
-     * characters in that search expression, as those are treated specially.
+     * The scope of this replacement excludes the beginning character
+     * in that search expression, as that character is treated specially.
      * 
      * @param partialTerm
      * @return the partial term, with any user-supplied wildcards replaced
@@ -1815,10 +1815,8 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             logger.warn("Will handle that character as a literal value, rather than as a wildcard ...");
             return partialTerm;
         }
-        int lastCharPos = len - 1;
         return partialTerm.substring(0, 1) // first char
-                + partialTerm.substring(1, lastCharPos).replaceAll(USER_SUPPLIED_WILDCARD_REGEX, JDBCTools.SQL_WILDCARD) // middle of search expression, excluding first and last
-                + partialTerm.substring(lastCharPos); // last char
+                + partialTerm.substring(1, len).replaceAll(USER_SUPPLIED_WILDCARD_REGEX, JDBCTools.SQL_WILDCARD);
 
     }