Source:
<code>public void handle(ChannelHandlerContext ctx, HttpRequest request) { Tracker.getInstance().track(request); final Timer.Context timerContext = handlerTimer.time(); final String body = request.getContent().toString(Constants.DEFAULT_CHARSET); try { requestCount.inc(); MetricsCollection collection = new MetricsCollection(); AggregatedPayload payload = createPayload( body ); List<String> errors = payload.getValidationErrors(); if ( errors.isEmpty() ) { collection.add( PreaggregateConversions.buildMetricsCollection( payload ) ); ListenableFuture<List<Boolean>> futures = processor.apply( collection ); List<Boolean> persisteds = futures.get( timeout.getValue(), timeout.getUnit() ); for ( Boolean persisted : persisteds ) { if ( !persisted ) { DefaultHandler.sendResponse( ctx, request, null, HttpResponseStatus.INTERNAL_SERVER_ERROR ); return; } } DefaultHandler.sendResponse( ctx, request, null, HttpResponseStatus.OK ); } else { DefaultHandler.sendResponse( ctx, request, HttpMetricsIngestionHandler.getResponseBody( errors ), HttpResponseStatus.BAD_REQUEST ); } <START> } catch (JsonSyntaxException ex) { <END> log.debug(String.format("BAD JSON: %s", body)); log.error(ex.getMessage(), ex); DefaultHandler.sendResponse(ctx, request, "Failed parsing Json content: " + ex.getMessage(), HttpResponseStatus.BAD_REQUEST); } catch (ConnectionException ex) { log.error(ex.getMessage(), ex); DefaultHandler.sendResponse(ctx, request, "Internal error saving data", HttpResponseStatus.INTERNAL_SERVER_ERROR); } catch (TimeoutException ex) { DefaultHandler.sendResponse(ctx, request, "Timed out persisting metrics", HttpResponseStatus.ACCEPTED); } catch (Exception ex) { log.debug(String.format("BAD JSON: %s", body)); log.error("Other exception while trying to parse content", ex); DefaultHandler.sendResponse(ctx, request, "Failed parsing content: " + ex.getMessage(), HttpResponseStatus.INTERNAL_SERVER_ERROR); } finally { requestCount.dec(); timerContext.stop(); } }</code><technical_language>put catch (JsonParseException ex)</technical_language>

Target:
public void handle(ChannelHandlerContext ctx, HttpRequest request) { Tracker.getInstance().track(request); final Timer.Context timerContext = handlerTimer.time(); final String body = request.getContent().toString(Constants.DEFAULT_CHARSET); try { requestCount.inc(); MetricsCollection collection = new MetricsCollection(); AggregatedPayload payload = createPayload( body ); List<String> errors = payload.getValidationErrors(); if ( errors.isEmpty() ) { collection.add( PreaggregateConversions.buildMetricsCollection( payload ) ); ListenableFuture<List<Boolean>> futures = processor.apply( collection ); List<Boolean> persisteds = futures.get( timeout.getValue(), timeout.getUnit() ); for ( Boolean persisted : persisteds ) { if ( !persisted ) { DefaultHandler.sendResponse( ctx, request, null, HttpResponseStatus.INTERNAL_SERVER_ERROR ); return; } } DefaultHandler.sendResponse( ctx, request, null, HttpResponseStatus.OK ); } else { DefaultHandler.sendResponse( ctx, request, HttpMetricsIngestionHandler.getResponseBody( errors ), HttpResponseStatus.BAD_REQUEST ); } } catch (JsonParseException ex) { log.debug(String.format("BAD JSON: %s", body)); log.error(ex.getMessage(), ex); DefaultHandler.sendResponse(ctx, request, ex.getMessage(), HttpResponseStatus.BAD_REQUEST); } catch (ConnectionException ex) { log.error(ex.getMessage(), ex); DefaultHandler.sendResponse(ctx, request, "Internal error saving data", HttpResponseStatus.INTERNAL_SERVER_ERROR); } catch (TimeoutException ex) { DefaultHandler.sendResponse(ctx, request, "Timed out persisting metrics", HttpResponseStatus.ACCEPTED); } catch (Exception ex) { log.debug(String.format("BAD JSON: %s", body)); log.error("Other exception while trying to parse content", ex); DefaultHandler.sendResponse(ctx, request, "Failed parsing content", HttpResponseStatus.INTERNAL_SERVER_ERROR); } finally { requestCount.dec(); timerContext.stop(); } }