Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
robbinespu
Contributor
Contributor

Exception in routine but the job exit as 0

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

Labels (7)
1 Reply
Shicong_Hong
Employee
Employee

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