(geronimo-mail) branch main updated: Ensure to flush the buffered output stream introduced in https://github.com/apache/geronimo-mail/pull/1 (#3)
[email protected] Sun, 11 Jan 2026 18:43:00 +0000
| Newsgroups | gmane.comp.java.geronimo.cvs |
|---|---|
| Message-ID | <176815698038.2559190.7726774739197590178@gitbox3-he-fi.apache.org> |
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/geronimo-mail.git
The following commit(s) were added to refs/heads/main by this push:
new d58c9a5 Ensure to flush the buffered output stream introduced in https://github.com/apache/geronimo-mail/pull/1 (#3)
d58c9a5 is described below
commit d58c9a534fcf909a3ce5fd0f3c05e50654031794
Author: Richard Zowalla <[email protected]>
AuthorDate: Sun Jan 11 19:42:55 2026 +0100
Ensure to flush the buffered output stream introduced in https://github.com/apache/geronimo-mail/pull/1 (#3)
---
.../org/apache/geronimo/mail/transport/nntp/NNTPConnection.java | 1 +
.../main/java/org/apache/geronimo/mail/util/MailConnection.java | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/transport/nntp/NNTPConnection.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/transport/nntp/NNTPConnection.java
index 566834b..c8a6f3d 100644
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/transport/nntp/NNTPConnection.java
+++ b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/transport/nntp/NNTPConnection.java
@@ -372,6 +372,7 @@ public class NNTPConnection extends MailConnection {
mimeOut.writeSMTPTerminator();
// and flush the data to send it along
mimeOut.flush();
+ this.outputStream.flush(); // most of the time MIMEOutputStream#flush does nothing so ensure we actually flush the data
} catch (IOException e) {
throw new MessagingException("I/O error posting message", e);
} catch (MessagingException e) {
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/util/MailConnection.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/util/MailConnection.java
index fcc1e49..1a1b00a 100644
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/util/MailConnection.java
+++ b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/util/MailConnection.java
@@ -661,7 +661,12 @@ public class MailConnection {
public void closeServerConnection()
{
try {
- socket.close();
+ if (outputStream != null) {
+ outputStream.flush();
+ }
+ if(socket != null) {
+ socket.close();
+ }
} catch (IOException ignored) {
}