Permalink
Browse files

More proper placement of stream releases

  • Loading branch information...
1 parent 3b9b41d commit c7c94399fdc5407273825691ae1e799165f43717 @egonw egonw committed Nov 12, 2010
@@ -92,7 +92,6 @@ public static String normalizeURI(String datasetURI) {
HttpMethod method = new GetMethod(datasetURI + "compounds");
method.setRequestHeader("Accept", "text/uri-list");
client.executeMethod(method);
- method.releaseConnection();
List<String> compounds = new ArrayList<String>();
BufferedReader reader = new BufferedReader(
new StringReader(method.getResponseBodyAsString())
@@ -102,6 +101,7 @@ public static String normalizeURI(String datasetURI) {
line = line.trim();
if (line.length() > 0) compounds.add(line);
}
+ method.releaseConnection();
return compounds;
}
@@ -118,9 +118,9 @@ public static StringMatrix listPredictedFeatures(String datasetURI)
method.setRequestHeader("Accept", "application/rdf+xml");
client.executeMethod(method);
method.getResponseBodyAsString(); // without this things will fail??
- method.releaseConnection();
IRDFStore store = rdf.createInMemoryStore();
rdf.importFromStream(store, method.getResponseBodyAsStream(), "RDF/XML", null);
+ method.releaseConnection();
return rdf.sparql(store, QUERY_PREDICTED_FEATURES);
}
@@ -36,7 +36,6 @@ public static TaskState getState(String task)
HttpMethod method = new GetMethod(task);
method.setRequestHeader("Accept", "text/uri-list");
client.executeMethod(method);
- method.releaseConnection();
int status = method.getStatusCode();
logger.debug("Task status: " + status);

0 comments on commit c7c9439

Please sign in to comment.