Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-369

BadRequestException is swallowed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 2.2.18
    • 2.2
    • None
    • None

    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;
              }
      ...
      }

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                mstrucka Marek Strucka
                plequoc Phong Le Quoc
                DeveloperX
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Work Started:

                  Checklists

                    Bug DoR
                    Task DoD