Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in AbstractHandlerMethodMapping when trace logging is enabled and a handler's class loader does not provide package information #22306

Closed
wilkinsona opened this issue Jan 24, 2019 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: regression A bug that is also a regression
Milestone

Comments

@wilkinsona
Copy link
Member

Affects: 5.1.4.RELEASE

In the unlikely event of trace logging being enabled and a handler's class having been loaded by a class loader that does not provide package information, Class.getPackage() will return null and the following line will NPE:

String formattedType = Arrays.stream(userType.getPackage().getName().split("\\."))

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 24, 2019
@jhoeller jhoeller self-assigned this Jan 25, 2019
@jhoeller jhoeller added type: bug A general bug type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged or decided on type: bug A general bug labels Jan 25, 2019
@jhoeller jhoeller added this to the 5.1.5 milestone Jan 25, 2019
@jhoeller
Copy link
Contributor

Good catch! I've also adapted the logger initialization code in DecoderHttpMessageReader and EncoderHttpMessageReader accordingly, avoiding Class.getPackage() in favor of ClassUtils.getPackageName(Class) or plain Class.getName() checks.

@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

4 participants