@SuppressWarnings("static-access")
	public static String doErrorJSON(HttpServletRequest request,HttpServletResponse response, 
			IMSJSONRequest json, String message, Exception e) 
		throws java.io.IOException {
    """
	/* IMS JSON version of Errors - does the complet request - returns the JSON in case
	the code above us wants to log it.
    """
		response.setContentType(APPLICATION_JSON);
		Map<String, Object> jsonResponse = new TreeMap<String, Object>();

		Map<String, String> status = null;
		if ( json == null ) {
			status = IMSJSONRequest.getStatusFailure(message);
		} else {
			status = json.getStatusFailure(message);
			if ( json.base_string != null ) {
				jsonResponse.put("base_string", json.base_string);
			}
		}
		jsonResponse.put(IMSJSONRequest.STATUS, status);
		if ( e != null ) {
			jsonResponse.put("exception", e.getLocalizedMessage());
			try {
				StringWriter sw = new StringWriter();
				PrintWriter pw = new PrintWriter(sw, true);
				e.printStackTrace(pw);
				pw.flush();
				sw.flush();
				jsonResponse.put("traceback", sw.toString() );
			} catch ( Exception f ) {
				jsonResponse.put("traceback", f.getLocalizedMessage());
			}
		}
		String jsonText = JSONValue.toJSONString(jsonResponse);
		PrintWriter out = response.getWriter();
		out.println(jsonText);
		return jsonText;
	}
@SuppressWarnings("static-access")
	public static String doErrorJSON(HttpServletRequest request,HttpServletResponse response, 
			IMSJSONRequest json, String message, Exception e) 
		throws java.io.IOException 
	{
		response.setContentType(APPLICATION_JSON);
		Map<String, Object> jsonResponse = new TreeMap<String, Object>();

		Map<String, String> status = null;
		if ( json == null ) {
			status = IMSJSONRequest.getStatusFailure(message);
		} else {
			status = json.getStatusFailure(message);
			if ( json.base_string != null ) {
				jsonResponse.put("base_string", json.base_string);
			}
		}
		jsonResponse.put(IMSJSONRequest.STATUS, status);
		if ( e != null ) {
			jsonResponse.put("exception", e.getLocalizedMessage());
			try {
				StringWriter sw = new StringWriter();
				PrintWriter pw = new PrintWriter(sw, true);
				e.printStackTrace(pw);
				pw.flush();
				sw.flush();
				jsonResponse.put("traceback", sw.toString() );
			} catch ( Exception f ) {
				jsonResponse.put("traceback", f.getLocalizedMessage());
			}
		}
		String jsonText = JSONValue.toJSONString(jsonResponse);
		PrintWriter out = response.getWriter();
		out.println(jsonText);
		return jsonText;
	}
@ SuppressWarnings ( "static-access" ) public static String doErrorJSON ( HttpServletRequest request , HttpServletResponse response , IMSJSONRequest json , String message , Exception e ) throws java . io . IOException { response . setContentType ( APPLICATION_JSON ) ; Map < String , Object > jsonResponse = new TreeMap < String , Object > ( ) ; Map < String , String > status = null ; if ( json == null ) { status = IMSJSONRequest . getStatusFailure ( message ) ; } else { status = json . getStatusFailure ( message ) ; if ( json . base_string != null ) { jsonResponse . put ( "base_string" , json . base_string ) ; } } jsonResponse . put ( IMSJSONRequest . STATUS , status ) ; if ( e != null ) { jsonResponse . put ( "exception" , e . getLocalizedMessage ( ) ) ; try { StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw , true ) ; e . printStackTrace ( pw ) ; pw . flush ( ) ; sw . flush ( ) ; jsonResponse . put ( "traceback" , sw . toString ( ) ) ; } catch ( Exception f ) { jsonResponse . put ( "traceback" , f . getLocalizedMessage ( ) ) ; } } String jsonText = JSONValue . toJSONString ( jsonResponse ) ; PrintWriter out = response . getWriter ( ) ; out . println ( jsonText ) ; return jsonText ; }
/* IMS JSON version of Errors - does the complet request - returns the JSON in case
the code above us wants to log it.
/ * IMS JSON version of Errors - does the complet request - returns the JSON in case the code above us wants to log it .