Skip to content

Commit f6a2a01

Browse files
author
Stephane Landelle
committed
How come getting a length could result in an IOException?
1 parent feeeb7f commit f6a2a01

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ protected PartSource getSource() {
217217
* Return the length of the data.
218218
*
219219
* @return The length.
220-
* @throws IOException if an IO problem occurs
221220
*/
222-
protected long lengthOfData() throws IOException {
221+
protected long lengthOfData() {
223222
return source.getLength();
224223
}
225224

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,8 @@ protected int endOfHeaderLength() {
358358
* Return the length of the main content
359359
*
360360
* @return long The length.
361-
* @throws IOException If an IO problem occurs
362361
*/
363-
protected abstract long lengthOfData() throws IOException;
362+
protected abstract long lengthOfData();
364363

365364
/**
366365
* Write the end data to the output stream.
@@ -399,7 +398,7 @@ public void send(OutputStream out) throws IOException {
399398
* @return long The length.
400399
* @throws IOException If an IO problem occurs
401400
*/
402-
public long length() throws IOException {
401+
public long length() {
403402

404403
long lengthOfData = lengthOfData();
405404

@@ -501,9 +500,8 @@ public static void sendPart(OutputStream out, Part part, byte[] partBoundary) th
501500
*
502501
* @param parts The parts.
503502
* @return The total length
504-
* @throws IOException If an I/O error occurs while writing the parts.
505503
*/
506-
public static long getLengthOfParts(Part[] parts) throws IOException {
504+
public static long getLengthOfParts(Part[] parts) {
507505
return getLengthOfParts(parts, DEFAULT_BOUNDARY_BYTES);
508506
}
509507

@@ -516,7 +514,7 @@ public static long getLengthOfParts(Part[] parts) throws IOException {
516514
* @throws IOException If an I/O error occurs while writing the parts.
517515
* @since 3.0
518516
*/
519-
public static long getLengthOfParts(Part[] parts, byte[] partBoundary) throws IOException {
517+
public static long getLengthOfParts(Part[] parts, byte[] partBoundary) {
520518
if (parts == null) {
521519
throw new IllegalArgumentException("Parts may not be null");
522520
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ protected void sendData(OutputStream out) throws IOException {
110110
* Return the length of the data.
111111
*
112112
* @return The length of the data.
113-
* @throws IOException If an IO problem occurs
114113
*/
115-
protected long lengthOfData() throws IOException {
114+
protected long lengthOfData() {
116115
return getContent().length;
117116
}
118117

0 commit comments

Comments
 (0)