From 0512c916e6b010df350c660d8f02260a75187a34 Mon Sep 17 00:00:00 2001 From: revide Date: Tue, 25 Sep 2018 15:03:31 +0200 Subject: [PATCH] - Fixed deprecated compiler warning - Fixed issue #42 and made fillType optional --- .../bittrex4j/cloudflare/CloudFlareAuthorizer.java | 10 +++++----- src/main/java/com/github/ccob/bittrex4j/dao/Fill.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/github/ccob/bittrex4j/cloudflare/CloudFlareAuthorizer.java b/src/main/java/com/github/ccob/bittrex4j/cloudflare/CloudFlareAuthorizer.java index 4c6a94d..565bd34 100644 --- a/src/main/java/com/github/ccob/bittrex4j/cloudflare/CloudFlareAuthorizer.java +++ b/src/main/java/com/github/ccob/bittrex4j/cloudflare/CloudFlareAuthorizer.java @@ -13,9 +13,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.script.*; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; import java.io.IOException; import java.math.BigDecimal; +import java.math.RoundingMode; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; @@ -24,9 +27,6 @@ import java.util.TimerTask; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import static javax.script.ScriptContext.ENGINE_SCOPE; public class CloudFlareAuthorizer { @@ -160,7 +160,7 @@ private String getJsAnswer(URL url, String responseHtml) throws ScriptException, } log.debug(String.format("CloudFlare JS challenge code: %s", jsCode)); - return new BigDecimal(engine.eval(jsCode).toString()).setScale(10,BigDecimal.ROUND_HALF_UP).toString(); + return new BigDecimal(engine.eval(jsCode).toString()).setScale(10, RoundingMode.HALF_UP).toString(); } throw new IllegalStateException("BUG: could not find initial CF JS challenge code"); } diff --git a/src/main/java/com/github/ccob/bittrex4j/dao/Fill.java b/src/main/java/com/github/ccob/bittrex4j/dao/Fill.java index 0ec08fc..b56b636 100644 --- a/src/main/java/com/github/ccob/bittrex4j/dao/Fill.java +++ b/src/main/java/com/github/ccob/bittrex4j/dao/Fill.java @@ -27,7 +27,7 @@ public class Fill { double quantity; double total; ZonedDateTime timeStamp; - int fillId; + Integer fillId; @@ -35,7 +35,7 @@ public class Fill { public Fill(@Nullable @JsonProperty("Id") @JsonAlias("I") Long id, @JsonProperty("OrderType") @JsonAlias("OT") String orderType, @Nullable @JsonProperty("FillType") @JsonAlias("F") String fillType, @Nullable @JsonProperty("Price") @JsonAlias("P") Double price, @Nullable @JsonProperty("Rate") @JsonAlias("R")Double rate, @JsonProperty("Quantity") @JsonAlias("Q") double quantity, @Nullable @JsonProperty("Total") @JsonAlias("t") Double total, @JsonProperty("TimeStamp") @JsonAlias("T") ZonedDateTime timeStamp, - @JsonProperty("FI") Integer fillId){ + @Nullable @JsonProperty("FI") Integer fillId){ if(rate == null && price == null){ throw new IllegalArgumentException("Either rate or price should be set");