Skip to content

Commit

Permalink
Merge pull request #2549 from RestComm/abdulazizali-BUG2521
Browse files Browse the repository at this point in the history
Issue 2521: Move DownloaderResponse access after succeeded() check
  • Loading branch information
jaimecasero authored Oct 9, 2017
2 parents 715ec9c + 1d52e2e commit 9ed6a3c
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -545,27 +545,34 @@ else if ("outbound-api".equals(response.get().direction())){
}
} else if (DownloaderResponse.class.equals(klass)) {
final DownloaderResponse response = (DownloaderResponse) message;

int sc = response.get().getStatusCode();
//processingInfoRequest
if (logger.isDebugEnabled()) {
logger.debug("Rcml URI : " + response.get().getURI() + "response success=" + response.succeeded()
+ ", statusCode=" + response.get().getStatusCode()+" state="+state);
logger.debug("Rcml DownloaderResponse success=" + response.succeeded());
}
//FIXME: what if these ifblocks arent in downloadingRcml?
if (response.succeeded()) {
int sc = response.get().getStatusCode();
//processingInfoRequest
if (logger.isDebugEnabled()) {
logger.debug("Rcml DownloaderResponse URI : " + response.get().getURI()
+ ", statusCode=" + response.get().getStatusCode()+" state="+state);
}
if(HttpStatus.SC_OK == sc){
fsm.transition(message, ready);
} else if (HttpStatus.SC_NOT_FOUND == sc){
fsm.transition(message, notFound);
}
} else {
if (logger.isDebugEnabled()) {
logger.debug("Rcml DownloaderResponse error : " + response.error()
+ ", cause=" +
((response.cause() != null) ? response.cause().getMessage() : ""));
}
if (downloadingRcml.equals(state) && fallbackUrl!=null) {
fsm.transition(message, downloadingFallbackRcml);
} else {
//unexpected response
if(!sentBye && !receivedBye){
sendBye("UssdInterpreter Stopping. Unexpected State when receiving DownloaderResponse");
sendBye("UssdInterpreter Stopping. Unexpected State when receiving DownloaderResponse " + response.error());
sentBye = true;
}
fsm.transition(message, finished);
Expand Down

0 comments on commit 9ed6a3c

Please sign in to comment.