[Demonstration 1]

[Buggy Method]
@Override
public boolean equals(Object keyJoint) {
    try {
        if (getClass() != keyJoint.getClass())
            return false;
        else {
            KeyJoint other = (KeyJoint) keyJoint;
            if (this.keys == null && other.keys != null)
                return false;
            if (other.keys == null && this.keys != null)
                return false;
            if (this.keys == null && other.keys == null)
                return true;
            return this.keys.equals(other.getKeyJoint());
        }
    } catch (NullPointerException ex) {
        LOG.log(Level.INFO, ex.getMessage(), ex);
    }
    return false;
}

[Buggy Hunk]
if (getClass() != keyJoint.getClass())

[Patch]
if (keyJoint != null && getClass() != keyJoint.getClass())

[Demonstration 2]

[Buggy Method]
@Override
public Response toResponse(JsonProcessingException exception) {
    /*
         * If the error is in the JSON generation, it's a server error.
         */
    if (exception instanceof JsonGenerationException) {
        LOGGER.warn("Error generating JSON", exception);
        return Response.serverError().build();
    }
    final String message = exception.getOriginalMessage();
    /*
         * If we can't deserialize the JSON because someone forgot a no-arg
         * constructor, or it is not known how to serialize the type it's
         * a server error and we should inform the developer.
         */
    if (exception instanceof JsonMappingException && !(exception instanceof UnrecognizedPropertyException)) {
        LOGGER.error("Unable to serialize or deserialize the specific type", exception);
        return Response.serverError().build();
    }
    /*
         * Otherwise, it's those pesky users.
         */
    LOGGER.debug("Unable to process JSON", exception);
    final ErrorMessage errorMessage = new ErrorMessage(Response.Status.BAD_REQUEST.getStatusCode(), "Unable to process JSON", showDetails ? message : null);
    return Response.status(Response.Status.BAD_REQUEST).type(MediaType.APPLICATION_JSON_TYPE).entity(errorMessage).build();
}

[Buggy Hunk]
if (exception instanceof JsonMappingException && !(exception instanceof UnrecognizedPropertyException)) {

[Patch]
if (Throwables.getRootCause(exception).getClass() == JsonMappingException.class) {