Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ZoneIdEditor throws wrong exception type forTypeConverterSupport #33545

Closed
Assignees
jhoeller
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug
Milestone
@harmonic-ben

Description

@harmonic-ben

Spring Framework Version: Latest (6.1.13) and below

spring-beans/src/main/java/org/springframework/beans/propertyeditors/ZoneIdEditor.java callsZoneId.of which throws ajava.time.DateTimeException.

Butorg.springframework.beans.TypeConverterSupport.convertIfNecessary(String, Object, Class<T>, TypeDescriptor) is expecting anIllegalArgumentException.

This manifests in a variety of ways. Best example is inweb-mvc assuming a controller with:

@GetMapping("/")publicvoidget(@RequestParam(name ="integer",required =false)intinteger,@RequestParam(name ="zoneId")ZoneIdzoneId) {    }

This means aget request of/?integer=helloworld results in aMethodArgumentTypeMismatchException which can easily be bound to 400 response.

However aget request of/?zoneId=helloworld results in aDateTimeException which binds to 500 response.

The integer parameter binding works because it throwsNumberFormatException which extends fromIllegalArgumentException.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp