Skip to content

Commit

Permalink
[UNDERTOW-2446] HttpServletRequestImpl.getParts shouldn't throw excep…
Browse files Browse the repository at this point in the history
…tion after already loading parts
  • Loading branch information
aogburn authored and fl4via committed Oct 16, 2024
1 parent 0ef8d7c commit b3ede9c
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ public void logout() throws ServletException {

@Override
public Collection<Part> getParts() throws IOException, ServletException {
verifyMultipartServlet();
if (parts == null) {
loadParts();
}
Expand All @@ -570,11 +569,7 @@ private void verifyMultipartServlet() {

@Override
public Part getPart(final String name) throws IOException, ServletException {
verifyMultipartServlet();
if (parts == null) {
loadParts();
}
for (Part part : parts) {
for (Part part : getParts()) {
if (part.getName().equals(name)) {
return part;
}
Expand All @@ -600,6 +595,7 @@ private void loadParts() throws IOException, ServletException {
final ServletRequestContext requestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);

if (parts == null) {
verifyMultipartServlet();
final List<Part> parts = new ArrayList<>();
String mimeType = exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE);
if (mimeType != null && mimeType.startsWith(MultiPartParserDefinition.MULTIPART_FORM_DATA)) {
Expand Down

0 comments on commit b3ede9c

Please sign in to comment.