freme-project / basic-services

Apache License 2.0
0 stars 1 forks source link

Internal server error with post processing filter #116

Closed fsasaki closed 7 years ago

fsasaki commented 7 years ago

See attached file and below request.

curl -X POST -H "Content-type: text/turtle" -d@out.txt "https://api-dev.freme-project.eu/current/toolbox/convert/documents/count-domains?informat=turtle&outformat=csv" out.txt

jnehring commented 7 years ago

I can reproduce the bug.

It works when I remove informat and outformat parameters from URL and specify the accept header:

curl -X POST -H "Content-type: text/turtle"  -header 'Accept: text/comma-separated-values' -d@out.txt "https://api-dev.freme-project.eu/current/toolbox/convert/documents/count-domains"

The stack trace:

ERROR   2016-10-13 09:46:13,626 [http-nio-8089-exec-6] eu.freme.bservices.controllers.sparqlconverters.SparqlConverterController  -
ERROR   2016-10-13 09:46:13,626 [http-nio-8089-exec-6] eu.freme.common.exception.ExceptionHandlerService  - Request: http://rv1443.1blu.de:8089/toolbox/convert/documents/count-domains raised
eu.freme.common.exception.FREMEHttpException
        at eu.freme.bservices.controllers.sparqlconverters.SparqlConverterController.filter(SparqlConverterController.java:162)
        at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
fsasaki commented 7 years ago

I still get the attached error with the attached curl request.

curl-plus-output.txt

fsasaki commented 7 years ago

I still get the error message, with the request attached here https://github.com/freme-project/basic-services/issues/116#issuecomment-253491180

jnehring commented 7 years ago

Sorry I assigned you too quickly and Jenkins was still updating the installation. Please try again.

informat and outformat are not valid parameters for the sparql filters. You have to set the informat and outformat via header.

I added some input validation, now your curl request produces

{
  "exception": "eu.freme.common.exception.BadRequestException",
  "path": "/toolbox/convert/documents/count-domains",
  "message": "Invalid value \"*/*\" for Accept header.",
  "error": "Bad Request",
  "status": 400,
  "timestamp": 1476360625408
}

@fsasaki does this solve your problem?

jnehring commented 7 years ago

When I do the API request

curl -X POST -H "Content-type: text/turtle" --header 'Accept: text/comma-separated-values' -d@out.txt "https://api-dev.freme-project.eu/current/toolbox/convert/documents/count-domains"

The request does not finish and it produces a lot of warnings like this

WARN    2016-12-05 16:03:34,569 [http-nio-8089-exec-1] com.hp.hpl.jena.sparql.expr.NodeValue  - Datatype format exception: "<sourceDesc><p/></sourceDesc>"^^rdf:XMLLiteral
bgrusdt commented 7 years ago

@jnehring @fsasaki The request does finish, but only after about 5 minutes. The input file is quite large, it has about 25000 lines, when the data is provided in chunks of about 5000 lines, the answer is returned quickly.

The warning is because of this value: "<sourceDesc><p/></sourceDesc>"^^rdf:XMLLiteral . which is inside:

:       a                 dcat:Dataset , tbx:MartifHeader ;
        dc:source         "" ;
        dct:type          "TBX" ;
        tbx:encodingDesc  "<p type=\"XCSURI\">http://www.ttt.org/oscarstandards/tbx/TBXXCS.xcs</p>"^^rdf:XMLLiteral ;
        tbx:sourceDesc    "<sourceDesc><p/></sourceDesc>"^^rdf:XMLLiteral .