Skip to content

Commit

Permalink
Merge pull request #78 from intel-cloud/0.3.3.0
Browse files Browse the repository at this point in the history
fix issue #76
  • Loading branch information
ywang19 committed Jul 19, 2013
2 parents 4e7ffaf + c675af1 commit 91074f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ public void dispose() {
client.dispose();
}

@Override
public void abort() {
super.abort();
client.abort();
}

@Override
public InputStream getObject(String container, String object, Config config) {
super.getObject(container, object, config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,18 @@ public InputStream getObjectAsStream(String namespace, String objName)

HttpResponse response = null;

try
{
response = client.execute(method);

if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return response.getEntity().getContent();
} else if (response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) {
return response.getEntity().getContent();
} else {
throw new AmpliException("unknown error when request object "
+ objName + "@" + namespace, response.getAllHeaders(),
response.getStatusLine());
}
} finally {
if (response != null)
EntityUtils.consume(response.getEntity());
response = client.execute(method);

if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return response.getEntity().getContent();
}
EntityUtils.consume(response.getEntity());
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) {
return response.getEntity().getContent();
} else {
throw new AmpliException("unknown error when request object "
+ objName + "@" + namespace, response.getAllHeaders(),
response.getStatusLine());
}
}

Expand Down

0 comments on commit 91074f9

Please sign in to comment.