Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
For example, let say i create a routine that will pretty print JSON on log
package routines;
import org.apache.log4j.*;
import routines.system.JSONObject;
public class PrettyPrintJSON {
private static org.apache.log4j.Logger log = LogManager.getLogger(PrettyPrintJSON.class);
public static void print(String jsonPayload, String description) {
try {
JSONObject json = new JSONObject(jsonPayload); // Convert text to object
log.info(description + " JSON : \n" + json.toString(4));
} catch (Exception e) {
e.printStackTrace();
}
return;
}
}
So when I use this routine on Tjava or inside another routine that uses non JSON string
String json ="sorry I not JSON man!";
PrettyPrintJSON.print(json,"Wakanda create case payload");
Seem the job still keep continue running and exit with status 0.
I expecting it to stop or exits with status 1
Hi
I think this is because you use try-catch block in your code. If you remove it, the job will thrown out the Java exception and stop to execute with status 1.
Regards
Shicong