Skip to content

Commit

Permalink
[tck] saveFile should overwrite existing file
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed May 2, 2023
1 parent ad22fb3 commit 386650a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/src/main/java/jakarta/mail/internet/MimeBodyPart.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
Expand Down Expand Up @@ -947,7 +948,7 @@ public String getEncoding() {
* @since JavaMail 1.4
*/
public void saveFile(File file) throws IOException, MessagingException {
Files.copy(getInputStream(), file.toPath());
Files.copy(getInputStream(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
}

/**
Expand Down

0 comments on commit 386650a

Please sign in to comment.