You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "reta (via GitHub)" <gi...@apache.org> on 2026/06/06 19:34:23 UTC
[PR] Add sensible default value to attachment-max-size property [cxf]
reta opened a new pull request, #3188:
URL: https://github.com/apache/cxf/pull/3188
Add sensible (50Mb) default value to `attachment-max-size` property
--
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: dev-unsubscribe@cxf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add sensible default value to attachment-max-size property [cxf]
Posted by "reta (via GitHub)" <gi...@apache.org>.
reta merged PR #3188:
URL: https://github.com/apache/cxf/pull/3188
--
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: dev-unsubscribe@cxf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add sensible default value to attachment-max-size property [cxf]
Posted by "reta (via GitHub)" <gi...@apache.org>.
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: dev-unsubscribe@cxf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add sensible default value to attachment-max-size property [cxf]
Posted by "coheigea (via GitHub)" <gi...@apache.org>.
coheigea commented on code in PR #3188:
URL: https://github.com/apache/cxf/pull/3188#discussion_r3371377030
##########
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:
Maybe we could change this warning message - I'm not sure what "Do not set max size!" means exactly? Maybe we should print the maximum allowed value?
--
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: dev-unsubscribe@cxf.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org