diff --git a/core/src/main/java/org/apache/iceberg/ManifestFiles.java b/core/src/main/java/org/apache/iceberg/ManifestFiles.java index 9dbf50e762c7..73f2f6840970 100644 --- a/core/src/main/java/org/apache/iceberg/ManifestFiles.java +++ b/core/src/main/java/org/apache/iceberg/ManifestFiles.java @@ -226,6 +226,7 @@ static ManifestFile copyRewriteManifest(int formatVersion, } } + @SuppressWarnings("Finally") private static ManifestFile copyManifestInternal(int formatVersion, ManifestReader reader, OutputFile outputFile, long snapshotId, SnapshotSummary.Builder summaryBuilder, diff --git a/core/src/main/java/org/apache/iceberg/MetricsModes.java b/core/src/main/java/org/apache/iceberg/MetricsModes.java index 8fea56586c46..e9e2844dffd2 100644 --- a/core/src/main/java/org/apache/iceberg/MetricsModes.java +++ b/core/src/main/java/org/apache/iceberg/MetricsModes.java @@ -22,7 +22,6 @@ import java.io.ObjectStreamException; import java.io.Serializable; import java.util.Locale; -import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.iceberg.relocated.com.google.common.base.Preconditions; @@ -134,7 +133,7 @@ public boolean equals(Object other) { @Override public int hashCode() { - return Objects.hash(length); + return Integer.hashCode(length); } } diff --git a/core/src/main/java/org/apache/iceberg/avro/Avro.java b/core/src/main/java/org/apache/iceberg/avro/Avro.java index 1aceb18bfc28..07a8a2df1d9a 100644 --- a/core/src/main/java/org/apache/iceberg/avro/Avro.java +++ b/core/src/main/java/org/apache/iceberg/avro/Avro.java @@ -577,6 +577,7 @@ public static class ReadBuilder { private org.apache.iceberg.Schema schema = null; private Function> createReaderFunc = null; private BiFunction> createReaderBiFunc = null; + @SuppressWarnings("UnnecessaryLambda") private final Function> defaultCreateReaderFunc = readSchema -> { GenericAvroReader reader = new GenericAvroReader<>(readSchema); reader.setClassLoader(loader); diff --git a/core/src/main/java/org/apache/iceberg/encryption/InputFilesDecryptor.java b/core/src/main/java/org/apache/iceberg/encryption/InputFilesDecryptor.java index 6c1e0eb8b250..4987b2e7b771 100644 --- a/core/src/main/java/org/apache/iceberg/encryption/InputFilesDecryptor.java +++ b/core/src/main/java/org/apache/iceberg/encryption/InputFilesDecryptor.java @@ -43,6 +43,7 @@ public InputFilesDecryptor(CombinedScanTask combinedTask, FileIO io, EncryptionM .map(entry -> EncryptedFiles.encryptedInput(io.newInputFile(entry.getKey()), entry.getValue())); // decrypt with the batch call to avoid multiple RPCs to a key server, if possible + @SuppressWarnings("StreamToIterable") Iterable decryptedFiles = encryption.decrypt(encrypted::iterator); Map files = Maps.newHashMapWithExpectedSize(keyMetadata.size()); diff --git a/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java b/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java index 3950e8415c4b..a5ffa2f7c0f8 100644 --- a/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java +++ b/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java @@ -196,7 +196,7 @@ public void renameTable(TableIdentifier from, TableIdentifier to) { err -> { // SQLite doesn't set SQLState or throw SQLIntegrityConstraintViolationException if (err instanceof SQLIntegrityConstraintViolationException || - err.getMessage() != null && err.getMessage().contains("constraint failed")) { + (err.getMessage() != null && err.getMessage().contains("constraint failed"))) { throw new AlreadyExistsException("Table already exists: %s", to); } }, diff --git a/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java b/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java index ee1be869263e..19a3086061a6 100644 --- a/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java +++ b/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java @@ -20,6 +20,7 @@ package org.apache.iceberg.rest; import java.time.OffsetDateTime; +import java.time.ZoneOffset; import java.util.List; import java.util.Map; import java.util.Set; @@ -166,7 +167,7 @@ public static LoadTableResponse stageTableCreate(Catalog catalog, Namespace name } Map properties = Maps.newHashMap(); - properties.put("created-at", OffsetDateTime.now().toString()); + properties.put("created-at", OffsetDateTime.now(ZoneOffset.UTC).toString()); properties.putAll(request.properties()); String location; diff --git a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java index 9da1a61c3396..4a5c8a3a7ff9 100644 --- a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java +++ b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java @@ -352,6 +352,7 @@ private ScheduledExecutorService tokenRefreshExecutor() { return refreshExecutor; } + @SuppressWarnings("FutureReturnValueIgnored") private void scheduleTokenRefresh( AuthSession session, long startTimeMillis, long expiresIn, TimeUnit unit) { // convert expiration interval to milliseconds diff --git a/core/src/main/java/org/apache/iceberg/util/Tasks.java b/core/src/main/java/org/apache/iceberg/util/Tasks.java index 02ebd63b422a..66b8d236dccf 100644 --- a/core/src/main/java/org/apache/iceberg/util/Tasks.java +++ b/core/src/main/java/org/apache/iceberg/util/Tasks.java @@ -569,6 +569,7 @@ public static Builder foreach(I... items) { return new Builder<>(Arrays.asList(items)); } + @SuppressWarnings("StreamToIterable") public static Builder foreach(Stream items) { return new Builder<>(items::iterator); } diff --git a/core/src/main/java/org/apache/iceberg/util/ZOrderByteUtils.java b/core/src/main/java/org/apache/iceberg/util/ZOrderByteUtils.java index 8a1b419a3bb0..70f686f94ed0 100644 --- a/core/src/main/java/org/apache/iceberg/util/ZOrderByteUtils.java +++ b/core/src/main/java/org/apache/iceberg/util/ZOrderByteUtils.java @@ -123,6 +123,7 @@ public static ByteBuffer doubleToOrderedBytes(double val, ByteBuffer reuse) { * This implementation just uses a set size to for all output byte representations. Truncating longer strings * and right padding 0 for shorter strings. */ + @SuppressWarnings("ByteBufferBackingArray") public static ByteBuffer stringToOrderedBytes(String val, int length, ByteBuffer reuse, CharsetEncoder encoder) { Preconditions.checkArgument(encoder.charset().equals(StandardCharsets.UTF_8), "Cannot use an encoder not using UTF_8 as it's Charset"); @@ -140,6 +141,7 @@ public static ByteBuffer stringToOrderedBytes(String val, int length, ByteBuffer * Return a bytebuffer with the given bytes truncated to length, or filled with 0's to length depending on whether * the given bytes are larger or smaller than the given length. */ + @SuppressWarnings("ByteBufferBackingArray") public static ByteBuffer byteTruncateOrFill(byte[] val, int length, ByteBuffer reuse) { ByteBuffer bytes = ByteBuffers.reuse(reuse, length); if (val.length < length) { @@ -164,6 +166,7 @@ static byte[] interleaveBits(byte[][] columnsBinary, int interleavedSize) { * @param interleavedSize the number of bytes to use in the output * @return the columnbytes interleaved */ + @SuppressWarnings("ByteBufferBackingArray") public static byte[] interleaveBits(byte[][] columnsBinary, int interleavedSize, ByteBuffer reuse) { byte[] interleavedBytes = reuse.array(); Arrays.fill(interleavedBytes, 0, interleavedSize, (byte) 0x00); diff --git a/data/src/test/java/org/apache/iceberg/data/TestReadProjection.java b/data/src/test/java/org/apache/iceberg/data/TestReadProjection.java index 1a1c59953e76..9271bce075f7 100644 --- a/data/src/test/java/org/apache/iceberg/data/TestReadProjection.java +++ b/data/src/test/java/org/apache/iceberg/data/TestReadProjection.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.time.OffsetDateTime; +import java.time.ZoneOffset; import java.util.List; import java.util.Map; import org.apache.iceberg.Schema; @@ -200,7 +201,7 @@ public void testBasicProjection() throws Exception { Record record = GenericRecord.create(writeSchema.asStruct()); record.setField("id", 34L); record.setField("data", "test"); - record.setField("time", OffsetDateTime.now()); + record.setField("time", OffsetDateTime.now(ZoneOffset.UTC)); Schema idOnly = new Schema( Types.NestedField.required(0, "id", Types.LongType.get())