File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
library/src/main/java/dev/andstuff/kraken/api Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 44import java .io .OutputStreamWriter ;
55import java .io .UnsupportedEncodingException ;
66import java .net .MalformedURLException ;
7+ import java .net .URI ;
8+ import java .net .URISyntaxException ;
79import java .net .URL ;
810import java .util .Map ;
911import java .util .Map .Entry ;
@@ -106,7 +108,9 @@ public JsonNode execute() throws IOException {
106108 return OBJECT_MAPPER .readTree (connection .getInputStream ());
107109 }
108110 finally {
109- connection .disconnect ();
111+ if (connection != null ) {
112+ connection .disconnect ();
113+ }
110114 }
111115 }
112116
@@ -115,18 +119,21 @@ public JsonNode execute() throws IOException {
115119 *
116120 * @param method the API method
117121 * @return the path of the request taking the method into account
118- * @throws MalformedURLException if the request URL could not be created
119- * with the method name
120122 */
121- public String setMethod (KrakenApi .Method method ) throws MalformedURLException {
123+ public String setMethod (KrakenApi .Method method ) {
122124
123125 if (method == null ) {
124126 throw new IllegalArgumentException (ERROR_NULL_METHOD );
125127 }
126128
127129 isPublic = method .isPublic ;
128- url = new URL ((isPublic ? PUBLIC_URL : PRIVATE_URL ) + method .name );
129- return url .getPath ();
130+ try {
131+ url = new URI ((isPublic ? PUBLIC_URL : PRIVATE_URL ) + method .name ).toURL ();
132+ return url .getPath ();
133+ }
134+ catch (MalformedURLException | URISyntaxException e ) {
135+ throw new IllegalStateException ("Could not set method URL" , e );
136+ }
130137 }
131138
132139 /**
Original file line number Diff line number Diff line change 4646 </issueManagement >
4747
4848 <properties >
49+ <maven .compiler.release>21</maven .compiler.release>
4950 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
50- <maven .compiler.source>1.8</maven .compiler.source>
51- <maven .compiler.target>1.8</maven .compiler.target>
52- <maven .compiler.target>8</maven .compiler.target>
5351
5452 <!-- Third-party dependencies -->
5553 <jackson .version>2.16.1</jackson .version>
You can’t perform that action at this time.
0 commit comments