exceptionfactory commented on code in PR #6915:
URL: https://github.com/apache/nifi/pull/6915#discussion_r1093682251


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java:
##########
@@ -276,18 +274,17 @@ private Set<FlowFile> 
handleMultipartRequest(HttpServletRequest request, Process
         Set<FlowFile> flowFileSet = new HashSet<>();
         String tempDir = System.getProperty("java.io.tmpdir");
         request.setAttribute(Request.MULTIPART_CONFIG_ELEMENT, new 
MultipartConfigElement(tempDir, multipartRequestMaxSize, 
multipartRequestMaxSize, multipartReadBufferSize));
-        Collection<Part> requestParts = 
Collections.unmodifiableCollection(request.getParts());
-        final Iterator<Part> parts = requestParts.iterator();
         int i = 0;
-        while (parts.hasNext()) {
-            Part part = parts.next();
+        final Collection<Part> requestParts = request.getParts();
+        for (final Part part : requestParts) {
             FlowFile flowFile = session.create();
             try (OutputStream flowFileOutputStream = session.write(flowFile)) {
                 StreamUtils.copy(part.getInputStream(), flowFileOutputStream);
             }
             flowFile = saveRequestDetailsAsAttributes(request, session, 
foundSubject, foundIssuer, flowFile);
             flowFile = savePartDetailsAsAttributes(session, part, flowFile, i, 
requestParts.size());
             flowFileSet.add(flowFile);
+            part.delete();

Review Comment:
   Thanks @ChrisSamo632, that's a good suggestion. I pushed an update that 
iterates through the Parts in a finally block where the Servlet calls 
`handleMultipartRequest()`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to