Source:
<code>public void handleEvent(HttpServletRequest request) throws GitLabApiException { if (!isValidSecretToken(request)) { String message = "X-Gitlab-Token mismatch!"; LOG.warning(message); throw new GitLabApiException(message); } String eventName = request.getHeader("X-Gitlab-Event"); LOG.info("handleEvent: X-Gitlab-Event=" + eventName); switch (eventName) { case BuildEvent.X_GITLAB_EVENT: case IssueEvent.X_GITLAB_EVENT: case MergeRequestEvent.X_GITLAB_EVENT: case NoteEvent.X_GITLAB_EVENT: case PipelineEvent.X_GITLAB_EVENT: case PushEvent.X_GITLAB_EVENT: case TagPushEvent.X_GITLAB_EVENT: case WikiPageEvent.X_GITLAB_EVENT: break; default: String message = "Unsupported X-Gitlab-Event, event Name=" + eventName; LOG.warning(message); throw new GitLabApiException(message); } try { Event event; if (LOG.isLoggable(Level.FINE)) { LOG.fine(HttpRequestUtils.getShortRequestDump(eventName + " webhook", true, request)); String postData = HttpRequestUtils.getPostDataAsString(request); LOG.fine("Raw POST data:\n" + postData); event = jacksonJson.unmarshal(Event.class, postData); LOG.fine(event.getObjectKind() + " event:\n" + jacksonJson.marshal(event) + "\n"); } else { InputStreamReader reader = new InputStreamReader(request.getInputStream()); event = jacksonJson.unmarshal(Event.class, reader); } fireEvent(event); } catch (IOException e) { LOG.warning("Error parsing JSON data, error=" + e.getMessage()); throw new GitLabApiException(e); } catch (Exception e) { <START> LOG.warning("Unexpected error reading JSON data, error=" + e.getMessage()); <END> throw new GitLabApiException(e); } }</code><technical_language>simplified removing other catch blocks, logged message more generic capture Exception remove catch (IOException e) block? this: LOG.warning("Unexpected error processing JSON data, error=" + e.getMessage());</technical_language>

Target:
public void handleEvent(HttpServletRequest request) throws GitLabApiException { if (!isValidSecretToken(request)) { String message = "X-Gitlab-Token mismatch!"; LOG.warning(message); throw new GitLabApiException(message); } String eventName = request.getHeader("X-Gitlab-Event"); LOG.info("handleEvent: X-Gitlab-Event=" + eventName); switch (eventName) { case BuildEvent.X_GITLAB_EVENT: case IssueEvent.X_GITLAB_EVENT: case MergeRequestEvent.X_GITLAB_EVENT: case NoteEvent.X_GITLAB_EVENT: case PipelineEvent.X_GITLAB_EVENT: case PushEvent.X_GITLAB_EVENT: case TagPushEvent.X_GITLAB_EVENT: case WikiPageEvent.X_GITLAB_EVENT: break; default: String message = "Unsupported X-Gitlab-Event, event Name=" + eventName; LOG.warning(message); throw new GitLabApiException(message); } try { Event event; if (LOG.isLoggable(Level.FINE)) { LOG.fine(HttpRequestUtils.getShortRequestDump(eventName + " webhook", true, request)); String postData = HttpRequestUtils.getPostDataAsString(request); LOG.fine("Raw POST data:\n" + postData); event = jacksonJson.unmarshal(Event.class, postData); LOG.fine(event.getObjectKind() + " event:\n" + jacksonJson.marshal(event) + "\n"); } else { InputStreamReader reader = new InputStreamReader(request.getInputStream()); event = jacksonJson.unmarshal(Event.class, reader); } fireEvent(event); } catch (Exception e) { LOG.warning("Error parsing JSON data, exception=" + e.getClass().getSimpleName() + ", error=" + e.getMessage()); throw new GitLabApiException(e); } }