diff --git a/core/src/main/java/io/undertow/server/handlers/form/MultiPartParserDefinition.java b/core/src/main/java/io/undertow/server/handlers/form/MultiPartParserDefinition.java index 1551bbb9fc..18d6a4796b 100644 --- a/core/src/main/java/io/undertow/server/handlers/form/MultiPartParserDefinition.java +++ b/core/src/main/java/io/undertow/server/handlers/form/MultiPartParserDefinition.java @@ -253,8 +253,6 @@ public FormData parseBlocking() throws IOException { } else { throw UndertowMessages.MESSAGES.failedToAllocateResource(); } - } catch (MalformedMessageException e) { - throw new IOException(e); } return exchange.getAttachment(FORM_DATA); } @@ -323,15 +321,12 @@ public void data(final ByteBuffer buffer) throws IOException { throw UndertowMessages.MESSAGES.maxFileSizeExceeded(this.maxIndividualFileSize); } if (file == null && fileSizeThreshold < this.currentFileSize && (fileName != null || this.currentFileSize > fieldSizeThreshold)) { - try { - createdFiles.add(createFile()); + createdFiles.add(createFile()); - FileOutputStream fileOutputStream = new FileOutputStream(file.toFile()); + try(FileOutputStream fileOutputStream = new FileOutputStream(file.toFile());){ contentBytes.writeTo(fileOutputStream); fileChannel = fileOutputStream.getChannel(); - } catch (IOException e) { - throw new RuntimeException(e); } } diff --git a/core/src/main/java/io/undertow/util/MultipartParser.java b/core/src/main/java/io/undertow/util/MultipartParser.java index 150db9fcb2..c08c73c315 100644 --- a/core/src/main/java/io/undertow/util/MultipartParser.java +++ b/core/src/main/java/io/undertow/util/MultipartParser.java @@ -384,11 +384,7 @@ public void handle(final PartHandler handler, final ByteBuffer rawData) throws I try { do { buf.clear(); - try { - decoder.decode(rawData, buf); - } catch (IOException e) { - throw new RuntimeException(e); - } + decoder.decode(rawData, buf); buf.flip(); handler.data(buf); } while (rawData.hasRemaining());