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
127
127
cqlType .getDimensions (), bytes .remaining ()));
128
128
}
129
129
130
+ ByteBuffer slice = bytes .slice ();
130
131
List <SubtypeT > rv = new ArrayList <SubtypeT >(cqlType .getDimensions ());
131
132
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 );
134
136
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 ());
136
141
}
137
142
138
- /* Restore the input ByteBuffer to its original state */
139
- bytes .rewind ();
140
-
141
143
return CqlVector .newInstance (rv );
142
144
}
143
145
You can’t perform that action at this time.
0 commit comments