Git Product home page Git Product logo

Comments (5)

wilkinsona avatar wilkinsona commented on May 18, 2024

@joakime Thanks for opening this and #82.

In Jetty 9.2.14, we throw a IllegalStateException, which isn't what Spring is expecting.

It's not so much the Spring doesn't expect an IllegalStateException, but that the exception doesn't happen at the same time as it does when using Tomcat. Very early in the handling of a request, DispatcherServlet tries to create a StandardMultipartHttpServletRequest. It tries to retrieve all of the request's parts. Any exception that's thrown at this stage will be wrapped in a MultipartException. Tomcat throws an exception at this point but Jetty does not.

from jetty.project.

janbartel avatar janbartel commented on May 18, 2024

Related bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=455655

Jetty parses the multipart data either when one of the Request.getParameter/s() methods are called, or when Request.getParts() is called. If an exception happens during the parsing as a result of calling Request.getParameter/s() it was difficult to communicate that back to the client, due to the signature of getParameter/s(), so we added a throw of a RuntimeException to wrap the real exception.

So to clarify, I expect the current behaviour for jetty to be:

  • if parsing initiated on a call to getParameter/s() then log the Exception and throw it wrapped in a RuntimeException. Subsequent calls to getParameter/s() will not throw, and neither would subsequent calls to getPart/s().
  • if parsing initiated on a call to getPart/s() then an exception would be thrown. Subsequent calls to getPart/s() or getParameter/s() would not throw an exception.

So if I understand the bug report correctly, you're asking that if an exception occurs during multipart parsing, you want that exception returned every time getPart/s() is called? So that even if your code causes the parsing by calling getParameter/s() initially and the RuntimeException is thrown, your code is still likely to go on to call getPart/s() and you want the IOException or ServletException at that time, yes?

from jetty.project.

janbartel avatar janbartel commented on May 18, 2024

Assuming my understanding of the issue is correct as per my previous message, I've pushed a fix for this to the jetty-9.3.x branch: 11d3448

If you'd like to test it out, that would be great.

from jetty.project.

joakime avatar joakime commented on May 18, 2024

The bug was reported against Jetty 9.2.x, can this fix be cherry-picked back to the jetty-9.2.x branch?

from jetty.project.

wilkinsona avatar wilkinsona commented on May 18, 2024

@janbartel The latest 9.3.8 snapshot looks good. Thank you. The IllegalStateException is now thrown as part of Spring's DispatcherServlet's checkMultipart processing which gives it a chance to catch it and wrap it in a MultipartException.

from jetty.project.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.