summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-atom-runtime/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-12-08 23:45:14 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-12-08 23:45:14 +0000
commitc71524917eeecfa8aeb5c497d2c3660f0862ab71 (patch)
tree8dce4111b0864cdd2a43d7e1d7a89b56cbf082f1 /sca-java-2.x/trunk/modules/binding-atom-runtime/src
parent9f766005792dbd31f8c6d0306ddbbf5c68173104 (diff)
More version changes and make sure HttpClient connections are released
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1043772 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-atom-runtime/src')
-rw-r--r--sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java58
1 files changed, 33 insertions, 25 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
index 9ad69d58a3..c1de646f54 100644
--- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
+++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
@@ -22,6 +22,7 @@ import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.entry
import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.feedEntry;
import java.io.IOException;
+import java.io.InputStream;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
@@ -113,7 +114,9 @@ class AtomBindingInvoker implements Invoker {
// Read the Atom entry
if (status == 200) {
- Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(response.getEntity().getContent());
+ InputStream content = response.getEntity().getContent();
+ Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(content);
+ content.close();
parsing = true;
org.apache.abdera.model.Entry feedEntry = doc.getRoot();
@@ -145,11 +148,11 @@ class AtomBindingInvoker implements Invoker {
} catch (Exception e) {
msg.setFaultBody(new ServiceRuntimeException(e));
} finally {
- if (!parsing) {
- // Release the connection unless the Abdera parser is
- // parsing the response, in this case it will release it
- release(getMethod, response);
- }
+
+ // Release the connection unless the Abdera parser is
+ // parsing the response, in this case it will release it
+ release(getMethod, response);
+
}
return msg;
@@ -211,8 +214,9 @@ class AtomBindingInvoker implements Invoker {
// Read the Atom entry
if (status == 200 || status == 201) {
- Document<org.apache.abdera.model.Entry> doc =
- abderaParser.parse(postMethod.getEntity().getContent());
+ InputStream content = postMethod.getEntity().getContent();
+ Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(content);
+ content.close();
parsing = true;
org.apache.abdera.model.Entry createdEntry = doc.getRoot();
@@ -240,11 +244,11 @@ class AtomBindingInvoker implements Invoker {
} catch (Exception e) {
msg.setFaultBody(new ServiceRuntimeException(e));
} finally {
- if (!parsing) {
- // Release the connection unless the Abdera parser is
- // parsing the response, in this case it will release it
- release(postMethod, response);
- }
+
+ // Release the connection unless the Abdera parser is
+ // parsing the response, in this case it will release it
+ release(postMethod, response);
+
}
return msg;
@@ -408,7 +412,9 @@ class AtomBindingInvoker implements Invoker {
// Read the Atom feed
if (status == 200) {
- Document<Feed> doc = abderaParser.parse(response.getEntity().getContent());
+ InputStream content = response.getEntity().getContent();
+ Document<Feed> doc = abderaParser.parse(content);
+ content.close();
parsing = true;
Feed feed = null;
@@ -451,11 +457,11 @@ class AtomBindingInvoker implements Invoker {
} catch (Exception e) {
msg.setFaultBody(new ServiceRuntimeException(e));
} finally {
- if (!parsing) {
- // Release the connection unless the Abdera parser is
- // parsing the response, in this case it will release it
- release(getMethod, response);
- }
+
+ // Release the connection unless the Abdera parser is
+ // parsing the response, in this case it will release it
+ release(getMethod, response);
+
}
return msg;
@@ -494,7 +500,9 @@ class AtomBindingInvoker implements Invoker {
// Read the Atom feed
if (status == 200) {
- Document<Feed> doc = abderaParser.parse(response.getEntity().getContent());
+ InputStream content = response.getEntity().getContent();
+ Document<Feed> doc = abderaParser.parse(content);
+ content.close();
parsing = true;
Feed feed = doc.getRoot();
@@ -530,11 +538,11 @@ class AtomBindingInvoker implements Invoker {
} catch (Exception e) {
msg.setFaultBody(new ServiceRuntimeException(e));
} finally {
- if (!parsing) {
- // Release the connection unless the Abdera parser is
- // parsing the response, in this case it will release it
- release(getMethod, response);
- }
+
+ // Release the connection unless the Abdera parser is
+ // parsing the response, in this case it will release it
+ release(getMethod, response);
+
}
return msg;