reta commented on code in PR #3188:
URL: https://github.com/apache/cxf/pull/3188#discussion_r3372927837
##########
core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java:
##########
@@ -214,24 +214,25 @@ public static void
setStreamedAttachmentProperties(Message message, CachedOutput
}
Object maxSize =
message.getContextualProperty(AttachmentDeserializer.ATTACHMENT_MAX_SIZE);
- if (maxSize != null) {
- if (maxSize instanceof Number) {
- long size = ((Number) maxSize).longValue();
- if (size >= 0) {
- bos.setMaxSize(size);
- } else {
- LOG.warning("Max size value overflowed long. Do not set
max size!");
- }
- } else if (maxSize instanceof String) {
- try {
- bos.setMaxSize(Long.parseLong((String) maxSize));
- } catch (NumberFormatException e) {
- throw new IOException("Provided threshold String is not a
number", e);
- }
+ if (maxSize == null) {
+ maxSize = AttachmentDeserializer.DEFAULT_ATTACHMENT_MAX_SIZE;
+ }
+ if (maxSize instanceof Number) {
+ long size = ((Number) maxSize).longValue();
+ if (size >= 0) {
+ bos.setMaxSize(size);
} else {
- throw new IOException("The value set as " +
AttachmentDeserializer.ATTACHMENT_MAX_SIZE
- + " should be either an instance of Number or String");
+ LOG.warning("Max size value overflowed long. Do not set max
size!");
Review Comment:
Didn't even check old comments, but definitely could be better framed,
thanks @coheigea !
```
LOG.warning("The max size value is set to unlimited.");
```
--
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]