From 852967d23ed0cdd4875c3c2519866284e18c29e9 Mon Sep 17 00:00:00 2001 From: Divyanshu Sharma Date: Mon, 28 Jan 2019 12:49:14 +0530 Subject: [PATCH] Release v1.2.7 *Fixed NationMilitary score data type *Fixed an malicious access vulnerability *Fixed charset warning for better cross-platform usage --- pom.xml | 7 +------ .../pw4j/domains/subdomains/NationMilitaryContainer.java | 4 ++-- .../github/adorableskullmaster/pw4j/queries/ApiQuery.java | 3 +-- .../pw4j/queries/TradehistoryQuery.java | 2 +- .../github/adorableskullmaster/pw4j/queries/WarsQuery.java | 2 +- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index a7dc6f2..417d8f9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.adorable-skullmaster pw4j - 1.2.6 + 1.2.7 pw4j Java Wrapper for Politics and War API jar @@ -174,11 +174,6 @@ gson 2.8.5 - - org.slf4j - slf4j-api - 1.8.0-beta2 - junit junit diff --git a/src/main/java/io/github/adorableskullmaster/pw4j/domains/subdomains/NationMilitaryContainer.java b/src/main/java/io/github/adorableskullmaster/pw4j/domains/subdomains/NationMilitaryContainer.java index 963cacd..c516bd6 100644 --- a/src/main/java/io/github/adorableskullmaster/pw4j/domains/subdomains/NationMilitaryContainer.java +++ b/src/main/java/io/github/adorableskullmaster/pw4j/domains/subdomains/NationMilitaryContainer.java @@ -14,7 +14,7 @@ public class NationMilitaryContainer { private Integer vmIndicator; @SerializedName("score") @Expose - private Integer score; + private Double score; @SerializedName("soldiers") @Expose private Integer soldiers; @@ -51,7 +51,7 @@ public Integer getVmIndicator() { return vmIndicator; } - public Integer getScore() { + public Double getScore() { return score; } diff --git a/src/main/java/io/github/adorableskullmaster/pw4j/queries/ApiQuery.java b/src/main/java/io/github/adorableskullmaster/pw4j/queries/ApiQuery.java index 64fe52b..b0f90ca 100644 --- a/src/main/java/io/github/adorableskullmaster/pw4j/queries/ApiQuery.java +++ b/src/main/java/io/github/adorableskullmaster/pw4j/queries/ApiQuery.java @@ -22,7 +22,7 @@ public class ApiQuery { } private static String convertStreamToString(java.io.InputStream is) { - java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); + java.util.Scanner s = new java.util.Scanner(is, "UTF-8").useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; } @@ -34,7 +34,6 @@ public void buildUrlStr(boolean testServerMode) { public Response fetchAPI() { HttpURLConnection conn = null; try { - System.out.println(urlStr); URL url = new URL(urlStr); conn = (HttpURLConnection) url.openConnection(); conn.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"); diff --git a/src/main/java/io/github/adorableskullmaster/pw4j/queries/TradehistoryQuery.java b/src/main/java/io/github/adorableskullmaster/pw4j/queries/TradehistoryQuery.java index cb6dc13..a6f9bb9 100644 --- a/src/main/java/io/github/adorableskullmaster/pw4j/queries/TradehistoryQuery.java +++ b/src/main/java/io/github/adorableskullmaster/pw4j/queries/TradehistoryQuery.java @@ -15,7 +15,7 @@ public class TradehistoryQuery extends AuthenticatedQuery implements IEntityQuer public TradehistoryQuery(String apiKey, Integer records, ResourceType[] resources) { super.apiKey = apiKey; this.records = records; - this.resources = resources; + this.resources = Arrays.copyOf(resources,resources.length); } @Override diff --git a/src/main/java/io/github/adorableskullmaster/pw4j/queries/WarsQuery.java b/src/main/java/io/github/adorableskullmaster/pw4j/queries/WarsQuery.java index 6d70a50..6afb5b3 100644 --- a/src/main/java/io/github/adorableskullmaster/pw4j/queries/WarsQuery.java +++ b/src/main/java/io/github/adorableskullmaster/pw4j/queries/WarsQuery.java @@ -13,7 +13,7 @@ public class WarsQuery implements IEntityQuery { public WarsQuery(int wid, Integer[] aids) { this.wid = wid; - this.aids = aids; + this.aids = Arrays.copyOf(aids,aids.length); } @Override