You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2020/03/14 10:51:14 UTC
[jena] branch master updated: Fix for JENA-1858
This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jena.git
The following commit(s) were added to refs/heads/master by this push:
new c38e62f Fix for JENA-1858
new 4746bb8 Merge pull request #708 from Aklakan/JENA-1858
c38e62f is described below
commit c38e62fdd54b4961c10cb27f890dbd591fa3eeb4
Author: Claus Stadler <cs...@informatik.uni-leipzig.de>
AuthorDate: Thu Mar 12 20:32:11 2020 +0100
Fix for JENA-1858
---
.../org/apache/jena/sparql/engine/http/Service.java | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/Service.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/Service.java
index 6dc9f38..639c169 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/Service.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/Service.java
@@ -19,6 +19,7 @@
package org.apache.jena.sparql.engine.http;
import java.io.InputStream;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -169,16 +170,18 @@ public class Service {
Explain.explain("HTTP", query, context);
String uri = op.getService().getURI();
HttpQuery httpQuery = configureQuery(uri, context, query);
- InputStream in = httpQuery.exec();
+ QueryIterator qIter;
+ try (InputStream in = httpQuery.exec()) {
+ // Read the whole of the results now.
+ // Avoids the problems with calling back into the same system e.g.
+ // Fuseki+SERVICE <http://localhost:3030/...>
- // Read the whole of the results now.
- // Avoids the problems with calling back into the same system e.g.
- // Fuseki+SERVICE <http://localhost:3030/...>
-
- ResultSet rs = ResultSetFactory.fromXML(in);
- QueryIterator qIter = QueryIter.materialize(new QueryIteratorResultSet(rs));
- // And close connection now, not when qIter is closed.
- IO.close(in);
+ ResultSet rs = ResultSetFactory.fromXML(in);
+ qIter = QueryIter.materialize(new QueryIteratorResultSet(rs));
+ // And close connection now, not when qIter is closed.
+ } catch (IOException e) {
+ throw new QueryExecException("Could not parse result set from XML", e);
+ }
// In some cases we may need to apply a re-mapping
// This solves JENA-494 the naive way and may be brittle for complex