Skip to content

APT NPE with empty controllers #3656

@csisy

Description

@csisy

Hello,

just updated to jooby 3.x from 2.x and now, we're getting a NPE during build in a very special case.

We have controllers that are potentially empty from a routing perspective (aka. it doesn't contain any route-related method) but they inherit from another class (which is also routing-irrelevant). In short, we have FooController extends AbstractBarController with 0 routing-related method.

In this case, the following code runs:

registry.computeIfAbsent(currentType, key -> new MvcRouter(key, registry.get(superType)));

This however assumes that the super type is actually a valid controller since it tries to read it from the registry without any explicit check. This results in a NPE inside the constructor of the MvcRouter.

I think the registry should also be checked if it contains the superType.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions