You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
List<Tuple> batch = new ArrayList<>();
batch.add(Tuple.of(79991, "batch one"));
batch.add(Tuple.of(79992, "batch two"));
batch.add(Tuple.of(79993, "batch three"));
batch.add(Tuple.of(79994, "batch four"));
conn.preparedBatch("SELECT $1::integer, $2::varchar(2048)", batch, event -> {
if (event.succeeded()) {
logger.info("Stored new batch of commands");
} else {
logger.info("Error storing batch of commands", event.cause());
}
async.complete();
});
But with the following change (note added spaces in sql) the error disappears
List<Tuple> batch = new ArrayList<>();
batch.add(Tuple.of(79991, "batch one"));
batch.add(Tuple.of(79992, "batch two"));
batch.add(Tuple.of(79993, "batch three"));
batch.add(Tuple.of(79994, "batch four"));
conn.preparedBatch("SELECT $1::integer, $2::varchar(2048) ", batch, event -> {
if (event.succeeded()) {
logger.info("Stored new batch of commands");
} else {
logger.info("Error storing batch of commands", event.cause());
}
async.complete();
});
The error that happens is
SEVERE: Unhandled exception
java.lang.IndexOutOfBoundsException: index: 253, length: 30 (expected: range(0, 256))
at io.netty.buffer.AbstractByteBuf.checkIndex0(AbstractByteBuf.java:1360)
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1355)
at io.netty.buffer.AbstractByteBuf.setCharSequence0(AbstractByteBuf.java:682)
at io.netty.buffer.AbstractByteBuf.setCharSequence(AbstractByteBuf.java:672)
at com.julienviet.pgclient.impl.codec.DataType.encodeText(DataType.java:655)
at com.julienviet.pgclient.impl.codec.DataType$9.encodeBinary(DataType.java:244)
at com.julienviet.pgclient.impl.codec.DataType$9.encodeBinary(DataType.java:234)
at com.julienviet.pgclient.impl.codec.encoder.message.Bind.encode(Bind.java:154)
at com.julienviet.pgclient.impl.codec.encoder.message.Bind.encode(Bind.java:167)
at com.julienviet.pgclient.impl.SocketConnection.checkPending(SocketConnection.java:210)
at com.julienviet.pgclient.impl.SocketConnection.bilto(SocketConnection.java:191)
at com.julienviet.pgclient.impl.CommandBase.foo(CommandBase.java:54)
at com.julienviet.pgclient.impl.SocketConnection.schedule(SocketConnection.java:181)
at com.julienviet.pgclient.impl.ConnectionPool$PooledConnection.schedule(ConnectionPool.java:77)
at com.julienviet.pgclient.impl.PgPoolImpl$1.lambda$onSuccess$0(PgPoolImpl.java:73)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
The text was updated successfully, but these errors were encountered:
it's not clear what you mean by space, your second example that works is not valid java code, so it's hard to spot the difference
vietj
changed the title
Error with batches depending on SQL string length
Default text encoding assumes the ByteBuf is large enough for encoding the value
Mar 4, 2018
The following code gives an error:
But with the following change (note added spaces in sql) the error disappears
The error that happens is
The text was updated successfully, but these errors were encountered: