Skip to content

Commit

Permalink
Merge branch 'master' into fix/arcgis_exception_to_cygnus_persistence…
Browse files Browse the repository at this point in the history
…_error
  • Loading branch information
fgalan authored Nov 20, 2024
2 parents 73edc74 + eb0eb4c commit edcceb2
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- [cygnus-ngsi][cygnus-common] Fix way to handle CygnusPersistenceException to allow batch retries in arcgis-sink if `.batch_ttl` configured
- [cygnus-ngsi][cygnus-common] Remove new line chars from Arcgis logs
2 changes: 1 addition & 1 deletion cygnus-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.telefonica.iot</groupId>
<artifactId>cygnus-common</artifactId>
<version>3.15.0</version>
<version>3.15.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cygnus-common</name>
Expand Down
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
4 changes: 2 additions & 2 deletions cygnus-ngsi-ld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.telefonica.iot</groupId>
<artifactId>cygnus-ngsi-ld</artifactId>
<version>3.15.0</version>
<version>3.15.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cygnus-ngsi-ld</name>
Expand Down Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>com.telefonica.iot</groupId>
<artifactId>cygnus-common</artifactId>
<version>3.15.0</version>
<version>3.15.0-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
4 changes: 2 additions & 2 deletions cygnus-ngsi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.telefonica.iot</groupId>
<artifactId>cygnus-ngsi</artifactId>
<version>3.15.0</version>
<version>3.15.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cygnus-ngsi</name>
Expand Down Expand Up @@ -63,7 +63,7 @@
<dependency>
<groupId>com.telefonica.iot</groupId>
<artifactId>cygnus-common</artifactId>
<version>3.15.0</version>
<version>3.15.0-SNAPSHOT</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jodd/jodd-util -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,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
4 changes: 2 additions & 2 deletions cygnus-twitter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.telefonica.iot</groupId>
<artifactId>cygnus-twitter</artifactId>
<version>3.15.0</version>
<version>3.15.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cygnus-twitter</name>
Expand Down Expand Up @@ -57,7 +57,7 @@
<dependency>
<groupId>com.telefonica.iot</groupId>
<artifactId>cygnus-common</artifactId>
<version>3.15.0</version>
<version>3.15.0-SNAPSHOT</version>
</dependency>
<!-- Required by twitter agent -->
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions docker/cygnus-common/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MAINTAINER Francisco Romero Bueno <francisco.romerobueno@telefonica.com>
# Environment variables
ENV CYGNUS_USER "cygnus"
ENV CYGNUS_HOME "/opt/fiware-cygnus"
ENV CYGNUS_VERSION "3.15.0"
ENV CYGNUS_VERSION "3.15.0-SNAPSHOT"
ENV CYGNUS_CONF_PATH "/opt/apache-flume/conf"
ENV CYGNUS_CONF_FILE "/opt/apache-flume/conf/agent.conf"
ENV CYGNUS_AGENT_NAME "cygnus-common"
Expand All @@ -40,7 +40,7 @@ ENV CYGNUS_API_PORT "8081"
# PR https://github.com/telefonicaid/fiware-cygnus/pull/1801 should be also done in this Dockerfile
# NOTE: Configure correctly GIT_URL_CYGNUS and GIT_REV_CYGNUS for each git branch/fork used
ENV GIT_URL_CYGNUS "https://github.com/telefonicaid/fiware-cygnus.git"
ENV GIT_REV_CYGNUS "release/3.15.0"
ENV GIT_REV_CYGNUS "master"

ENV MVN_VER "3.5.4"
ENV MVN_TGZ "apache-maven-${MVN_VER}-bin.tar.gz"
Expand Down
2 changes: 1 addition & 1 deletion docker/cygnus-ngsi-ld/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ARG GITHUB_REPOSITORY=fiware-cygnus
# Environment variables
ENV CYGNUS_USER "cygnus"
ENV CYGNUS_HOME "/opt/fiware-cygnus"
ENV CYGNUS_VERSION "3.15.0"
ENV CYGNUS_VERSION "3.15.0-SNAPSHOT"
ENV CYGNUS_CONF_PATH "/opt/apache-flume/conf"
ENV CYGNUS_CONF_FILE "/opt/apache-flume/conf/agent.conf"
ENV CYGNUS_AGENT_NAME "cygnus-ngsi-ld"
Expand Down
2 changes: 1 addition & 1 deletion docker/cygnus-ngsi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ARG GITHUB_REPOSITORY=fiware-cygnus
# Environment variables
ENV CYGNUS_USER "cygnus"
ENV CYGNUS_HOME "/opt/fiware-cygnus"
ENV CYGNUS_VERSION "3.15.0"
ENV CYGNUS_VERSION "3.15.0-SNAPSHOT"
ENV CYGNUS_CONF_PATH "/opt/apache-flume/conf"
ENV CYGNUS_CONF_FILE "/opt/apache-flume/conf/agent.conf"
ENV CYGNUS_AGENT_NAME "cygnus-ngsi"
Expand Down
4 changes: 2 additions & 2 deletions docker/cygnus-twitter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MAINTAINER Javi Palanca <jpalanca@dsic.upv.es>
# Environment variables
ENV CYGNUS_USER "cygnus"
ENV CYGNUS_HOME "/opt/fiware-cygnus"
ENV CYGNUS_VERSION "3.15.0"
ENV CYGNUS_VERSION "3.15.0-SNAPSHOT"
ENV CYGNUS_CONF_PATH "/opt/apache-flume/conf"
ENV CYGNUS_CONF_FILE "/opt/apache-flume/conf/agent.conf"
ENV CYGNUS_AGENT_NAME "cygnus-twitter"
Expand All @@ -39,7 +39,7 @@ ENV CYGNUS_JAVA_OPTS "-Xms2048m -Xmx4096m"
# PR https://github.com/telefonicaid/fiware-cygnus/pull/1801 should be also done in this Dockerfile
# NOTE: Configure correctly GIT_URL_CYGNUS and GIT_REV_CYGNUS for each git branch/fork used
ENV GIT_URL_CYGNUS "https://github.com/telefonicaid/fiware-cygnus.git"
ENV GIT_REV_CYGNUS "release/3.15.0"
ENV GIT_REV_CYGNUS "master"

ENV MVN_VER "3.5.4"
ENV MVN_TGZ "apache-maven-${MVN_VER}-bin.tar.gz"
Expand Down

0 comments on commit edcceb2

Please sign in to comment.