Skip to content

Commit d93e2fd

Browse files
authored
Change getSize() return type from int to long #818 (#819)
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
1 parent 82f1e48 commit d93e2fd

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

api/src/main/java/jakarta/mail/Part.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,33 @@ public interface Part {
8888
* user interface to give the user a rough idea of the size
8989
* of this part.
9090
*
91+
* @deprecated Since Jakarta Mail 2.2.0. Use {@link #getSizeLong()}
92+
* instead.
9193
* @return size of content in bytes
9294
* @throws MessagingException for failures
9395
*/
96+
@Deprecated(since = "2.2.0", forRemoval = true)
9497
int getSize() throws MessagingException;
9598

99+
/**
100+
* Return the size of the content of this part in bytes.
101+
* Returns -1 if the size cannot be determined. <p>
102+
*
103+
* Note that the size may not be an exact measure of the content
104+
* size and may or may not account for any transfer encoding
105+
* of the content. The size is appropriate for display in a
106+
* user interface to give the user a rough idea of the size
107+
* of this part.
108+
*
109+
* @return size of content in bytes, or -1 if unknown
110+
* @throws MessagingException for failures
111+
* @since Jakarta Mail 2.2.0
112+
*/
113+
@SuppressWarnings("deprecation")
114+
default long getSizeLong() throws MessagingException {
115+
return getSize();
116+
}
117+
96118
/**
97119
* Return the number of lines in the content of this part.
98120
* Return -1 if the number cannot be determined.

doc/release/CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ E 744 Remove SecurityManager reference from API
2727
E 758 Improve MimeMessage UTF8 handling
2828
E 804 Restore streamProvider fields for backwards compatibility
2929
E 810 InternetHeaders.InternetHeader toString()
30+
E 818 Change getSize() return type from int to long
3031

3132
CHANGES IN THE 2.1.5 RELEASE
3233
----------------------------

0 commit comments

Comments
 (0)