diff --git a/api/src/test/java/org/apache/iceberg/util/RandomUtil.java b/api/src/test/java/org/apache/iceberg/util/RandomUtil.java index bf281835a237..42dd6825a4d5 100644 --- a/api/src/test/java/org/apache/iceberg/util/RandomUtil.java +++ b/api/src/test/java/org/apache/iceberg/util/RandomUtil.java @@ -29,10 +29,6 @@ public class RandomUtil { private RandomUtil() {} - public static String generateString(int length, Random random) { - return randomString(length, random); - } - private static boolean negate(int num) { return num % 2 == 1; } @@ -204,10 +200,10 @@ public static Object generateDictionaryEncodablePrimitive( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.!?"; private static String randomString(Random random) { - return randomString(random.nextInt(50), random); + return generateString(random.nextInt(50), random); } - private static String randomString(int length, Random random) { + public static String generateString(int length, Random random) { byte[] buffer = new byte[length]; for (int i = 0; i < length; i += 1) { diff --git a/core/src/main/java/org/apache/iceberg/variants/VariantMetadata.java b/core/src/main/java/org/apache/iceberg/variants/VariantMetadata.java index 91dc591c64e7..91129e2328df 100644 --- a/core/src/main/java/org/apache/iceberg/variants/VariantMetadata.java +++ b/core/src/main/java/org/apache/iceberg/variants/VariantMetadata.java @@ -18,6 +18,8 @@ */ package org.apache.iceberg.variants; +import java.util.NoSuchElementException; + /** A variant metadata dictionary. */ public interface VariantMetadata extends Variants.Serialized { /** Returns the ID for a {@code name} in the dictionary, or -1 if not present. */ @@ -26,7 +28,7 @@ public interface VariantMetadata extends Variants.Serialized { /** * Returns the field name for an ID in metadata. * - * @throws ArrayIndexOutOfBoundsException if the dictionary does not contain the ID + * @throws NoSuchElementException if the dictionary does not contain the ID */ String get(int id); } diff --git a/core/src/test/java/org/apache/iceberg/variants/TestShreddedObject.java b/core/src/test/java/org/apache/iceberg/variants/TestShreddedObject.java index 7ce1ea3383d5..75606b602dd0 100644 --- a/core/src/test/java/org/apache/iceberg/variants/TestShreddedObject.java +++ b/core/src/test/java/org/apache/iceberg/variants/TestShreddedObject.java @@ -395,7 +395,7 @@ public void testThreeByteFieldIds(boolean sortFieldNames) { assertThat(object.get("ZZ").asPrimitive().get()).isEqualTo(new BigDecimal("12.21")); } - static VariantValue roundTripMinimalBuffer(ShreddedObject object, SerializedMetadata metadata) { + private static VariantValue roundTripMinimalBuffer(ShreddedObject object, SerializedMetadata metadata) { ByteBuffer serialized = ByteBuffer.allocate(object.sizeInBytes()).order(ByteOrder.LITTLE_ENDIAN); object.writeTo(serialized, 0); @@ -403,7 +403,7 @@ static VariantValue roundTripMinimalBuffer(ShreddedObject object, SerializedMeta return Variants.from(metadata, serialized); } - static VariantValue roundTripLargeBuffer(ShreddedObject object, SerializedMetadata metadata) { + private static VariantValue roundTripLargeBuffer(ShreddedObject object, SerializedMetadata metadata) { ByteBuffer serialized = ByteBuffer.allocate(1000 + object.sizeInBytes()).order(ByteOrder.LITTLE_ENDIAN); object.writeTo(serialized, 300);