diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 8b1378917..bc22e22d6 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1 @@ - +- [cygnus-ngsi][cygnus-common] Remove new line chars from Arcgis logs diff --git a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/ArcgisFeatureTable.java b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/ArcgisFeatureTable.java index 15e022d20..f5fbe5cd1 100644 --- a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/ArcgisFeatureTable.java +++ b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/ArcgisFeatureTable.java @@ -89,11 +89,7 @@ protected ArcgisFeatureTable() { public ArcgisFeatureTable(String url, String user, String password, String tokenGenUrl, boolean readOnly, int connectionTimeout, int readTimeout) { this(); - LOGGER.debug("Arcgis constructor.. " + url); - - LOGGER.debug("Arcgis url.. " + url); - LOGGER.debug("Arcgis tokenGenUrl.. " + tokenGenUrl); - LOGGER.debug("Arcgis readOnly.. " + readOnly); + LOGGER.debug("ArcgisFeatureTable constructor. Url: " + url + " tokenGenUrl: " + tokenGenUrl + " readOnly: " + readOnly); Credential credential = new UserCredential(user, password); try { @@ -104,8 +100,8 @@ public ArcgisFeatureTable(String url, String user, String password, String token connected = true; } catch (ArcgisException e) { LOGGER.error("Arcgis error while connecting to Feature Table: (" + e.getMessage() + ")" - + "\n\t URL: " + url - + "\n\t tokenGenURL: " + tokenGenUrl); + + "\t URL: " + url + + "\t tokenGenURL: " + tokenGenUrl); connected = false; setError(e); this.errorDesc += " " + url + " - " + tokenGenUrl; diff --git a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/CredentialRestApi.java b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/CredentialRestApi.java index af2a646f9..3de37519f 100644 --- a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/CredentialRestApi.java +++ b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/restutils/CredentialRestApi.java @@ -92,8 +92,8 @@ public CredentialRestApi(String tokenGenUrl, Credential credential, String refer * @throws ArcgisException */ public Credential getCredential() throws ArcgisException { - LOGGER.debug("------------------ getCredential() " + "\n\t tokenGenUrl: " + tokenGenUrl - + "\n\t credential: " + credential + "\n\t credential.isExpired(): " + LOGGER.debug("------------------ getCredential() " + "\t tokenGenUrl: " + tokenGenUrl + + "\t credential: " + credential + "\t credential.isExpired(): " + (credential != null ? credential.isExpired() : null)); if (tokenGenUrl != null && (credential == null || credential.isExpired())) { LOGGER.debug("Creating/Refreshing token."); 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 86deac5be..ca8e4e6e1 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 @@ -256,12 +256,12 @@ public boolean verify(String hostname, SSLSession session) { } catch (UnknownHostException e) { httpResponse.setResponseCode(HttpURLConnection.HTTP_NOT_FOUND); - httpResponse.setResponseMessage(e.getClass() + "\n" + e.getMessage()); + httpResponse.setResponseMessage(e.getClass() + " error message: " + e.getMessage()); } catch (IllegalArgumentException e) { httpResponse.setResponseMessage("Check url, it may have 'http:/' instead of 'http://' " - + e.getClass() + "\n" + e.getMessage()); + + e.getClass() + " error message: " + e.getMessage()); } catch (Exception e) { - httpResponse.setResponseMessage(e.getClass() + "\n" + e.getMessage()); + httpResponse.setResponseMessage(e.getClass() + " error message: " + e.getMessage()); } finally { LOGGER.debug("Disposing connection objects"); if (rd != null) { @@ -357,7 +357,7 @@ protected static void checkHttpResponse(String httpResponse) throws ArcgisExcept throw new ArcgisException("Unexpected response format" + httpResponse); } catch (IllegalStateException | ClassCastException e) { throw new ArcgisException("checkHttpResponse, Unexpected exception" + e.getMessage() - + " \n\t" + httpResponse); + + " httpResponse: " + httpResponse); } catch (NullPointerException e) { throw new ArcgisException( "checkHttpResponse, Null Body recived from server." + httpResponse); @@ -470,7 +470,7 @@ protected static void checkHttpSingleResponse(JsonObject node) throws ArcgisExce } throw new ArcgisException(errorCode, - "Response Error " + errorCode + " " + message + "\n" + details); + "Response ErrorCode: " + errorCode + " message: " + message + " details: " + details); } } 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 2f630d80f..2a33c1fd8 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 @@ -221,7 +221,7 @@ public ResultPage getFeatureList(String whereClause, int pageOffset, St } HttpResponse response = httpGet(fullUrl, params, this.connectionTimeout, this.readTimeout); - LOGGER.debug("Response code: " + response.getResponseCode() + "\n\t" + response.getBody()); + LOGGER.debug("Response code: " + response.getResponseCode() + "\t response body: " + response.getBody()); checkResponse(response); @@ -238,7 +238,7 @@ public ResultPage getFeatureList(String whereClause, int pageOffset, St */ protected void checkResponse(HttpResponse response) throws ArcgisException { if (!checkHttpResponse(response)) { - String errorMsg = "Error: " + response.getErrorCode() + "\n" + String errorMsg = "Error code: " + response.getErrorCode() + " error message: " + response.getErrorMessage(); LOGGER.error(errorMsg); throw new ArcgisException(errorMsg); @@ -274,7 +274,7 @@ public void sendFeatureList(List featureList, String action) throws Arc } HttpResponse response = httpPost(fullUrl, params, bodyParams, this.connectionTimeout, this.readTimeout); - LOGGER.debug("Response code: " + response.getResponseCode() + "\n\t" + response.getBody()); + LOGGER.debug("Response code: " + response.getResponseCode() + "\t response body: " + response.getBody()); checkResponse(response); } @@ -359,7 +359,7 @@ public void deleteEntities(List objectIdList) throws ArcgisException { } HttpResponse response = httpPost(fullUrl, params, bodyParams, this.connectionTimeout, this.readTimeout); - LOGGER.debug("Response code: " + response.getResponseCode() + "\n\t" + response.getBody()); + LOGGER.debug("Response code: " + response.getResponseCode() + "\t response body: " + response.getBody()); checkResponse(response); @@ -406,7 +406,7 @@ public void getTableAttributesInfo() throws ArcgisException { LOGGER.debug("HttpGet " + fullUrl.toString() + " number of params: " + params.size()); HttpResponse response = httpGet(fullUrl, params, this.connectionTimeout, this.readTimeout); - LOGGER.debug("Response code: " + response.getResponseCode() + "\n\t" + response.getBody()); + LOGGER.debug("Response code: " + response.getResponseCode() + "\t response body: " + response.getBody()); checkResponse(response); @@ -421,8 +421,8 @@ public void getTableAttributesInfo() throws ArcgisException { } else { String errorMsg = "getTableAttributesInfo: Unexpected server response, Error: " - + response.getErrorCode() + "\n" + response.getErrorMessage(); - errorMsg += " \n\t token: " + token; + + response.getErrorCode() + " error message: " + response.getErrorMessage(); + errorMsg += " \t token: " + token; LOGGER.error(errorMsg); throw new ArcgisException(errorMsg); } diff --git a/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java b/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java index 77a7e98c4..1709a8031 100644 --- a/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java +++ b/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java @@ -540,7 +540,7 @@ public void aggregate(NGSIEvent event) throws CygnusRuntimeError { throw new CygnusRuntimeError(e.getMessage()); } catch (Exception e) { LOGGER.error("[NGSIArcgisAggregator] aggregate - Unexpected Error" + e.getMessage() - + "\n contextElement: " + contextElement.toString()); + + " contextElement: " + contextElement.toString()); throw new CygnusRuntimeError(e.getMessage()); }