@@ -187,7 +187,7 @@ public ArrayList<MediaType> accepts() {
187187 */
188188 public void error (final int code , final String info ) throws IOException {
189189 log (code , info );
190- status (code , null , info );
190+ status (code , info );
191191 }
192192
193193 /**
@@ -304,19 +304,17 @@ void stop(final JobException ex) throws IOException {
304304 response .getOutputStream ().write (token (info ));
305305 } catch (final IllegalStateException e ) {
306306 // too late (response has already been committed)
307- logError (code , null , info , e );
307+ logError (code , info , e );
308308 }
309309 }
310310
311311 /**
312312 * Sets a status and sends an info message.
313313 * @param code status code
314- * @param message status message (can be {@code null})
315314 * @param body message for response body (can be {@code null})
316315 * @throws IOException I/O exception
317316 */
318- @ SuppressWarnings ("deprecation" )
319- public void status (final int code , final String message , final String body ) throws IOException {
317+ public void status (final int code , final String body ) throws IOException {
320318 try {
321319 response .resetBuffer ();
322320 if (code == SC_UNAUTHORIZED && !response .containsHeader (WWW_AUTHENTICATE )) {
@@ -330,21 +328,13 @@ public void status(final int code, final String message, final String body) thro
330328 response .setHeader (WWW_AUTHENTICATE , header .toString ());
331329 }
332330
333- final int c = code < 0 || code > 999 ? 500 : code ;
334- if (message == null ) {
335- response .setStatus (c );
336- } else {
337- // do not allow Jetty to create a custom error html page
338- // control characters and non-ASCII codes will be removed (GH-1632)
339- response .setStatus (c , message .replaceAll ("[^\\ x20-\\ x7F]" , "?" ));
340- }
341-
331+ response .setStatus (code < 0 || code > 999 ? 500 : code );
342332 if (body != null ) {
343333 response .setContentType (MediaType .TEXT_PLAIN + "; " + CHARSET + '=' + Strings .UTF8 );
344334 response .getOutputStream ().write (new TokenBuilder (token (body )).normalize ().finish ());
345335 }
346336 } catch (final IllegalStateException | IllegalArgumentException ex ) {
347- logError (code , message , body , ex );
337+ logError (code , body , ex );
348338 }
349339 }
350340
@@ -589,17 +579,13 @@ private String getRemoteAddr() {
589579 /**
590580 * Sets a status and sends an info message.
591581 * @param code status code
592- * @param message status message (can be {@code null})
593582 * @param info detailed information (can be {@code null})
594583 * @param ex exception
595584 */
596- private void logError (final int code , final String message , final String info ,
597- final Exception ex ) {
598-
585+ private void logError (final int code , final String info , final Exception ex ) {
599586 final StringBuilder sb = new StringBuilder ();
600587 sb .append ("Code: " ).append (code );
601588 if (info != null ) sb .append (", Info: " ).append (info );
602- if (message != null ) sb .append (", Message: " ).append (message );
603589 sb .append (", Error: " ).append (Util .message (ex ));
604590 log (SC_INTERNAL_SERVER_ERROR , sb .toString ());
605591 }
0 commit comments