From 0bcfc046f216118f21fa8bff47776aea9b6627e1 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 24 Jan 2024 15:43:02 +0100 Subject: [PATCH 1/2] include error detail in error log --- .../iot/cygnus/backends/arcgis/restutils/RestApi.java | 4 ++-- .../backends/arcgis/restutils/RestFeatureTable.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/RestApi.java b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/RestApi.java index 188bde3db..bf75c4752 100644 --- a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/RestApi.java +++ b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/RestApi.java @@ -371,7 +371,7 @@ public static boolean checkHttpResponse(HttpResponse response) { checkHttpResponse(response.getBody()); isSuccessful = true; } catch (ArcgisException e) { - LOGGER.debug("Response has erros, " + e); + LOGGER.debug("Response has erros, " + e.toString()); response.setError(e); } } else { @@ -401,7 +401,7 @@ protected static JsonElement getErrorJsonobject(JsonObject httpResponse) result = httpResponse.get(DELETE_RESULTS_RESPONSE_TAG); } } catch (Exception e) { - LOGGER.error(e); + LOGGER.error(e.getMessage()); throw new ArcgisException(e); } diff --git a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/RestFeatureTable.java b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/RestFeatureTable.java index f364cd68e..c41d46915 100644 --- a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/RestFeatureTable.java +++ b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/RestFeatureTable.java @@ -420,8 +420,10 @@ public void getTableAttributesInfo() throws ArcgisException { } } catch (ArcgisException e) { + LOGGER.error(e.toString()); throw e; } catch (Exception e) { + LOGGER.error("getTableAttributesInfo, Unexpected Exception " + e.toString()); throw new ArcgisException( "getTableAttributesInfo, Unexpected Exception " + e.toString()); } @@ -450,6 +452,7 @@ protected void getUniqueIdFieldFromJson(String jsonStr) throws ArcgisException { LOGGER.info("WARN: Feature table has not uniqueIdField"); } } catch (Exception e) { + LOGGER.error("Error getting uniqueIdField, " + e.getLocalizedMessage()); throw new ArcgisException("Error getting uniqueIdField, " + e.getLocalizedMessage()); } } @@ -473,8 +476,8 @@ protected void getAttributeInfoFromJson(String jsonStr) throws ArcgisException { this.tableAttributes.put(field.getName(), field); } } catch (Exception e) { - LOGGER.error("Can't cast Attributes from Json " + jsonStr); - throw new ArcgisException("Can't cast attributes from Json, " + jsonStr); + LOGGER.error("Can't cast Attributes from Json " + jsonStr + " due to " + e.getMessage()); + throw new ArcgisException("Can't cast attributes from Json, " + jsonStr + "due to " + e.getMessage()); } } @@ -504,7 +507,8 @@ protected void getAttributeIndexFromJson(String jsonStr) throws ArcgisException } } } catch (Exception e) { - LOGGER.error("Error setting unique attributes"); + LOGGER.error("Error setting unique attributes: " + + e.getClass().getSimpleName() + " " + e.getMessage()); throw new ArcgisException("Error setting unique attributes, " + e.getClass().getSimpleName() + " " + e.getMessage()); } @@ -591,6 +595,7 @@ protected ResultPage resultPageFromJson(String responseJson, String lis if (json.get(ERROR_TAG) != null) { errorDesc = json.get(ERROR_TAG).toString(); } + LOGGER.error(errorDesc); throw new ArcgisException(errorDesc); } From 639f9f100be5d04d74872fc183800836210f6f97 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 24 Jan 2024 15:49:12 +0100 Subject: [PATCH 2/2] update CNR --- CHANGES_NEXT_RELEASE | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 37595f077..8954df994 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,3 +1,4 @@ +- [cygnus-common] [Arcgis] include error in log about cast attributes json - [cygnus-common] Upgrade Debian version from 12.1 to 12.4 in Dockerfile - [cygnus-common][NGSIGenericColumnAggregator] Fix getValue when gson object is null