diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java index c38e411e0d..b46b2fc21d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java @@ -19,7 +19,6 @@ package org.apache.maven.cli.transfer; import java.io.PrintStream; -import java.util.Locale; import org.apache.maven.api.services.MessageBuilder; import org.apache.maven.api.services.MessageBuilderFactory; @@ -72,7 +71,7 @@ public abstract class AbstractMavenTransferListener extends AbstractTransferList TransferResource resource = event.getResource(); long contentLength = event.getTransferredBytes(); - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); MessageBuilder message = messageBuilderFactory.builder(); message.append(action).style(STYLE).append(' ').append(direction).append(' '); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java index b423193d87..5855de9b81 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java @@ -21,7 +21,6 @@ package org.apache.maven.cli.transfer; import java.io.PrintStream; import java.util.Iterator; import java.util.LinkedHashMap; -import java.util.Locale; import java.util.Map; import org.apache.maven.api.services.MessageBuilderFactory; @@ -37,7 +36,7 @@ import org.eclipse.aether.transfer.TransferResource; public class ConsoleMavenTransferListener extends AbstractMavenTransferListener { private final Map transfers = new LinkedHashMap<>(); - private final FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); // use in a synchronized fashion + private final FileSizeFormat format = new FileSizeFormat(); // use in a synchronized fashion private final StringBuilder buffer = new StringBuilder(128); // use in a synchronized fashion private final boolean printResourceNames; diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/FileSizeFormat.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/FileSizeFormat.java index 35078f9c0c..aef6f995c9 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/FileSizeFormat.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/FileSizeFormat.java @@ -18,8 +18,6 @@ */ package org.apache.maven.cli.transfer; -import java.util.Locale; - import org.apache.maven.api.services.MessageBuilder; /** @@ -101,8 +99,6 @@ public class FileSizeFormat { } } - public FileSizeFormat(Locale locale) {} - public String format(long size) { return format(size, null); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java index 573b6ea7e3..7853216db1 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java @@ -18,8 +18,6 @@ */ package org.apache.maven.cli.transfer; -import java.util.Locale; - import org.eclipse.aether.transfer.AbstractTransferListener; import org.eclipse.aether.transfer.TransferCancelledException; import org.eclipse.aether.transfer.TransferEvent; @@ -75,7 +73,7 @@ public class Slf4jMavenTransferListener extends AbstractTransferListener { TransferResource resource = event.getResource(); long contentLength = event.getTransferredBytes(); - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); StringBuilder message = new StringBuilder(); message.append(action).append(' ').append(direction).append(' ').append(resource.getRepositoryId()); diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java index 6f96a59d90..0407ce4fd6 100644 --- a/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java @@ -18,8 +18,6 @@ */ package org.apache.maven.cli.transfer; -import java.util.Locale; - import org.apache.maven.cli.transfer.FileSizeFormat.ScaleUnit; import org.junit.jupiter.api.Test; @@ -30,7 +28,7 @@ class FileSizeFormatTest { @Test void testNegativeSize() { - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); long negativeSize = -100L; assertThrows(IllegalArgumentException.class, () -> format.format(negativeSize)); @@ -38,7 +36,7 @@ class FileSizeFormatTest { @Test void testSize() { - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); long _0_bytes = 0L; assertEquals("0 B", format.format(_0_bytes)); @@ -103,7 +101,7 @@ class FileSizeFormatTest { @Test void testSizeWithSelectedScaleUnit() { - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); long _0_bytes = 0L; assertEquals("0 B", format.format(_0_bytes)); @@ -206,7 +204,7 @@ class FileSizeFormatTest { @Test void testNegativeProgressedSize() { - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); long negativeProgressedSize = -100L; assertThrows(IllegalArgumentException.class, () -> format.formatProgress(negativeProgressedSize, 10L)); @@ -214,14 +212,14 @@ class FileSizeFormatTest { @Test void testNegativeProgressedSizeBiggerThanSize() { - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); assertThrows(IllegalArgumentException.class, () -> format.formatProgress(100L, 10L)); } @Test void testProgressedSizeWithoutSize() { - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); long _0_bytes = 0L; assertEquals("0 B", format.formatProgress(_0_bytes, -1L)); @@ -238,7 +236,7 @@ class FileSizeFormatTest { @Test void testProgressedBothZero() { - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); long _0_bytes = 0L; assertEquals("0 B", format.formatProgress(_0_bytes, _0_bytes)); @@ -246,7 +244,7 @@ class FileSizeFormatTest { @Test void testProgressedSizeWithSize() { - FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH); + FileSizeFormat format = new FileSizeFormat(); long _0_bytes = 0L; long _400_bytes = 400L;