Opened 10 years ago

Closed 10 years ago

#559 closed defect (fixed)

SECORE to reject queries with almost valid code

Reported by: Piero Campalani Owned by: Piero Campalani
Priority: critical Milestone: 9.0
Component: secore Version: development
Keywords: similar code Cc: Dimitar Misev
Complexity: Medium

Description

SECORE does not throw exception when a code is almost right, that is when [[ EXISTING_CODE == GIVEN_CODE* ]].

For instance, the following CRS is (correctly) not resolved:

http://localhost:8090/def/crs/OGC/0/bogus_code

Whereas these are resolved with the GML content of EXISTING_CODE, and the gml:identifier of the GIVEN_CODE:

http://localhost:8090/def/crs?authority=OGC&version=0?code=AnsiD
http://localhost:8090/def/crs/OGC/0/.AnsiDate-templ
http://localhost:8090/def/crs/OGC/0/Ans
http://localhost:8090/def/crs/EPSG/0/432

NOTE: Add systemtests after fixing the bug.

Change History (7)

comment:1 by Dimitar Misev, 10 years ago

Oh yes, the problem is the XQuery query matches with contains(), fix should be to simply add

id += "<";

on line 132 of source:applications/secore/secore-core/src/java/secore/handler/AbstractHandler.java

comment:2 by Dimitar Misev, 10 years ago

Won't work though if in the definition then we have something like

<identifier>
  ....
</identifier>

instead of

<identifier>...</identifier>

not sure if the first is allowed though, it adds new lines in the identifier?

comment:3 by Piero Campalani, 10 years ago

I'm not sure that is legal.
Adding a .trim() in Java might anyway solve the issue?

comment:4 by Dimitar Misev, 10 years ago

No, the id match is done in an XQuery, see line 138 in source:applications/secore/secore-core/src/java/secore/handler/AbstractHandler.java

comment:5 by Dimitar Misev, 10 years ago

Patch submitted.

comment:6 by abeccati, 10 years ago

Just a note: it's better to add systemtest *before* fixing so you have the failing test as proof of fix (not test driven development but close to) ;)
Looks like closeable

comment:7 by Dimitar Misev, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.