Skip to content

Commit

Permalink
More proper placement of stream releases
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Nov 12, 2010
1 parent 3b9b41d commit c7c9439
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public static List<String> getCompoundList(String datasetURI)
HttpMethod method = new GetMethod(datasetURI + "compounds"); HttpMethod method = new GetMethod(datasetURI + "compounds");
method.setRequestHeader("Accept", "text/uri-list"); method.setRequestHeader("Accept", "text/uri-list");
client.executeMethod(method); client.executeMethod(method);
method.releaseConnection();
List<String> compounds = new ArrayList<String>(); List<String> compounds = new ArrayList<String>();
BufferedReader reader = new BufferedReader( BufferedReader reader = new BufferedReader(
new StringReader(method.getResponseBodyAsString()) new StringReader(method.getResponseBodyAsString())
Expand All @@ -102,6 +101,7 @@ public static List<String> getCompoundList(String datasetURI)
line = line.trim(); line = line.trim();
if (line.length() > 0) compounds.add(line); if (line.length() > 0) compounds.add(line);
} }
method.releaseConnection();
return compounds; return compounds;
} }


Expand All @@ -118,9 +118,9 @@ public static StringMatrix listPredictedFeatures(String datasetURI)
method.setRequestHeader("Accept", "application/rdf+xml"); method.setRequestHeader("Accept", "application/rdf+xml");
client.executeMethod(method); client.executeMethod(method);
method.getResponseBodyAsString(); // without this things will fail?? method.getResponseBodyAsString(); // without this things will fail??
method.releaseConnection();
IRDFStore store = rdf.createInMemoryStore(); IRDFStore store = rdf.createInMemoryStore();
rdf.importFromStream(store, method.getResponseBodyAsStream(), "RDF/XML", null); rdf.importFromStream(store, method.getResponseBodyAsStream(), "RDF/XML", null);
method.releaseConnection();
return rdf.sparql(store, QUERY_PREDICTED_FEATURES); return rdf.sparql(store, QUERY_PREDICTED_FEATURES);
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static TaskState getState(String task)
HttpMethod method = new GetMethod(task); HttpMethod method = new GetMethod(task);
method.setRequestHeader("Accept", "text/uri-list"); method.setRequestHeader("Accept", "text/uri-list");
client.executeMethod(method); client.executeMethod(method);
method.releaseConnection();
int status = method.getStatusCode(); int status = method.getStatusCode();
logger.debug("Task status: " + status); logger.debug("Task status: " + status);


Expand Down

0 comments on commit c7c9439

Please sign in to comment.