ivandika3 commented on code in PR #6609:
URL: https://github.com/apache/ozone/pull/6609#discussion_r1587427643


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/CompleteMultipartUploadRequestUnmarshaller.java:
##########
@@ -43,19 +43,7 @@
 public class CompleteMultipartUploadRequestUnmarshaller
     implements MessageBodyReader<CompleteMultipartUploadRequest> {
 
-  private final JAXBContext context;
-  private final XMLReader xmlReader;
-
   public CompleteMultipartUploadRequestUnmarshaller() {
-    try {
-      context = JAXBContext.newInstance(CompleteMultipartUploadRequest.class);
-      SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
-      saxParserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, 
true);
-      xmlReader = saxParserFactory.newSAXParser().getXMLReader();
-    } catch (Exception ex) {
-      throw new AssertionError("Can not instantiate " +
-          "CompleteMultipartUploadRequest parser", ex);
-    }

Review Comment:
   We might also need to change for `PutBucketAclRequestUnmarshaller` since it 
has a similar pattern (although not used as often).



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/MultiDeleteRequestUnmarshaller.java:
##########
@@ -68,6 +56,10 @@ public MultiDeleteRequest readFrom(Class<MultiDeleteRequest> 
type,
       Type genericType, Annotation[] annotations, MediaType mediaType,
       MultivaluedMap<String, String> httpHeaders, InputStream entityStream) {
     try {
+      JAXBContext context = JAXBContext.newInstance(MultiDeleteRequest.class);
+      SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+      saxParserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, 
true);

Review Comment:
   We might not need to instantiate this for every request. Could you help 
check whether instantiating only `XMLReader` for each request is enough?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to