plusplusjiajia opened a new pull request, #9454:
URL: https://github.com/apache/paimon/pull/9454

   ### Purpose
     A server's error message is data, but DefaultErrorHandler hands it to 
java.util.Formatter as syntax. When the message contains a %, translating the 
response throws MissingFormatArgumentException instead of the REST exception 
the caller waits for, so catch (BadRequestException) never runs and the 
server's message is lost.
   
     message: quota 80% exceeded
     before : java.util.MissingFormatArgumentException: Format specifier '% e'
     after  : BadRequestException: quota 80% exceeded
   
     Two things combine to cause it:
   
     - Four of the eight exception classes format twice. 
NotAuthorizedException, ServiceFailureException, NotImplementedException and 
ServiceUnavailableException call super(String.format(message, args)), and 
RESTException formats again — the inner call consumes the arguments, leaving 
the outer one a substituted string and none. The other four already pass 
super(message, args).
     - Two call sites pass the message as the format. case 400 wraps it in 
String.format("%s", message), which reads like a guard but returns the message 
unchanged for the constructor to format; case 501 passes it straight through. 
The other seven branches already pass "%s" with the message as an argument.
   
     RESTCatalog.listSystemTablesPaged has the same shape and also drops the 
IllegalArgumentException explaining the rejection. RESTException has a 
cause-carrying constructor but no subclass exposes one, so this adds it to 
BadRequestException — the only subclass with a caller that needs it today.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to