http-api: catch and rethrown json exceptions as ioexceptions - we don't check return code from the http response..

This commit is contained in:
Adam
2017-05-16 19:23:48 -04:00
parent 45640a34be
commit c32782a233
3 changed files with 15 additions and 0 deletions

View File

@@ -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);
}
}
}

View File

@@ -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

View File

@@ -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);
}
}
}