Skip to content

Commit 01f03d3

Browse files
committed
[UNDERTOW-2617] remove unecessary exception wrapping in MultiPart
1 parent 47e1b06 commit 01f03d3

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

core/src/main/java/io/undertow/server/handlers/form/MultiPartParserDefinition.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,6 @@ public FormData parseBlocking() throws IOException {
253253
} else {
254254
throw UndertowMessages.MESSAGES.failedToAllocateResource();
255255
}
256-
} catch (MalformedMessageException e) {
257-
throw new IOException(e);
258256
}
259257
return exchange.getAttachment(FORM_DATA);
260258
}
@@ -323,16 +321,13 @@ public void data(final ByteBuffer buffer) throws IOException {
323321
throw UndertowMessages.MESSAGES.maxFileSizeExceeded(this.maxIndividualFileSize);
324322
}
325323
if (file == null && fileSizeThreshold < this.currentFileSize && (fileName != null || this.currentFileSize > fieldSizeThreshold)) {
326-
try {
327-
createdFiles.add(createFile());
324+
createdFiles.add(createFile());
328325

329-
FileOutputStream fileOutputStream = new FileOutputStream(file.toFile());
330-
contentBytes.writeTo(fileOutputStream);
326+
FileOutputStream fileOutputStream = new FileOutputStream(file.toFile());
327+
contentBytes.writeTo(fileOutputStream);
328+
329+
fileChannel = fileOutputStream.getChannel();
331330

332-
fileChannel = fileOutputStream.getChannel();
333-
} catch (IOException e) {
334-
throw new RuntimeException(e);
335-
}
336331
}
337332

338333
if (file == null) {

core/src/main/java/io/undertow/util/MultipartParser.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,7 @@ public void handle(final PartHandler handler, final ByteBuffer rawData) throws I
384384
try {
385385
do {
386386
buf.clear();
387-
try {
388-
decoder.decode(rawData, buf);
389-
} catch (IOException e) {
390-
throw new RuntimeException(e);
391-
}
387+
decoder.decode(rawData, buf);
392388
buf.flip();
393389
handler.data(buf);
394390
} while (rawData.hasRemaining());

0 commit comments

Comments
 (0)