Permalink
Browse files

Code cleanup.

  • Loading branch information...
1 parent 56cc8b8 commit 6489a791426967b4d33b30ca8ad83a68a9f62109 Andrew Kirilenko committed Mar 21, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 client/src/main/java/io/iron/ironworker/client/APIClient.java
@@ -160,7 +160,8 @@ private void setRequestURI(HttpRequestBase request, String method, Map<String, S
query = null;
}
- URI uri = null;
+ URI uri;
+
try {
uri = URIUtils.createURI(scheme, host, port, "" + apiVersion + "/" + method, query, null);
} catch (URISyntaxException e) {
@@ -203,22 +204,20 @@ private HttpResponse doFileRequest(File file, String method, Map<String, String>
}
private InputStream parseResponseGeneral(HttpResponse response) throws APIException {
- InputStream result = null;
+ InputStream result;
+
try {
result = response.getEntity().getContent();
} catch (IOException e) {
throw new APIException(null, e);
}
if (response.getStatusLine().getStatusCode() != 200) {
- String r = null;
try {
- r = IOUtils.toString(result);
+ throw new APIException(IOUtils.toString(result), null);
} catch (IOException e) {
throw new APIException(null, e);
}
-
- throw new APIException(r, null);
}
return result;
@@ -259,6 +258,7 @@ public JsonObject codesCreate(String name, String file, String runtime, String r
params.put("file_name", runner);
File f = new File(file);
+
if (!f.exists()) {
throw new APIException("File " + file + " not found", null);
}

0 comments on commit 6489a79

Please sign in to comment.