Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
BZ-1002054 - If simulation engine failed then regular user does not k…
Browse files Browse the repository at this point in the history
…now why

(cherry picked from commit 7aca544)
  • Loading branch information
mswiderski committed Oct 14, 2013
1 parent 9ade4c4 commit 794e0ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Expand Up @@ -427,15 +427,14 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
parentJSON.put("pathsim", processPathsJSONArray);
}

PrintWriter pw = resp.getWriter();
PrintWriter pw = resp.getWriter();
resp.setContentType("text/json");
resp.setCharacterEncoding("UTF-8");
pw.write(parentJSON.toString());

} catch (Exception e) {
PrintWriter pw = resp.getWriter();
resp.setContentType("text/json");
resp.setCharacterEncoding("UTF-8");
pw.write("{}");
_logger.error("Error during simulation", e);
resp.sendError(HttpServletResponse.SC_NO_CONTENT, e.getMessage());
}

}
Expand Down
Expand Up @@ -464,16 +464,16 @@ ORYX.Plugins.Simulation = Clazz.extend({
method: 'POST',
success: function(response) {
try {
if(response.responseText && response.responseText.length > 0 && response.responseText != "{}") {
if(response.responseText && response.responseText.length > 0 && response.status == 200) {
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_SIMULATION_SHOW_RESULTS,
results: response.responseText
});
} else {
this.facade.raiseEvent({
type : ORYX.CONFIG.EVENT_NOTIFICATION_SHOW,
ntype : 'info',
msg : 'Simulation engine did not return results.',
ntype : 'error',
msg : 'Simulation engine did not return results:\n' + response.statusText,
title : ''

});
Expand Down

0 comments on commit 794e0ac

Please sign in to comment.