Skip to content

Commit 3a2a6d6

Browse files
author
Stephane Landelle
committed
Part length is long, not int
1 parent 44480ab commit 3a2a6d6

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/main/java/com/ning/http/multipart/FilePart.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ protected void sendDispositionHeader(OutputStream out) throws IOException {
156156
}
157157
}
158158

159-
protected int dispositionHeaderLength() {
159+
protected long dispositionHeaderLength() {
160160
String filename = this.source.getFileName();
161-
int length = super.dispositionHeaderLength();
161+
long length = super.dispositionHeaderLength();
162162
if (filename != null) {
163163
length += FILE_NAME_BYTES.length;
164164
length += QUOTE_BYTES.length;

src/main/java/com/ning/http/multipart/MultipartRequestEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public long getContentLength() {
134134
return Part.getLengthOfParts(parts, multipartBoundary);
135135
} catch (Exception e) {
136136
log.error("An exception occurred while getting the length of the parts", e);
137-
return 0;
137+
return 0L;
138138
}
139139
}
140140

src/main/java/com/ning/http/multipart/Part.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ protected void sendDispositionHeader(OutputStream out) throws IOException {
231231
}
232232
}
233233

234-
protected int dispositionHeaderLength() {
235-
int length = 0;
234+
protected long dispositionHeaderLength() {
235+
long length = 0L;
236236
if (getName() != null) {
237237
length += CRLF_BYTES.length;
238238
length += CONTENT_DISPOSITION_BYTES.length;
@@ -263,8 +263,8 @@ protected void sendContentTypeHeader(OutputStream out) throws IOException {
263263
}
264264
}
265265

266-
protected int contentTypeHeaderLength() {
267-
int length = 0;
266+
protected long contentTypeHeaderLength() {
267+
long length = 0L;
268268
String contentType = getContentType();
269269
if (contentType != null) {
270270
length += CRLF_BYTES.length;
@@ -294,8 +294,8 @@ protected void sendTransferEncodingHeader(OutputStream out) throws IOException {
294294
}
295295
}
296296

297-
protected int transferEncodingHeaderLength() {
298-
int length = 0;
297+
protected long transferEncodingHeaderLength() {
298+
long length = 0L;
299299
String transferEncoding = getTransferEncoding();
300300
if (transferEncoding != null) {
301301
length += CRLF_BYTES.length;
@@ -320,8 +320,8 @@ protected void sendContentIdHeader(OutputStream out) throws IOException {
320320
}
321321
}
322322

323-
protected int contentIdHeaderLength() {
324-
int length = 0;
323+
protected long contentIdHeaderLength() {
324+
long length = 0L;
325325
String contentId = getContentId();
326326
if (contentId != null) {
327327
length += CRLF_BYTES.length;
@@ -342,7 +342,7 @@ protected void sendEndOfHeader(OutputStream out) throws IOException {
342342
out.write(CRLF_BYTES);
343343
}
344344

345-
protected int endOfHeaderLength() {
345+
protected long endOfHeaderLength() {
346346
return CRLF_BYTES.length * 2;
347347
}
348348

@@ -371,7 +371,7 @@ protected void sendEnd(OutputStream out) throws IOException {
371371
out.write(CRLF_BYTES);
372372
}
373373

374-
protected int endLength() {
374+
protected long endLength() {
375375
return CRLF_BYTES.length;
376376
}
377377

@@ -402,8 +402,8 @@ public long length() {
402402

403403
long lengthOfData = lengthOfData();
404404

405-
if (lengthOfData < 0) {
406-
return -1;
405+
if (lengthOfData < 0L) {
406+
return -1L;
407407
} else {
408408
return lengthOfData//
409409
+ startLength()//

0 commit comments

Comments
 (0)