You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2020/10/12 14:11:18 UTC

[GitHub] [cxf] andymc12 commented on a change in pull request #707: [CXF-8353] MediaType validation

andymc12 commented on a change in pull request #707:
URL: https://github.com/apache/cxf/pull/707#discussion_r503323101



##########
File path: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
##########
@@ -190,4 +190,35 @@ private static MediaType handleMediaTypeWithoutSubtype(String mType) {
         }
         throw new IllegalArgumentException("Media type separator is missing");
     }
+
+    // Determines whether the type or subtype contains any of the tspecials characters defined at:
+    // https://tools.ietf.org/html/rfc2045#section-5.1
+    private static boolean isValid(String str) {
+        final int len = str.length();

Review comment:
       @reta - sounds good.  Since we end up trimming both type and subType at lines 114 and 115, I moved those trims to before the `isValid` method is called (to lines 88 and 89).  Let me know if you'd prefer the trim to be in isValid instead.  Otherwise, I'll plan to merge this later today.  Thanks for the review!




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org