diff options
author | Alexander Alexeev | 2016-12-13 02:40:12 +0700 |
---|---|---|
committer | Alexander Alexeev | 2016-12-13 02:40:12 +0700 |
commit | 3ec05784c84a71782f945020799c547ac97ed5f7 (patch) | |
tree | 12b0d5d9bcea8876fe78f082eb6cfe164dea4abd /juick-server/src | |
parent | f1384a874ee415bccba77c8218dbfe63ec67f1bd (diff) |
reg exp fixed
Diffstat (limited to 'juick-server/src')
-rw-r--r-- | juick-server/src/main/java/com/juick/database/MySqlUpdater.java | 6 |
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); |