You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/09/08 03:45:29 UTC

[3/3] groovy git commit: Trivial refactoring: remove redundant String operation

Trivial refactoring: remove redundant String operation


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/544cbaaa
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/544cbaaa
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/544cbaaa

Branch: refs/heads/GROOVY_2_5_X
Commit: 544cbaaad424fbb775a14b0d1944ee72d5ee9b16
Parents: 8c4c8cb
Author: Daniel Sun <su...@apache.org>
Authored: Sat Sep 8 11:38:06 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sat Sep 8 11:44:57 2018 +0800

----------------------------------------------------------------------
 .../groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/544cbaaa/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java b/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java
index c8b67f7..8694ec6 100644
--- a/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java
+++ b/subprojects/groovy-sql/src/main/java/groovy/sql/ExtractIndexAndSql.java
@@ -191,7 +191,7 @@ class ExtractIndexAndSql {
 
         Matcher matcher = NAMED_QUERY_PATTERN.matcher(sql);
         while (matcher.find()) {
-            newSql.append(sql.substring(txtIndex, matcher.start())).append('?');
+            newSql.append(sql, txtIndex, matcher.start()).append('?');
             String indexStr = matcher.group(1);
             if (indexStr == null) indexStr = matcher.group(3);
             int index = (indexStr == null || indexStr.length() == 0 || ":".equals(indexStr)) ? 0 : Integer.parseInt(indexStr) - 1;