Skip to content

Commit

Permalink
Build: Bump Errorprone to 5.64.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Aug 26, 2024
1 parent 2975d76 commit 2f49b39
Show file tree
Hide file tree
Showing 44 changed files with 301 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.iceberg.expressions;

import java.util.Locale;
import org.apache.iceberg.Accessor;
import org.apache.iceberg.StructLike;
import org.apache.iceberg.types.Type;
Expand Down Expand Up @@ -82,6 +83,7 @@ public Accessor<StructLike> accessor() {

@Override
public String toString() {
return String.format("ref(id=%d, accessor-type=%s)", field.fieldId(), accessor.type());
return String.format(
Locale.ROOT, "ref(id=%d, accessor-type=%s)", field.fieldId(), accessor.type());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
Expand Down Expand Up @@ -493,8 +494,10 @@ private static List<String> abbreviateValues(List<String> sanitizedValues) {
abbreviatedList.addAll(distinctValues);
abbreviatedList.add(
String.format(
Locale.ROOT,
"... (%d values hidden, %d in total)",
sanitizedValues.size() - distinctValues.size(), sanitizedValues.size()));
sanitizedValues.size() - distinctValues.size(),
sanitizedValues.size()));
return abbreviatedList;
}
}
Expand Down Expand Up @@ -615,7 +618,7 @@ private static String sanitizeString(CharSequence value, long now, int today) {

private static String sanitizeSimpleString(CharSequence value) {
// hash the value and return the hash as hex
return String.format("(hash-%08x)", HASH_FUNC.apply(value));
return String.format(Locale.ROOT, "(hash-%08x)", HASH_FUNC.apply(value));
}

private static PartitionSpec identitySpec(Schema schema, int... ids) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
*/
package org.apache.iceberg.io;

import java.util.Locale;

public class BulkDeletionFailureException extends RuntimeException {
private final int numberFailedObjects;

public BulkDeletionFailureException(int numberFailedObjects) {
super(String.format("Failed to delete %d files", numberFailedObjects));
super(String.format(Locale.ROOT, "Failed to delete %d files", numberFailedObjects));
this.numberFailedObjects = numberFailedObjects;
}

Expand Down
19 changes: 15 additions & 4 deletions api/src/main/java/org/apache/iceberg/transforms/TransformUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
import java.util.Base64;
import java.util.Locale;

class TransformUtil {

Expand All @@ -35,19 +36,25 @@ private TransformUtil() {}
private static final int EPOCH_YEAR = EPOCH.getYear();

static String humanYear(int yearOrdinal) {
return String.format("%04d", EPOCH_YEAR + yearOrdinal);
return String.format(Locale.ROOT, "%04d", EPOCH_YEAR + yearOrdinal);
}

static String humanMonth(int monthOrdinal) {
return String.format(
Locale.ROOT,
"%04d-%02d",
EPOCH_YEAR + Math.floorDiv(monthOrdinal, 12), 1 + Math.floorMod(monthOrdinal, 12));
EPOCH_YEAR + Math.floorDiv(monthOrdinal, 12),
1 + Math.floorMod(monthOrdinal, 12));
}

static String humanDay(int dayOrdinal) {
OffsetDateTime day = EPOCH.plusDays(dayOrdinal);
return String.format(
"%04d-%02d-%02d", day.getYear(), day.getMonth().getValue(), day.getDayOfMonth());
Locale.ROOT,
"%04d-%02d-%02d",
day.getYear(),
day.getMonth().getValue(),
day.getDayOfMonth());
}

static String humanTime(Long microsFromMidnight) {
Expand All @@ -65,8 +72,12 @@ static String humanTimestampWithoutZone(Long timestampMicros) {
static String humanHour(int hourOrdinal) {
OffsetDateTime time = EPOCH.plusHours(hourOrdinal);
return String.format(
Locale.ROOT,
"%04d-%02d-%02d-%02d",
time.getYear(), time.getMonth().getValue(), time.getDayOfMonth(), time.getHour());
time.getYear(),
time.getMonth().getValue(),
time.getDayOfMonth(),
time.getHour());
}

static String base64encode(ByteBuffer buffer) {
Expand Down
13 changes: 7 additions & 6 deletions api/src/main/java/org/apache/iceberg/types/Types.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public TypeID typeId() {

@Override
public String toString() {
return String.format("fixed[%d]", length);
return String.format(Locale.ROOT, "fixed[%d]", length);
}

@Override
Expand Down Expand Up @@ -388,7 +388,7 @@ public TypeID typeId() {

@Override
public String toString() {
return String.format("decimal(%d, %d)", precision, scale);
return String.format(Locale.ROOT, "decimal(%d, %d)", precision, scale);
}

@Override
Expand Down Expand Up @@ -497,7 +497,8 @@ public String doc() {

@Override
public String toString() {
return String.format("%d: %s: %s %s", id, name, isOptional ? "optional" : "required", type)
return String.format(
Locale.ROOT, "%d: %s: %s %s", id, name, isOptional ? "optional" : "required", type)
+ (doc != null ? " (" + doc + ")" : "");
}

Expand Down Expand Up @@ -614,7 +615,7 @@ public Schema asSchema() {

@Override
public String toString() {
return String.format("struct<%s>", FIELD_SEP.join(fields));
return String.format(Locale.ROOT, "struct<%s>", FIELD_SEP.join(fields));
}

@Override
Expand Down Expand Up @@ -747,7 +748,7 @@ public Types.ListType asListType() {

@Override
public String toString() {
return String.format("list<%s>", elementField.type());
return String.format(Locale.ROOT, "list<%s>", elementField.type());
}

@Override
Expand Down Expand Up @@ -865,7 +866,7 @@ public Types.MapType asMapType() {

@Override
public String toString() {
return String.format("map<%s, %s>", keyField.type(), valueField.type());
return String.format(Locale.ROOT, "map<%s, %s>", keyField.type(), valueField.type());
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/org/apache/iceberg/util/DateTimeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoUnit;
import java.util.Locale;

public class DateTimeUtil {
private DateTimeUtil() {}
Expand Down Expand Up @@ -102,7 +103,7 @@ public static String microsToIsoTimestamptz(long micros) {
.parseCaseInsensitive()
.append(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
.appendOffset("+HH:MM:ss", "+00:00")
.toFormatter();
.toFormatter(Locale.ROOT);
return localDateTime.atOffset(ZoneOffset.UTC).format(zeroOffsetFormatter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.iceberg.arrow.vectorized.parquet;

import java.util.Arrays;
import java.util.Locale;
import org.apache.arrow.vector.DecimalVector;
import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting;

Expand Down Expand Up @@ -62,7 +63,9 @@ static byte[] padBigEndianBytes(byte[] bigEndianBytes, int newLength) {
}
throw new IllegalArgumentException(
String.format(
Locale.ROOT,
"Buffer size of %d is larger than requested size of %d",
bigEndianBytes.length, newLength));
bigEndianBytes.length,
newLength));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.iceberg;

import java.util.Locale;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -327,7 +328,8 @@ private String newTableMetadataFilePath(TableMetadata meta, int newVersion) {
TableProperties.METADATA_COMPRESSION, TableProperties.METADATA_COMPRESSION_DEFAULT);
String fileExtension = TableMetadataParser.getFileExtension(codecName);
return metadataFileLocation(
meta, String.format("%05d-%s%s", newVersion, UUID.randomUUID(), fileExtension));
meta,
String.format(Locale.ROOT, "%05d-%s%s", newVersion, UUID.randomUUID(), fileExtension));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/apache/iceberg/MetricsModes.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public int length() {

@Override
public String toString() {
return String.format("truncate(%d)", length);
return String.format(Locale.ROOT, "truncate(%d)", length);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/apache/iceberg/ScanSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.IOException;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.NavigableMap;
import java.util.Set;
Expand Down Expand Up @@ -346,7 +347,7 @@ public void update(K key, Function<V, V> updateFunc) {
while (map.size() > maxSize) {
if (throwIfLimited) {
throw new IllegalStateException(
String.format("Too many matching keys: more than %d", maxSize));
String.format(Locale.ROOT, "Too many matching keys: more than %d", maxSize));
}
this.cut = map.lastKey();
map.remove(cut);
Expand Down
7 changes: 6 additions & 1 deletion core/src/main/java/org/apache/iceberg/SnapshotProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
Expand Down Expand Up @@ -497,7 +498,11 @@ protected OutputFile manifestListPath() {
ops.metadataFileLocation(
FileFormat.AVRO.addExtension(
String.format(
"snap-%d-%d-%s", snapshotId(), attempt.incrementAndGet(), commitUUID))));
Locale.ROOT,
"snap-%d-%d-%s",
snapshotId(),
attempt.incrementAndGet(),
commitUUID))));
}

protected EncryptedOutputFile newManifestOutputFile() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.UncheckedIOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Locale;
import java.util.Map;
import org.apache.avro.AvroRuntimeException;
import org.apache.avro.Schema;
Expand Down Expand Up @@ -138,7 +139,8 @@ public D decode(InputStream stream, D reuse) throws IOException {

if (IcebergEncoder.V1_HEADER[0] != header[0] || IcebergEncoder.V1_HEADER[1] != header[1]) {
throw new BadHeaderException(
String.format("Unrecognized header bytes: 0x%02X 0x%02X", header[0], header[1]));
String.format(
Locale.ROOT, "Unrecognized header bytes: 0x%02X 0x%02X", header[0], header[1]));
}

RawDecoder<D> decoder = getDecoder(FP_BUFFER.get().getLong(2));
Expand Down
5 changes: 4 additions & 1 deletion core/src/main/java/org/apache/iceberg/io/ContentCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.nio.ByteBuffer;
import java.time.Duration;
import java.util.List;
import java.util.Locale;
import org.apache.iceberg.exceptions.NotFoundException;
import org.apache.iceberg.exceptions.ValidationException;
import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
Expand Down Expand Up @@ -253,8 +254,10 @@ private static FileContent download(InputFile input) {
// IOException and let the caller fallback to non-caching input file.
throw new IOException(
String.format(
Locale.ROOT,
"Failed to read %d bytes: %d bytes in stream",
fileLength, fileLength - totalBytesToRead));
fileLength,
fileLength - totalBytesToRead));
} else {
buffers.add(ByteBuffer.wrap(buf));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.apache.iceberg.TableProperties.DEFAULT_FILE_FORMAT;
import static org.apache.iceberg.TableProperties.DEFAULT_FILE_FORMAT_DEFAULT;

import java.util.Locale;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
Expand Down Expand Up @@ -92,6 +93,7 @@ public static Builder builderFor(Table table, int partitionId, long taskId) {
private String generateFilename() {
return format.addExtension(
String.format(
Locale.ROOT,
"%05d-%d-%s-%05d%s",
partitionId,
taskId,
Expand Down
13 changes: 11 additions & 2 deletions core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
Expand Down Expand Up @@ -798,7 +799,11 @@ private boolean insertProperties(Namespace namespace, Map<String, String> proper
}

throw new IllegalStateException(
String.format("Failed to insert: %d of %d succeeded", insertedRecords, properties.size()));
String.format(
Locale.ROOT,
"Failed to insert: %d of %d succeeded",
insertedRecords,
properties.size()));
}

private boolean updateProperties(Namespace namespace, Map<String, String> properties) {
Expand All @@ -818,7 +823,11 @@ private boolean updateProperties(Namespace namespace, Map<String, String> proper
}

throw new IllegalStateException(
String.format("Failed to update: %d of %d succeeded", updatedRecords, properties.size()));
String.format(
Locale.ROOT,
"Failed to update: %d of %d succeeded",
updatedRecords,
properties.size()));
}

private boolean deleteProperties(Namespace namespace, Set<String> properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.iceberg.view;

import java.util.Locale;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
Expand Down Expand Up @@ -157,7 +158,8 @@ private String newMetadataFilePath(ViewMetadata metadata, int newVersion) {
ViewProperties.METADATA_COMPRESSION, ViewProperties.METADATA_COMPRESSION_DEFAULT);
String fileExtension = TableMetadataParser.getFileExtension(codecName);
return metadataFileLocation(
metadata, String.format("%05d-%s%s", newVersion, UUID.randomUUID(), fileExtension));
metadata,
String.format(Locale.ROOT, "%05d-%s%s", newVersion, UUID.randomUUID(), fileExtension));
}

private String metadataFileLocation(ViewMetadata metadata, String filename) {
Expand Down
Loading

0 comments on commit 2f49b39

Please sign in to comment.