diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 5b7b94c871..f88bd576f5 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -3,5 +3,6 @@ - Fix: $max and $min operators were not supported with DateTime attributes (#4585) - Fix: wrong date values should not allowed in subscription's expires field (#4541) - Fix: do not raise DB alarm in case of wrong GeoJSON in client request +- Fix: registrations with more tha one contextRegistration element (not possible in NGSIv2) are logged as Runtime Errors - Upgrade cjexl version from 0.3.0 to 0.4.0 (new transformations: now, getTime and toIsoString) - Upgrade Debian version from 12.4 to 12.6 in Dockerfile diff --git a/src/lib/mongoBackend/MongoGlobal.cpp b/src/lib/mongoBackend/MongoGlobal.cpp index 46b9100d91..041dfe0c80 100644 --- a/src/lib/mongoBackend/MongoGlobal.cpp +++ b/src/lib/mongoBackend/MongoGlobal.cpp @@ -1854,9 +1854,13 @@ bool registrationsQuery ngsiv2::Registration reg; if (reg.fromBson(r)) { - // FIXME PR: control error if Registration comes from NGSIv1 regV->push_back(reg); } + else + { + // FIXME #4611: this else branch will be no longer needed after fixing the issue + LM_E(("Runtime Error (registrations with more than one CR are considered runtime errors since Orion 4.1.0, please fix reg %s at DB)", reg.id.c_str())); + } /* FIXME: note that given the response doesn't distinguish from which registration ID the * response comes, it could have that we have same context registration elements, belong to different diff --git a/src/lib/mongoBackend/mongoRegistrationGet.cpp b/src/lib/mongoBackend/mongoRegistrationGet.cpp index 6c8d85847a..f152b8814b 100644 --- a/src/lib/mongoBackend/mongoRegistrationGet.cpp +++ b/src/lib/mongoBackend/mongoRegistrationGet.cpp @@ -100,9 +100,9 @@ void mongoRegistrationGet // if (!regP->fromBson(r)) { - // FIXME #4611: this check will be no longer needed after fixing the issue. setDataProvided return type could be changed to void + // FIXME #4611: this check will be no longer needed after fixing the issue. fromBson return type could be changed to void orion::releaseMongoConnection(connection); - LM_W(("Bad Input (getting registrations with more than one CR")); + LM_E(("Runtime Error (registrations with more than one CR are considered runtime errors since Orion 4.1.0, please fix reg %s at DB)", regP->id.c_str())); reqSemGive(__FUNCTION__, "Mongo Get Registration", reqSemTaken); oeP->fill(SccReceiverInternalError, err); return; @@ -193,9 +193,9 @@ void mongoRegistrationsGet // if (!reg.fromBson(r)) { - // FIXME #4611: this check will be no longer needed after fixing the issue. setDataProvided return type could be changed to void + // FIXME #4611: this check will be no longer needed after fixing the issue. fromBson return type could be changed to void orion::releaseMongoConnection(connection); - LM_W(("Bad Input (getting registrations with more than one CR")); + LM_E(("Runtime Error (registrations with more than one CR are considered runtime errors since Orion 4.1.0, please fix reg %s at DB)", reg.id.c_str())); reqSemGive(__FUNCTION__, "Mongo Get Registrations", reqSemTaken); oeP->fill(SccReceiverInternalError, err); return; diff --git a/src/lib/ngsi/Scope.cpp b/src/lib/ngsi/Scope.cpp index 72938b1d0a..caaf012595 100644 --- a/src/lib/ngsi/Scope.cpp +++ b/src/lib/ngsi/Scope.cpp @@ -227,15 +227,7 @@ int Scope::fill pointV.push_back(pointP); } - // FIXME PR: remove this "circle" processing that comes from NGSIv1? - if (geometry.areaType == "circle") - { - *errorStringP = "circle geometry is not supported by Orion API v2"; - pointVectorRelease(pointV); - pointV.clear(); - return -1; - } - else if (geometry.areaType == "polygon") + if (geometry.areaType == "polygon") { areaType = orion::PolygonType; @@ -357,7 +349,7 @@ int Scope::fill */ void Scope::release(void) { - // NOTE: georel, circle, box, and point don't use dynamic memory, so they don't need release methods + // NOTE: georel, box, and point don't use dynamic memory, so they don't need release methods polygon.release(); line.release(); diff --git a/src/lib/ngsi10/UpdateContextRequest.cpp b/src/lib/ngsi10/UpdateContextRequest.cpp index 48f1464c7c..7fea610c4c 100644 --- a/src/lib/ngsi10/UpdateContextRequest.cpp +++ b/src/lib/ngsi10/UpdateContextRequest.cpp @@ -114,7 +114,7 @@ std::string UpdateContextRequest::toJson(void) * "updateAction": "APPEND" * } */ -std::string UpdateContextRequest::toJsonV1(bool asJsonObject) +std::string UpdateContextRequest::toJsonV1(void) { JsonObjectHelper jh; diff --git a/src/lib/ngsi10/UpdateContextRequest.h b/src/lib/ngsi10/UpdateContextRequest.h index 3a8bcfca97..fb6d7c131a 100644 --- a/src/lib/ngsi10/UpdateContextRequest.h +++ b/src/lib/ngsi10/UpdateContextRequest.h @@ -50,7 +50,7 @@ typedef struct UpdateContextRequest UpdateContextRequest(); UpdateContextRequest(const std::string& _contextProvider, bool _providerFormat, Entity* eP); - std::string toJsonV1(bool asJsonObject); + std::string toJsonV1(void); std::string toJson(void); void release(void); ContextAttribute* attributeLookup(Entity* eP, const std::string& attributeName); diff --git a/src/lib/orionTypes/areas.cpp b/src/lib/orionTypes/areas.cpp index f502d69fc9..d83b602626 100644 --- a/src/lib/orionTypes/areas.cpp +++ b/src/lib/orionTypes/areas.cpp @@ -390,12 +390,6 @@ int Geometry::parse(const char* in, std::string* errorString) } } - if ((areaType == "circle") && (radius == -1)) - { - *errorString = "no radius for circle"; - return -1; - } - if ((areaType == "polygon") && (radius != -1)) { *errorString = "radius set for polygon"; diff --git a/src/lib/serviceRoutines/postUpdateContext.cpp b/src/lib/serviceRoutines/postUpdateContext.cpp index 30f5aaef5b..a87595e6e5 100644 --- a/src/lib/serviceRoutines/postUpdateContext.cpp +++ b/src/lib/serviceRoutines/postUpdateContext.cpp @@ -115,9 +115,6 @@ static bool updateForward int port; std::string prefix; - // FIXME PR: not really needed... - bool asJsonObject = (ciP->uriParam[URI_PARAM_ATTRIBUTE_FORMAT] == "object" && ciP->outMimeType == JSON); - // // 1. Parse the providing application to extract IP, port and URI-path // @@ -155,7 +152,7 @@ static bool updateForward if (upcrP->legacyProviderFormat) { - TIMED_RENDER(payload = upcrP->toJsonV1(asJsonObject)); + TIMED_RENDER(payload = upcrP->toJsonV1()); op = "/updateContext"; diff --git a/test/unittests/mongoBackend/mongoQueryContextGeo_test.cpp b/test/unittests/mongoBackend/mongoQueryContextGeo_test.cpp index 7531b17519..ebab55e50c 100644 --- a/test/unittests/mongoBackend/mongoQueryContextGeo_test.cpp +++ b/test/unittests/mongoBackend/mongoQueryContextGeo_test.cpp @@ -58,10 +58,6 @@ extern void setMongoConnectionForUnitTest(orion::DBClientBase _connection); * * Tests * -* -* - queryGeoCircleIn1 -* - queryGeoCircleIn2 -* - queryGeoCircleOut * - queryGeoPolygonIn1 * - queryGeoPolygonIn2 * - queryGeoPolygonIn3