From c9a5f5d793525355a882af1d2ee56cd47185dabb Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 17 Jul 2024 14:34:01 -0700 Subject: [PATCH] Reverted back to previous exception --- src/main/java/com/pgvector/PGbit.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/pgvector/PGbit.java b/src/main/java/com/pgvector/PGbit.java index 78c034d..bbe8498 100644 --- a/src/main/java/com/pgvector/PGbit.java +++ b/src/main/java/com/pgvector/PGbit.java @@ -33,7 +33,7 @@ public PGbit() { public PGbit(boolean[] v) { this(); length = v.length; - data = new byte[Math.addExact(length, 7) / 8]; + data = new byte[(length + 7) / 8]; for (int i = 0; i < length; i++) { data[i / 8] |= (v[i] ? 1 : 0) << (7 - (i % 8)); } @@ -69,7 +69,7 @@ public void setValue(String s) throws SQLException { data = null; } else { length = s.length(); - data = new byte[Math.addExact(length, 7) / 8]; + data = new byte[(length + 7) / 8]; for (int i = 0; i < length; i++) { data[i / 8] |= (s.charAt(i) != '0' ? 1 : 0) << (7 - (i % 8)); } @@ -103,7 +103,7 @@ public int lengthInBytes() { */ public void setByteValue(byte[] value, int offset) throws SQLException { length = ByteConverter.int4(value, offset); - data = new byte[Math.addExact(length, 7) / 8]; + data = new byte[(length + 7) / 8]; for (int i = 0; i < data.length; i++) { data[i] = value[offset + 4 + i]; }