Skip to content

Commit e76c48d

Browse files
committed
- Fix al status message en la llamada remota APIObject. Issue: 103338
1 parent 6af8d9a commit e76c48d

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

java/src/main/java/com/genexus/internet/GXRestAPIClient.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class GXRestAPIClient {
2727
private Location location;
2828
private String protocol = "REST";
2929
private String httpMethod = "GET";
30-
private int statusCode;
3130
private int errorCode;
3231
private String errorMessage;
3332
private Integer responseCode;
@@ -87,13 +86,17 @@ public int getErrorCode() {
8786
}
8887

8988
public int getStatusCode() {
90-
return statusCode;
89+
return responseCode;
9190
}
9291

9392
public String getErrorMessage() {
9493
return errorMessage;
9594
}
9695

96+
public String getStatusMessage() {
97+
return responseMessage;
98+
}
99+
97100
/* Sets */
98101

99102
public void setName( String value) {
@@ -113,9 +116,13 @@ public void setHttpMethod( String value) {
113116
}
114117

115118
public void setStatusCode( int value) {
116-
statusCode = value;
119+
responseCode = value;
117120
}
118-
121+
122+
public void setStatusMessage(String value) {
123+
responseMessage = value;
124+
}
125+
119126
public void setErrorCode( int value) {
120127
errorCode = value;
121128
}
@@ -511,14 +518,15 @@ public void RestExecute() {
511518
serviceuri += "/" + this.location.getBaseURL() + "/" + this.location.getResourceName();
512519
serviceuri += queryString;
513520
httpClient.execute( this.httpMethod, serviceuri);
514-
515-
if (httpClient.getStatusCode() >= 300 || httpClient.getErrCode() > 0) {
516-
errorCode = (httpClient.getErrCode() == 0)? 1 : httpClient.getErrCode();
517-
errorMessage = httpClient.getErrDescription();
518-
statusCode = httpClient.getStatusCode();
521+
responseCode = httpClient.getStatusCode();
522+
responseMessage = httpClient.getReasonLine();
523+
errorCode = 0;
524+
errorMessage = "";
525+
if (responseCode >= 300 || httpClient.getErrCode() > 0) {
526+
errorCode = httpClient.getErrCode();
527+
errorMessage = httpClient.getErrDescription();
519528
}
520529
else {
521-
statusCode = httpClient.getStatusCode();
522530
try {
523531
jsonResponse = new JSONObject(httpClient.getString());
524532
}

0 commit comments

Comments
 (0)