http-api: catch and rethrown json exceptions as ioexceptions - we don't check return code from the http response..
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.http.api.account;
|
||||
|
||||
import com.google.gson.JsonParseException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -60,5 +61,9 @@ public class LoginClient
|
||||
InputStream in = body.byteStream();
|
||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), OAuthResponse.class);
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.http.api.config;
|
||||
|
||||
import com.google.gson.JsonParseException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -71,6 +72,10 @@ public class ConfigClient
|
||||
InputStream in = body.byteStream();
|
||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), Configuration.class);
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void set(String key, String value) throws IOException
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.http.api.hiscore;
|
||||
|
||||
import com.google.gson.JsonParseException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -60,5 +61,9 @@ public class HiscoreClient
|
||||
InputStream in = body.byteStream();
|
||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), HiscoreResult.class);
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user