[MGNLREST-369] BadRequestException is swallowed Created: 06/May/22 Updated: 23/Oct/23 Resolved: 18/Apr/23 |
|
| Status: | Closed |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | 2.2 |
| Fix Version/s: | 2.2.18 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Phong Le Quoc | Assignee: | Marek Strucka |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Issue Links: |
|
|||||||||||||||||||||||||
| Sub-Tasks: |
|
|||||||||||||||||||||||||
| Template: |
|
|||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
|||||||||||||||||||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
|||||||||||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
|||||||||||||||||||||||||
| Epic Link: | Headless Phase 2 | |||||||||||||||||||||||||
| Sprint: | DevX 35 | |||||||||||||||||||||||||
| Story Points: | 2 | |||||||||||||||||||||||||
| Team: | ||||||||||||||||||||||||||
| Work Started: | ||||||||||||||||||||||||||
| Approved: |
Yes
|
|||||||||||||||||||||||||
| Description |
|
If the lang param is invalid, I18nContainerRequestFilter throws BadRequestException, however, this exception is swallowed by PreMatchContainerRequestContext. The class expects the exception should be a child of IOException. public class I18nContainerRequestFilter implements ContainerRequestFilter { private Locale determineLocaleFromQueryParameter(MultivaluedMap<String, String> queryParameters) { ... if (!isValidLanguageTag(localeString)) { throw new BadRequestException(String.format("Language parameter: %s is not allowed", localeString)); } ... } } And class PreMatchContainerRequestContext ...{ public synchronized BuiltResponse filter() { RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(this.httpRequest); long totalTimestamp = tracingLogger.timestamp("REQUEST_FILTER_SUMMARY"); while(this.requestFilters != null && this.currentFilter < this.requestFilters.length) { ContainerRequestFilter filter = this.requestFilters[this.currentFilter++]; try { this.suspended = false; this.response = null; this.throwable = null; this.inFilter = true; long timestamp = tracingLogger.timestamp("REQUEST_FILTER"); filter.filter(this); tracingLogger.logDuration("REQUEST_FILTER", timestamp, new Object[]{filter}); } catch (IOException var10) { throw new ApplicationException(var10); } finally { this.inFilter = false; } ... } |