Use a more efficient conversion from ByteArrayOutputStream to String.
Resolves #1324.
This commit is contained in:
committed by
Greg L. Turnquist
parent
8346d5b28d
commit
1b6fb7de44
@@ -50,7 +50,7 @@ class TextMessageOutputStream extends FilterOutputStream {
|
||||
super.flush();
|
||||
try {
|
||||
ByteArrayOutputStream baos = (ByteArrayOutputStream) out;
|
||||
String text = new String(baos.toByteArray(), encoding);
|
||||
String text = baos.toString(encoding);
|
||||
message.setText(text);
|
||||
} catch (JMSException ex) {
|
||||
throw new JmsTransportException(ex);
|
||||
|
||||
@@ -48,7 +48,7 @@ class MessageOutputStream extends FilterOutputStream {
|
||||
public void flush() throws IOException {
|
||||
super.flush();
|
||||
ByteArrayOutputStream bos = (ByteArrayOutputStream) out;
|
||||
String text = new String(bos.toByteArray(), encoding);
|
||||
String text = bos.toString(encoding);
|
||||
message.setBody(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public class JmsMessageSenderIntegrationTest {
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
messageFactory.createMessage().writeTo(bos);
|
||||
final String text = new String(bos.toByteArray(), StandardCharsets.UTF_8);
|
||||
final String text = bos.toString(StandardCharsets.UTF_8);
|
||||
|
||||
jmsTemplate.send(request.getJMSReplyTo(), session -> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user