23
23
import java .text .DecimalFormatSymbols ;
24
24
import java .util .Locale ;
25
25
26
- import org .apache .commons .lang3 .Validate ;
27
26
import org .apache .maven .shared .utils .logging .MessageUtils ;
28
27
import org .eclipse .aether .transfer .AbstractTransferListener ;
29
28
import org .eclipse .aether .transfer .TransferCancelledException ;
@@ -105,7 +104,9 @@ public String symbol() {
105
104
public abstract String symbol ();
106
105
107
106
public static ScaleUnit getScaleUnit (long size ) {
108
- Validate .isTrue (size >= 0L , "file size cannot be negative: %s" , size );
107
+ if (size < 0L ) {
108
+ throw new IllegalArgumentException ("file size cannot be negative: " + size );
109
+ }
109
110
110
111
if (size >= GIGABYTE .bytes ()) {
111
112
return GIGABYTE ;
@@ -137,7 +138,9 @@ public String format(long size, ScaleUnit unit) {
137
138
138
139
@ SuppressWarnings ("checkstyle:magicnumber" )
139
140
public String format (long size , ScaleUnit unit , boolean omitSymbol ) {
140
- Validate .isTrue (size >= 0L , "file size cannot be negative: %s" , size );
141
+ if (size < 0L ) {
142
+ throw new IllegalArgumentException ("file size cannot be negative: " + size );
143
+ }
141
144
142
145
if (unit == null ) {
143
146
unit = ScaleUnit .getScaleUnit (size );
@@ -162,12 +165,13 @@ public String format(long size, ScaleUnit unit, boolean omitSymbol) {
162
165
}
163
166
164
167
public String formatProgress (long progressedSize , long size ) {
165
- Validate .isTrue (progressedSize >= 0L , "progressed file size cannot be negative: %s" , progressedSize );
166
- Validate .isTrue (
167
- size >= 0L && progressedSize <= size || size < 0L ,
168
- "progressed file size cannot be greater than size: %s > %s" ,
169
- progressedSize ,
170
- size );
168
+ if (progressedSize < 0L ) {
169
+ throw new IllegalArgumentException ("progressed file size cannot be negative: " + progressedSize );
170
+ }
171
+ if (size >= 0L && progressedSize > size ) {
172
+ throw new IllegalArgumentException (
173
+ "progressed file size cannot be greater than size: " + progressedSize + " > " + size );
174
+ }
171
175
172
176
if (size >= 0L && progressedSize != size ) {
173
177
ScaleUnit unit = ScaleUnit .getScaleUnit (size );
0 commit comments