aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-12-13 02:40:12 +0700
committerGravatar Alexander Alexeev2016-12-13 02:40:12 +0700
commit3ec05784c84a71782f945020799c547ac97ed5f7 (patch)
tree12b0d5d9bcea8876fe78f082eb6cfe164dea4abd
parentf1384a874ee415bccba77c8218dbfe63ec67f1bd (diff)
reg exp fixed
-rw-r--r--juick-server/src/main/java/com/juick/database/MySqlUpdater.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/database/MySqlUpdater.java b/juick-server/src/main/java/com/juick/database/MySqlUpdater.java
index 469dad10..c087ee29 100644
--- a/juick-server/src/main/java/com/juick/database/MySqlUpdater.java
+++ b/juick-server/src/main/java/com/juick/database/MySqlUpdater.java
@@ -10,7 +10,6 @@ import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.Assert;
import javax.annotation.PostConstruct;
-import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -26,7 +25,7 @@ import static org.springframework.transaction.TransactionDefinition.PROPAGATION_
*/
public class MySqlUpdater {
private static final Pattern UPDATE_PATTERN = Pattern.compile(
- "update\\s+(version|`version`)\\s+set\\s+(version|`version`)\\s+=\\s+(\\d+)",
+ "update\\s+(version|`version`)\\s+set\\s+(version|`version`)\\s+=\\s*(\\d+)",
Pattern.CASE_INSENSITIVE);
private final Logger logger = LoggerFactory.getLogger(getClass());
@@ -84,8 +83,7 @@ public class MySqlUpdater {
Matcher m = UPDATE_PATTERN.matcher(sql);
if (m.matches()) {
- String actual = m.group(3);
- actualVersion = Long.valueOf(actual);
+ actualVersion = Long.valueOf(m.group(3));
if (actualVersion > currentDbVersion) {
updateInTransaction(changesSql);