[
https://issues.apache.org/jira/browse/QPIDJMS-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18050177#comment-18050177
]
ASF GitHub Bot commented on QPIDJMS-617:
----------------------------------------
tabish121 commented on code in PR #56:
URL: https://github.com/apache/qpid-jms/pull/56#discussion_r2665484771
##########
qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsBytesMessage.java:
##########
@@ -200,11 +200,23 @@ public double readDouble() throws JMSException {
@Override
public String readUTF() throws JMSException {
initializeReading();
+ final boolean canReset = this.dataIn.markSupported();
+ if (canReset) {
+ this.dataIn.mark(Integer.MAX_VALUE);
+ }
try {
return this.dataIn.readUTF();
} catch (EOFException e) {
throw JmsExceptionSupport.createMessageEOFException(e);
} catch (IOException e) {
+ if (canReset) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ignored)
+ {
Review Comment:
Formatting here is incorrect and should match the rest of the codebase
> BytesMessage increments the read pointer position on MessageFormatException
> ---------------------------------------------------------------------------
>
> Key: QPIDJMS-617
> URL: https://issues.apache.org/jira/browse/QPIDJMS-617
> Project: Qpid JMS
> Issue Type: Bug
> Components: qpid-jms-client
> Affects Versions: 2.9.0
> Reporter: Daniil Kirilyuk
> Priority: Minor
> Fix For: 2.10.0
>
>
> Jakarta Messaging specification version 3.1 states in chapter
> [3.11.3|https://jakarta.ee/specifications/messaging/3.1/jakarta-messaging-spec-3.1#conversions-provided-by-streammessage-and-mapmessage]:
> "If a read method of StreamMessage or BytesMessage throws a
> MessageFormatException or NumberFormatException, the current position of the
> read pointer must not be incremented. A subsequent read must be capable of
> recovering from the exception by rereading the data as a different type".
> Currently JmsBytesMessage increments the read pointer position, making it
> impossible to reread the data after the exception.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]