Opened 4 years ago

Closed 4 years ago

#559 closed defect (fixed)

SECORE to reject queries with almost valid code

Reported by: pcampalani Owned by: pcampalani
Priority: critical Milestone: 9.0
Component: secore Version: development
Keywords: similar code Cc: dmisev
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 Changed 4 years ago by dmisev

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 Changed 4 years ago by dmisev

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 Changed 4 years ago by pcampalani

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

comment:4 Changed 4 years ago by dmisev

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 Changed 4 years ago by dmisev

Patch submitted.

comment:6 Changed 4 years ago by abeccati

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 Changed 4 years ago by dmisev

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.