Skip to content

Conversation

@PhilippeVienne
Copy link
Contributor

Type of PR: Bug resolution
Kind of bug: Null pointer on web hook event types
Solution: https://stackoverflow.com/questions/33611199/jackson-jsontypeinfo-property-is-being-mapped-as-null

It allows the following usage:

    @Override
    public void onProjectEvent(ProjectSystemHookEvent event) {
        switch (event.getEventName()) {
            case ProjectSystemHookEvent.PROJECT_CREATE_EVENT:
                log.info("Project created {}", event.getName());
                break;
            case ProjectSystemHookEvent.PROJECT_DESTROY_EVENT:
                log.info("Project destroyed {}", event.getName());
                break;
        }
    }

@gmessner gmessner merged commit b25df34 into gitlab4j:master May 20, 2019
@gmessner
Copy link
Collaborator

@PhilippeVienne
Nice find. I have merged the PR, will include on the next release which should be in the next 1-2 days.

I have to say Jackson sure picked an unusual way to do this, not passing a field down to the deserializer by default because it was used in type selection seems a bit odd, It does indicate this as the behavior if you thoroughly read the Javadocs on @JsonTypeInfo (https://fasterxml.github.io/jackson-annotations/javadoc/2.9/com/fasterxml/jackson/annotation/JsonTypeInfo.html), they should consider making visible true by default, as many people have run into this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants