[R2DBC-1] Calling Row.get(…) twice for the same column fails Created: 2020-03-05  Updated: 2020-03-05  Resolved: 2020-03-05

Status: Closed
Project: MariaDB Connector/R2DBC
Component/s: None
Affects Version/s: None
Fix Version/s: 0.8.2-alpha2

Type: Bug Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 1.5h
Original Estimate: Not Specified


 Description   

See github issue

Calling Row.get(…) twice using the same column either fails with IndexOutOfBoundsException or returns an invalid result.

Version: 0.8.0-alpha1

SQL:

 
INSERT INTO legoset (name, manual) VALUES (?, ?)
Called Statement.returnGeneratedValues() and then Row.get("ID")
 
java.lang.IndexOutOfBoundsException: expected: 0 <= start(2) <= start + length(1) <= buf.capacity(2)
		at io.netty.buffer.ByteBufUtil.getBytes(ByteBufUtil.java:884)
		at io.netty.buffer.AbstractByteBuf.getCharSequence(AbstractByteBuf.java:524)
		at io.netty.buffer.AbstractByteBuf.readCharSequence(AbstractByteBuf.java:531)
		at org.mariadb.r2dbc.codec.list.LongCodec.decodeText(LongCodec.java:85)
		at org.mariadb.r2dbc.codec.list.LongCodec.decodeText(LongCodec.java:30)
		at org.mariadb.r2dbc.codec.RowDecoder.get(RowDecoder.java:54)
		at org.mariadb.r2dbc.MariadbRow.decode(MariadbRow.java:93)
		at org.mariadb.r2dbc.MariadbRow.get(MariadbRow.java:49)
		at org.mariadb.r2dbc.MariadbRow.get(MariadbRow.java:57)
		at io.r2dbc.spi.Row.get(Row.java:78)
		at 

org.springframework.data.r2dbc.convert.MappingR2dbcConverter.potentiallySetId(MappingR2dbcConverter.java:588)
Reproducer:

 
connection.createStatement("INSERT INTO legoset (name, manual) VALUES (?, ?)")
		.bind(0, "Hello")
		.bind(1, 1)
		.returnGeneratedValues()
		.execute()
		.flatMap(it -> it.map((row, rowMetadata) -> {
 
			row.get("id");
			row.get("ID");
			return new Object();
		}))
		.as(StepVerifier::create)
		.expectNextCount(1)
		.verifyComplete();


Generated at Thu Feb 08 03:31:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.