private static String buildMessage(String reason,String description,int statusCode,DruidQuery<?> druidQuery,Throwable cause,ObjectWriter objectWriter){
  String druidQueryString;
  try {
    druidQueryString=objectWriter.writeValueAsString(druidQuery);
  }
 catch (  JsonProcessingException jse) {
    try {
      druidQueryString=druidQuery.toString();
    }
 catch (    Exception e) {
      LOG.warn("Error invoking a druid query's toString.",e);
      druidQueryString="QUERY'S `toString` FAILED";
    }
    LOG.warn(String.format("Failed to serialize druid query %s",druidQueryString),jse);
  }
  return String.format("reason: %s, description: %s, statusCode: %d, druid query: %s, cause: %s",reason,description,statusCode,druidQueryString,cause);
}

private static String buildMessage ( String reason , String description , int statusCode , DruidQuery < ? > druidQuery , Throwable cause , ObjectWriter objectWriter ) { String druidQueryString ; try { druidQueryString = objectWriter . writeValueAsString ( druidQuery ) ; } catch ( JsonProcessingException jse ) { try { druidQueryString = druidQuery . toString ( ) ; } catch ( Exception e ) { LOG . warn ( "Error invoking a druid query's toString." , e ) ; druidQueryString = "QUERY'S `toString` FAILED" ; } LOG . warn ( String . format ( "Failed to serialize druid query %s" , druidQueryString ) , jse ) ; } return String . format ( "reason: %s, description: %s, statusCode: %d, druid query: %s, cause: %s" , reason , description , statusCode , druidQueryString , cause ) ; }
builds a message for this exception that is basically a straightforward serialization of its interesting state .
