diff options
-rw-r--r-- | src/org/traccar/BaseProtocol.java | 3 | ||||
-rw-r--r-- | src/org/traccar/database/DataManager.java | 20 | ||||
-rw-r--r-- | src/org/traccar/helper/PatternUtil.java | 18 | ||||
-rw-r--r-- | test/org/traccar/helper/PatternUtilTest.java | 2 |
4 files changed, 28 insertions, 15 deletions
diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java index d1791d673..f968e81cc 100644 --- a/src/org/traccar/BaseProtocol.java +++ b/src/org/traccar/BaseProtocol.java @@ -61,7 +61,8 @@ public abstract class BaseProtocol implements Protocol { } } else { if (!supportedCommands.contains(command.getType())) { - throw new RuntimeException("Command " + command.getType() + " is not supported in protocol " + getName()); + throw new RuntimeException("Command " + + command.getType() + " is not supported in protocol " + getName()); } activeDevice.write(command); } diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 898669c21..cf2b03d56 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -111,21 +111,21 @@ public class DataManager implements IdentityManager { } HikariConfig hConfig = new HikariConfig(); - hConfig.setDriverClassName( config.getString("database.driver") ); - hConfig.setJdbcUrl( config.getString("database.url") ); - hConfig.setUsername( config.getString("database.user") ); - hConfig.setPassword( config.getString("database.password") ); - hConfig.setConnectionInitSql( "SELECT 1 FROM DUAL" ); - hConfig.setIdleTimeout( 600000 ); // milliseconds + hConfig.setDriverClassName(config.getString("database.driver")); + hConfig.setJdbcUrl(config.getString("database.url")); + hConfig.setUsername(config.getString("database.user")); + hConfig.setPassword(config.getString("database.password")); + hConfig.setConnectionInitSql("SELECT 1 FROM DUAL"); + hConfig.setIdleTimeout(600000); // milliseconds // ds.setIdleConnectionTestPeriod(600); // ds.setMaxStatementsPerConnection(config.getInteger("database.maxStatements")); - + int maxPoolSize = config.getInteger("database.maxPoolSize"); - + if (maxPoolSize != 0) { - hConfig.setMaximumPoolSize( maxPoolSize ); + hConfig.setMaximumPoolSize(maxPoolSize); } - + dataSource = new HikariDataSource(hConfig); } diff --git a/src/org/traccar/helper/PatternUtil.java b/src/org/traccar/helper/PatternUtil.java index 3d61cc698..88c3f053b 100644 --- a/src/org/traccar/helper/PatternUtil.java +++ b/src/org/traccar/helper/PatternUtil.java @@ -25,9 +25,21 @@ public final class PatternUtil { } public static class MatchResult { - public String pattern; - public String matched; - public String remaining; + private String pattern; + private String matched; + private String remaining; + + public String getPattern() { + return this.pattern; + } + + public String getMatched() { + return this.matched; + } + + public String getRemaining() { + return this.remaining; + } } public static MatchResult checkPattern(String pattern, String input) { diff --git a/test/org/traccar/helper/PatternUtilTest.java b/test/org/traccar/helper/PatternUtilTest.java index 9d8ed9bbd..bb1349363 100644 --- a/test/org/traccar/helper/PatternUtilTest.java +++ b/test/org/traccar/helper/PatternUtilTest.java @@ -9,7 +9,7 @@ public class PatternUtilTest { @Test public void testCheckPattern() { - assertEquals("ab", PatternUtil.checkPattern("abc", "abd").pattern); + assertEquals("ab", PatternUtil.checkPattern("abc", "abd").getPattern()); } |