Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-759

New Version of HTTP client throw HTTP400 error when using "sparqlService"

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Not A Problem
    • Affects Version/s: Jena 2.12.0
    • Fix Version/s: Jena 2.11.1
    • Component/s: ARQ
    • Environment:

      OS : Ubuntu
      Using eclipse, maven and Junit.

      Description

      Call to a remote strabon SPARQL endpoint that was working on Jena 2.11.1 do not work properly in version 2.12.0.

      This function :

      public void queryStrabon(final String query, final RDFDatatype datatype, final String... parameters) {
              final QuerySolutionMap map = new QuerySolutionMap();
      
              System.out.println(query);
      
              for (int i = 0; i < parameters.length; i += 2) {
                  final RDFNode node = ResourceFactory.createTypedLiteral(parameters[i + 1], datatype);
                  map.add(parameters[i], node);
              }
      
              final ParameterizedSparqlString pss = new ParameterizedSparqlString(query, map);
      
              final QueryExecution qe = QueryExecutionFactory.sparqlService(this.endpointURL + "Query", pss.asQuery());
              final ResultSet resultSet = qe.execSelect();
      
              while (resultSet.hasNext()) {
                  System.out.println(resultSet.next());
              }
      
              System.out.println("lines: " + resultSet.getRowNumber());
          }
      

      while working on Jena 2.11.1 do not work on Jena 2.12.0 and got the following stack trace at execution time :

      HttpException: 400
      	at com.hp.hpl.jena.sparql.engine.http.HttpQuery.rewrap(HttpQuery.java:414)
      	at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:358)
      	at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:295)
      	at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:346)
      	at model.SpatioTemporalModelSTrabonEndpointImpl.getInterestingEvents(SpatioTemporalModelSTrabonEndpointImpl.java:99)
      	at model.SpatioTemporalModelStrabonEndpointImplTest.Test_get_interesting_events0(SpatioTemporalModelStrabonEndpointImplTest.java:86)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      

      Additionaly, the server says that the query isn't set or is invalid.

        Attachments

          Activity

            People

            • Assignee:
              andy Andy Seaborne
              Reporter:
              avl ArthurVaisse-Lesteven
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: