Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling Row.get(…) twice for the same column fails #1

Closed
mp911de opened this issue Mar 5, 2020 · 1 comment
Closed

Calling Row.get(…) twice for the same column fails #1

mp911de opened this issue Mar 5, 2020 · 1 comment

Comments

@mp911de
Copy link

mp911de commented Mar 5, 2020

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();
@rusher
Copy link
Collaborator

rusher commented Mar 5, 2020

Allright. Thanks for reporting @mp911de .

this is corrected in next version (available in snapshot using sonatype snapshot repo):


<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.mariadb</groupId>
        <artifactId>r2dbc-mariadb</artifactId>
        <version>0.8.1-alpha2</version>
    </dependency>
</dependencies>

@rusher rusher closed this as completed Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants