From 3ec05784c84a71782f945020799c547ac97ed5f7 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Tue, 13 Dec 2016 02:40:12 +0700 Subject: reg exp fixed --- juick-server/src/main/java/com/juick/database/MySqlUpdater.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'juick-server') 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); -- cgit v1.2.3