Skip to content

Commit

Permalink
[Java] Fix endianness when accessing string fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Sep 26, 2024
1 parent 6e44757 commit a0f21b9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,11 @@ static void dissectReplaySessionStateChange(
builder.append(" position=").append(position);

builder.append(" ");
absoluteOffset += buffer.getStringAscii(absoluteOffset, builder);
absoluteOffset += buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
absoluteOffset += SIZE_OF_INT;

builder.append(" reason=\"");
buffer.getStringAscii(absoluteOffset, builder);
buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
builder.append("\"");
}

Expand All @@ -558,11 +558,11 @@ static void dissectRecordingSessionStateChange(
builder.append(" position=").append(position);

builder.append(" ");
absoluteOffset += buffer.getStringAscii(absoluteOffset, builder);
absoluteOffset += buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
absoluteOffset += SIZE_OF_INT;

builder.append(" reason=\"");
buffer.getStringAscii(absoluteOffset, builder);
buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
builder.append("\"");
}

Expand All @@ -587,11 +587,11 @@ static void dissectReplicationSessionStateChange(
builder.append(" position=").append(position);

builder.append(" ");
absoluteOffset += buffer.getStringAscii(absoluteOffset, builder);
absoluteOffset += buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
absoluteOffset += SIZE_OF_INT;

builder.append(" reason=\"");
buffer.getStringAscii(absoluteOffset, builder);
buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
builder.append("\"");
}

Expand All @@ -606,7 +606,7 @@ static void dissectControlSessionStateChange(

builder.append(": controlSessionId=").append(controlSessionId);
builder.append(" ");
buffer.getStringAscii(absoluteOffset, builder);
buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
}

static void dissectReplaySessionError(
Expand All @@ -624,7 +624,7 @@ static void dissectReplaySessionError(
builder.append(": sessionId=").append(sessionId);
builder.append(" recordingId=").append(recordingId);
builder.append(" errorMessage=");
buffer.getStringAscii(absoluteOffset, builder);
buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
}

static void dissectCatalogResize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static void dissectStateChange(

builder.append(": memberId=").append(memberId);
builder.append(' ');
buffer.getStringAscii(absoluteOffset, builder);
buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
}

static void dissectNoOp(
Expand Down Expand Up @@ -157,7 +157,7 @@ static void dissectElectionStateChange(
absoluteOffset += SIZE_OF_INT;

builder.append(": memberId=").append(memberId).append(' ');
absoluteOffset += SIZE_OF_INT + buffer.getStringAscii(absoluteOffset, builder);
absoluteOffset += SIZE_OF_INT + buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);

builder.append(" leaderId=").append(leaderId);
builder.append(" candidateTermId=").append(candidateTermId);
Expand All @@ -167,7 +167,7 @@ static void dissectElectionStateChange(
builder.append(" appendPosition=").append(appendPosition);
builder.append(" catchupPosition=").append(catchupPosition);
builder.append(" reason=");
buffer.getStringAscii(absoluteOffset, builder);
buffer.getStringAscii(absoluteOffset, builder, LITTLE_ENDIAN);
}

static void dissectCanvassPosition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int dissectInetAddress(final MutableDirectBuffer buffer, final int offset
{
int encodedLength = 0;

final int addressLength = buffer.getInt(offset + encodedLength);
final int addressLength = buffer.getInt(offset + encodedLength, LITTLE_ENDIAN);
encodedLength += SIZE_OF_INT;

if (4 == addressLength)
Expand Down

0 comments on commit a0f21b9

Please sign in to comment.