Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/remove new line chars from arcgis logs #2445

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@

- [cygnus-ngsi][cygnus-common] Remove new line chars from Arcgis logs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public ResultPage<Feature> 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);

Expand All @@ -238,7 +238,7 @@ public ResultPage<Feature> 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);
Expand Down Expand Up @@ -274,7 +274,7 @@ public void sendFeatureList(List<Feature> 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);
}
Expand Down Expand Up @@ -359,7 +359,7 @@ public void deleteEntities(List<String> 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);

Expand Down Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
Loading