gmantele / vollt

Java libraries implementing the IVOA protocol: ADQL, UWS and TAP
http://cdsportal.u-strasbg.fr/taptuto/
29 stars 28 forks source link

parser error with COORDSYS and BOX #26

Closed vforchi closed 7 years ago

vforchi commented 7 years ago

If I execute one of these queries:

SELECT BOX(‘’, 0, 0, 10, 10) from ObsCore
SELECT COORDSYS(POINT(‘’, 0, 0)) from ObsCore

(it's just to test my translator)

I get the following error on the console:

2017-03-01 14:28:15.791 INFO    TAP PARSING S1488374895785  Parsing ADQL: SELECT COORDSYS(POINT(‘’, 0, 0)) from ObsCore SYNC,duration=-1ms (upload=-1,parse=-1,exec=-1,format[text]=-1)
2017-03-01 14:28:15.792 FATAL   THREAD  END S1488374895785  Synchronous thread "S1488374895785" ended with a FATAL error.   S1488374895785 (thread ID: 160) is RUNNABLE in the group UWS_GROUP where 1 threads are active
2017-03-01 14:28:15.793 FATAL   JOB END S1488374895785  The following GRAVE error interrupted the execution of the synchronous job S1488374895785.
Caused by a adql.parser.TokenMgrError at adql.parser.ADQLParserTokenManager.getNextToken(ADQLParserTokenManager.java:1737)
    Lexical error at line 1, column 23.  Encountered: "\u2018" (8216), after : ""
2017-03-01 14:28:15.795 FATAL   HTTP    RESPONSE_SENT   S1488374895785  TAP resource "sync" execution FAILED with a GRAVE error!    HTTP-500 to the user ANONYMOUS as application/xml;charset=UTF-8
Caused by a adql.parser.TokenMgrError at adql.parser.ADQLParserTokenManager.getNextToken(ADQLParserTokenManager.java:1737)
    Lexical error at line 1, column 23.  Encountered: "\u2018" (8216), after : ""
2017-03-01 14:28:15.913 INFO    UWS STOP        UWS Service "TAP/async" stopped!
2017-03-01 14:28:15.914 INFO    TAP STOP        TAP Service stopped!

As far as I can see this has nothing to do with my translator, but it's in the ADQL parser itself.

gmantele commented 7 years ago

Actually, the parser is right. You are just using a forbidden character: a single quotation mark (i.e. ‘ or \u2018 in Unicode). I assume that this query is a copy-paste from either a PDF, an HTML page or a document like Word/OpenOffice/....

If you use a normal single quote ' instead, it should work.

vforchi commented 7 years ago

Sorry, I didn't notice, it was a copy and paste form the ADQL specification. Shouldn't the parser fail more gracefully?

gmantele commented 7 years ago

What do you mean?

I've to admit that the usage of an Error class is quite strong, but this will soon change ; a ParseException will be thrown instead.

But it would be actually very difficult to have a different error message....this one is generated from a parser tool that I am using (JavaCC). And Encountered: "\u2018" gives a good guess that a weird character is the origin of the problem.

vforchi commented 7 years ago

The problem is that the error is in the log file, server side. The user only gets this: INTERNAL SERVER ERROR! Sorry, this error is grave and unexpected. No explanation can be provided for the moment. Details about this error have been reported in the service log files ; you should try again your request later or notify the administrator(s) by yourself (with the following REQ_ID).

gmantele commented 7 years ago

Indeed. And it is linked to the fact that an Error instead of an Exception is thrown. As I said, I will change that soon ; once done, you should not have anymore this kind of message that easily ; it would be like a "normal" syntax error.