diff --git a/src/main/java/de/diddiz/LogBlock/DumpedLogImporter.java b/src/main/java/de/diddiz/LogBlock/DumpedLogImporter.java index 591391c..d40d0b5 100644 --- a/src/main/java/de/diddiz/LogBlock/DumpedLogImporter.java +++ b/src/main/java/de/diddiz/LogBlock/DumpedLogImporter.java @@ -38,7 +38,7 @@ public class DumpedLogImporter implements Runnable for (final File sqlFile : imports) { getLogger().info("Trying to import " + sqlFile.getName() + " ..."); final BufferedReader reader = new BufferedReader(new FileReader(sqlFile)); - String line = null; + String line; while ((line = reader.readLine()) != null) try { st.execute(line); diff --git a/src/main/java/de/diddiz/LogBlock/QueryParams.java b/src/main/java/de/diddiz/LogBlock/QueryParams.java index c189451..b97902d 100644 --- a/src/main/java/de/diddiz/LogBlock/QueryParams.java +++ b/src/main/java/de/diddiz/LogBlock/QueryParams.java @@ -544,7 +544,6 @@ public final class QueryParams implements Cloneable value += args.get(j) + " "; } - continue; } else { // The value ends with a double quote diff --git a/src/main/java/de/diddiz/LogBlock/WorldEditor.java b/src/main/java/de/diddiz/LogBlock/WorldEditor.java index 1dd345c..53a84a9 100644 --- a/src/main/java/de/diddiz/LogBlock/WorldEditor.java +++ b/src/main/java/de/diddiz/LogBlock/WorldEditor.java @@ -141,7 +141,7 @@ public class WorldEditor implements Runnable if (!block.setTypeId(0)) throw new WorldEditorException(block.getTypeId(), 0, block.getLocation()); } else if (ca != null && (type == 23 || type == 54 || type == 61 || type == 62)) { - int leftover = 0; + int leftover; try { leftover = modifyContainer(state, new ItemStack(ca.itemType, -ca.itemAmount, (short)0, ca.itemData)); if (leftover > 0) diff --git a/src/main/java/de/diddiz/util/MySQLConnectionPool.java b/src/main/java/de/diddiz/util/MySQLConnectionPool.java index d909668..d78af21 100644 --- a/src/main/java/de/diddiz/util/MySQLConnectionPool.java +++ b/src/main/java/de/diddiz/util/MySQLConnectionPool.java @@ -28,10 +28,9 @@ import java.util.concurrent.locks.ReentrantLock; public class MySQLConnectionPool implements Closeable { - private final static int poolsize = 10; + private final static int poolSize = 10; private final static long timeToLive = 300000; private final Vector connections; - private final ConnectionReaper reaper; private final String url, user, password; private final Lock lock = new ReentrantLock(); @@ -40,9 +39,9 @@ public class MySQLConnectionPool implements Closeable this.url = url; this.user = user; this.password = password; - connections = new Vector(poolsize); - reaper = new ConnectionReaper(); - reaper.start(); + connections = new Vector(poolSize); + ConnectionReaper reaper = new ConnectionReaper(); + new Thread(reaper, "MySQL Connection Reaper Thread - LogBlock").start(); } @Override @@ -95,7 +94,7 @@ public class MySQLConnectionPool implements Closeable lock.unlock(); } - private class ConnectionReaper extends Thread + private class ConnectionReaper implements Runnable { @Override public void run() { @@ -112,14 +111,14 @@ public class MySQLConnectionPool implements Closeable private class JDCConnection implements Connection { private final Connection conn; - private boolean inuse; + private boolean inUse; private long timestamp; private int networkTimeout; private String schema; JDCConnection(Connection conn) { this.conn = conn; - inuse = false; + inUse = false; timestamp = 0; networkTimeout = 30; schema = "default"; @@ -132,12 +131,12 @@ public class MySQLConnectionPool implements Closeable @Override public void close() { - inuse = false; + inUse = false; try { if (!conn.getAutoCommit()) conn.setAutoCommit(true); } catch (final SQLException ex) { - connections.remove(conn); + connections.remove(this); terminate(); } } @@ -407,7 +406,7 @@ public class MySQLConnectionPool implements Closeable } boolean inUse() { - return inuse; + return inUse; } boolean isValid() { @@ -419,9 +418,9 @@ public class MySQLConnectionPool implements Closeable } synchronized boolean lease() { - if (inuse) + if (inUse) return false; - inuse = true; + inUse = true; timestamp = System.currentTimeMillis(); return true; } diff --git a/src/main/java/de/diddiz/util/Utils.java b/src/main/java/de/diddiz/util/Utils.java index d81ceb3..2929ce5 100644 --- a/src/main/java/de/diddiz/util/Utils.java +++ b/src/main/java/de/diddiz/util/Utils.java @@ -118,10 +118,10 @@ public class Utils if (s == null || s.length == 0) return ""; final int len = s.length; - final StringBuffer buffer = new StringBuffer(s[0]); + final StringBuilder builder = new StringBuilder(s[0]); for (int i = 1; i < len; i++) - buffer.append(delimiter).append(s[i]); - return buffer.toString(); + builder.append(delimiter).append(s[i]); + return builder.toString(); } public static class ExtensionFilenameFilter implements FilenameFilter