When output sql and format sql are selected the BasicFormatterImpl spawns a thread to process logging the sql query. That process iterates through identifying tokens and appropriately formatting the output. If the SQL query starts with a parenthesis (valid according to the SQL spec) it passes to a method to handle open parenthesis. That method expects there to be a lastToken and attempts to get the first character of a null string throwing a NullPointerException and takes down the currently running session in Tomcat/Spring. This is most likely to affect development simply because you would never output SQL in a production environment. I was able to refactor the SQL that generated the exception to not use a starting parenthesis, but the code is significantly less readable because it is quite long with multiple nested queries and unions.
|