diff --git a/pom.xml b/pom.xml
index 9ea3b39..f2eff55 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
xyz.etztech
plugin-api
- 1.0.6
+ 1.0.7
@@ -30,12 +30,12 @@
com.zaxxer
HikariCP
- 2.6.1
+ 3.4.5
com.h2database
h2
- 1.4.197
+ 1.4.200
diff --git a/src/main/java/xyz/etztech/core/db/DataSource.java b/src/main/java/xyz/etztech/core/db/DataSource.java
index 2e1216e..bdb32e0 100644
--- a/src/main/java/xyz/etztech/core/db/DataSource.java
+++ b/src/main/java/xyz/etztech/core/db/DataSource.java
@@ -11,13 +11,13 @@ import java.sql.SQLException;
* A class to initialize an H2 database and retrieve connections
*/
public class DataSource {
- private HikariConfig config = new HikariConfig();
- private HikariDataSource dataSource;
+ private final HikariDataSource dataSource;
/** Create a data source for a plugin
* @param plugin The plugin using this database. Used for creation purposes.
*/
public DataSource(JavaPlugin plugin) {
+ HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:h2:" + plugin.getDataFolder().getAbsolutePath() + "/" + plugin.getName().toLowerCase());
config.setDriverClassName("org.h2.Driver");
dataSource = new HikariDataSource(config);
diff --git a/src/main/java/xyz/etztech/core/web/MultipartUtility.java b/src/main/java/xyz/etztech/core/web/MultipartUtility.java
index 7da290a..684d98f 100644
--- a/src/main/java/xyz/etztech/core/web/MultipartUtility.java
+++ b/src/main/java/xyz/etztech/core/web/MultipartUtility.java
@@ -21,10 +21,10 @@ import java.util.List;
public class MultipartUtility {
private final String boundary;
private static final String LINE_FEED = "\r\n";
- private HttpURLConnection httpConn;
- private String charset;
- private OutputStream outputStream;
- private PrintWriter writer;
+ private final HttpURLConnection httpConn;
+ private final String charset;
+ private final OutputStream outputStream;
+ private final PrintWriter writer;
/**
* This constructor initializes a new HTTP POST request where content type
@@ -59,10 +59,10 @@ public class MultipartUtility {
* @param value field value
*/
public void addFormField(String name, String value) {
- writer.append("--" + boundary).append(LINE_FEED);
- writer.append("Content-Disposition: form-data; name=\"" + name + "\"")
+ writer.append("--").append(boundary).append(LINE_FEED);
+ writer.append("Content-Disposition: form-data; name=\"").append(name).append("\"")
.append(LINE_FEED);
- writer.append("Content-Type: text/plain; charset=" + charset).append(
+ writer.append("Content-Type: text/plain; charset=").append(charset).append(
LINE_FEED);
writer.append(LINE_FEED);
writer.append(value).append(LINE_FEED);
@@ -78,14 +78,10 @@ public class MultipartUtility {
public void addFilePart(String fieldName, File uploadFile)
throws IOException {
String fileName = uploadFile.getName();
- writer.append("--" + boundary).append(LINE_FEED);
- writer.append(
- "Content-Disposition: form-data; name=\"" + fieldName
- + "\"; filename=\"" + fileName + "\"")
+ writer.append("--").append(boundary).append(LINE_FEED);
+ writer.append("Content-Disposition: form-data; name=\"").append(fieldName).append("\"; filename=\"").append(fileName).append("\"")
.append(LINE_FEED);
- writer.append(
- "Content-Type: "
- + URLConnection.guessContentTypeFromName(fileName))
+ writer.append("Content-Type: ").append(URLConnection.guessContentTypeFromName(fileName))
.append(LINE_FEED);
writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
writer.append(LINE_FEED);
@@ -110,7 +106,7 @@ public class MultipartUtility {
* @param value - value of the header field
*/
public void addHeaderField(String name, String value) {
- writer.append(name + ": " + value).append(LINE_FEED);
+ writer.append(name).append(": ").append(value).append(LINE_FEED);
writer.flush();
}
@@ -123,7 +119,7 @@ public class MultipartUtility {
StringBuilder response = new StringBuilder();
//writer.append(LINE_FEED).flush();
- writer.append("--" + boundary + "--").append(LINE_FEED);
+ writer.append("--").append(boundary).append("--").append(LINE_FEED);
writer.close();
// checks server's status code first
diff --git a/src/main/java/xyz/etztech/core/web/Response.java b/src/main/java/xyz/etztech/core/web/Response.java
index 2fff89e..0167ab8 100644
--- a/src/main/java/xyz/etztech/core/web/Response.java
+++ b/src/main/java/xyz/etztech/core/web/Response.java
@@ -18,7 +18,7 @@ public class Response {
private Boolean status;
private String message;
- private static Logger log = Logger.getLogger("Minecraft");
+ private static final Logger log = Logger.getLogger("Minecraft");
/**
* @param httpResponse A JSON array e.g. multiple results from one call