You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2022/08/26 18:58:48 UTC

[GitHub] [jena] Aklakan commented on pull request #1483: Improved http content type issue exception message

Aklakan commented on PR #1483:
URL: https://github.com/apache/jena/pull/1483#issuecomment-1228818871

   I just squashed the commits and added the HTTP headers to the message.
   This is an example where a forced an unsupported content type error. It still looks ugly, so wrapping the details up in a subclass of QueryException would still be good - but at least there is now a lot of useful information included:
   I guess the query string is not strictly needed, because this is the one thing the application knows.
   
   ```
   Exception in thread "main" org.apache.jena.query.QueryException: Endpoint returned Content-Type: application/sparql-results+json which is not recognized for SELECT queries. Status code 200 OK, Method GET, Headers: {Accept=[application/sparql-results+json, application/sparql-results+xml;q=0.9, text/tab-separated-values;q=0.7, text/csv;q=0.5,application/json;q=0.2,application/xml;q=0.2,*/*;q=0.1]}, Remaining body: 
   { "head": { "link": [], "vars": ["s", "p", "o"] },
     "results": { "distinct": false, "ordered": true, "bindings": [
       { "s": { "type": "uri", "value": "http://www.openlinksw.com/virtrdf-data-formats#default-iid" }	, "p": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }	, "o": { "type": "uri", "value": "http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat" }},
       { "s": { "type": "uri", "value": "http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable" }	, "p": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }	, "o": { "type": "uri", "value": "http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat" }},
       { "s": { "type": "uri", "value": "http://www.openlinksw.com/virtrdf-data-formats#default-iid-blank" }	, "p": { "type": "uri", "value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }	, "o": { "type": "uri", "value": "http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat" }},
       { "s": { "type": "uri", "value": "http://www.ope...
   	at org.apache.jena.sparql.exec.http.QueryExecHTTP.raiseException(QueryExecHTTP.java:472)
   	at org.apache.jena.sparql.exec.http.QueryExecHTTP.execRowSet(QueryExecHTTP.java:204)
   	at org.apache.jena.sparql.exec.http.QueryExecHTTP.select(QueryExecHTTP.java:161)
   	at org.apache.jena.sparql.exec.QueryExecutionAdapter.execSelect(QueryExecutionAdapter.java:117)
   	at org.apache.jena.sparql.exec.http.QueryExecHTTP.main(QueryExecHTTP.java:647)
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org