summaryrefslogtreecommitdiff
path: root/src/com/p4square/f1oauth
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2014-02-01 19:16:47 -0800
committerJesse Morgan <jesse@jesterpm.net>2014-02-01 19:16:47 -0800
commit1acc88878906f22dc88a44b68a402cf73bbd8a0c (patch)
tree8843d543de6229796fb950b872eb14e472a150a8 /src/com/p4square/f1oauth
parentbd33dbee7f5d0127786137c358fb7c8d91b02fbe (diff)
Fixing resource leak.20140201c
Diffstat (limited to 'src/com/p4square/f1oauth')
-rw-r--r--src/com/p4square/f1oauth/SecondPartyVerifier.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/com/p4square/f1oauth/SecondPartyVerifier.java b/src/com/p4square/f1oauth/SecondPartyVerifier.java
index 70fef73..4def620 100644
--- a/src/com/p4square/f1oauth/SecondPartyVerifier.java
+++ b/src/com/p4square/f1oauth/SecondPartyVerifier.java
@@ -74,14 +74,20 @@ public class SecondPartyVerifier implements Verifier {
request.setChallengeResponse(user.getChallengeResponse());
Response response = mDispatcher.handle(request);
- Status status = response.getStatus();
- if (status.isSuccess()) {
- JacksonRepresentation<Map> entity = new JacksonRepresentation<Map>(response.getEntity(), Map.class);
- Map data = entity.getObject();
- return new F1User(user, data);
-
- } else {
- throw new OAuthException(status);
+ try {
+ Status status = response.getStatus();
+ if (status.isSuccess()) {
+ JacksonRepresentation<Map> entity = new JacksonRepresentation<Map>(response.getEntity(), Map.class);
+ Map data = entity.getObject();
+ return new F1User(user, data);
+
+ } else {
+ throw new OAuthException(status);
+ }
+ } finally {
+ if (response.getEntity() != null) {
+ response.release();
+ }
}
}
}