File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
core/src/main/java/com/datastax/oss/driver/internal/core/type/codec Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -127,17 +127,19 @@ Elements should at least precede themselves with their size (along the lines of
127127 cqlType .getDimensions (), bytes .remaining ()));
128128 }
129129
130+ ByteBuffer slice = bytes .slice ();
130131 List <SubtypeT > rv = new ArrayList <SubtypeT >(cqlType .getDimensions ());
131132 for (int i = 0 ; i < cqlType .getDimensions (); ++i ) {
132- ByteBuffer slice = bytes .slice ();
133- slice .limit (elementSize );
133+ // Set the limit for the current element
134+ int originalPosition = slice .position ();
135+ slice .limit (originalPosition + elementSize );
134136 rv .add (this .subtypeCodec .decode (slice , protocolVersion ));
135- bytes .position (bytes .position () + elementSize );
137+ // Move to the start of the next element
138+ slice .position (originalPosition + elementSize );
139+ // Reset the limit to the end of the buffer
140+ slice .limit (slice .capacity ());
136141 }
137142
138- /* Restore the input ByteBuffer to its original state */
139- bytes .rewind ();
140-
141143 return CqlVector .newInstance (rv );
142144 }
143145
You can’t perform that action at this time.
0 commit comments