| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d092c9b commit 8bcb2de
76 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,6 +52,7 @@ | |||
| 52 | 52 | import java.nio.channels.ReadableByteChannel; | |
| 53 | 53 | import java.nio.channels.ScatteringByteChannel; | |
| 54 | 54 | import java.util.List; | |
| 55 | + import java.util.Locale; | ||
| 55 | 56 | import java.util.Map; | |
| 56 | 57 | import java.util.Map.Entry; | |
| 57 | 58 | import java.util.function.Function; | |
@@ -318,7 +319,10 @@ private static String getHeaderValue(@NonNull HttpHeaders headers, @NonNull Stri | |||
| 318 | 319 | } else { | |
| 319 | 320 | throw new IllegalStateException( | |
| 320 | 321 | String.format( | |
| 321 | - "Unexpected header type '%s' for header %s", o.getClass().getName(), headerName)); | ||
| 322 | + Locale.US, | ||
| 323 | + "Unexpected header type '%s' for header %s", | ||
| 324 | + o.getClass().getName(), | ||
| 325 | + headerName)); | ||
| 322 | 326 | } | |
| 323 | 327 | } | |
| 324 | 328 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,7 @@ | |||
| 40 | 40 | import java.util.Collections; | |
| 41 | 41 | import java.util.HashMap; | |
| 42 | 42 | import java.util.List; | |
| 43 | + import java.util.Locale; | ||
| 43 | 44 | import java.util.Map; | |
| 44 | 45 | import java.util.Objects; | |
| 45 | 46 | import java.util.Set; | |
@@ -1441,7 +1442,7 @@ public String getMd5ToHexString() { | |||
| 1441 | 1442 | byte[] decodedMd5 = BaseEncoding.base64().decode(md5); | |
| 1442 | 1443 | StringBuilder stringBuilder = new StringBuilder(); | |
| 1443 | 1444 | for (byte b : decodedMd5) { | |
| 1444 | - stringBuilder.append(String.format("%02x", b & 0xff)); | ||
| 1445 | + stringBuilder.append(String.format(Locale.US, "%02x", b & 0xff)); | ||
| 1445 | 1446 | } | |
| 1446 | 1447 | return stringBuilder.toString(); | |
| 1447 | 1448 | } | |
@@ -1473,7 +1474,7 @@ public String getCrc32cToHexString() { | |||
| 1473 | 1474 | byte[] decodeCrc32c = BaseEncoding.base64().decode(crc32c); | |
| 1474 | 1475 | StringBuilder stringBuilder = new StringBuilder(); | |
| 1475 | 1476 | for (byte b : decodeCrc32c) { | |
| 1476 | - stringBuilder.append(String.format("%02x", b & 0xff)); | ||
| 1477 | + stringBuilder.append(String.format(Locale.US, "%02x", b & 0xff)); | ||
| 1477 | 1478 | } | |
| 1478 | 1479 | return stringBuilder.toString(); | |
| 1479 | 1480 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,6 +24,7 @@ | |||
| 24 | 24 | import com.google.common.base.MoreObjects.ToStringHelper; | |
| 25 | 25 | import com.google.storage.v2.ReadObjectRequest; | |
| 26 | 26 | import java.io.Serializable; | |
| 27 | + import java.util.Locale; | ||
| 27 | 28 | import java.util.Objects; | |
| 28 | 29 | import java.util.function.BiFunction; | |
| 29 | 30 | import javax.annotation.concurrent.Immutable; | |
@@ -239,12 +240,12 @@ public ReadObjectRequest.Builder seekReadObjectRequest(ReadObjectRequest.Builder | |||
| 239 | 240 | ||
| 240 | 241 | @Override | |
| 241 | 242 | protected String fmtAsHttpRangeHeader() throws ArithmeticException { | |
| 242 | - return String.format("bytes=%d-%d", beginOffset, endOffsetInclusive()); | ||
| 243 | + return String.format(Locale.US, "bytes=%d-%d", beginOffset, endOffsetInclusive()); | ||
| 243 | 244 | } | |
| 244 | 245 | ||
| 245 | 246 | @Override | |
| 246 | 247 | protected ToStringHelper append(ToStringHelper tsh) { | |
| 247 | - return tsh.addValue(String.format("%d + %d", beginOffset, length)); | ||
| 248 | + return tsh.addValue(String.format(Locale.US, "%d + %d", beginOffset, length)); | ||
| 248 | 249 | } | |
| 249 | 250 | } | |
| 250 | 251 | ||
@@ -324,12 +325,12 @@ public ReadObjectRequest.Builder seekReadObjectRequest(ReadObjectRequest.Builder | |||
| 324 | 325 | ||
| 325 | 326 | @Override | |
| 326 | 327 | protected String fmtAsHttpRangeHeader() throws ArithmeticException { | |
| 327 | - return String.format("bytes=%d-%d", beginOffset, endOffsetInclusive()); | ||
| 328 | + return String.format(Locale.US, "bytes=%d-%d", beginOffset, endOffsetInclusive()); | ||
| 328 | 329 | } | |
| 329 | 330 | ||
| 330 | 331 | @Override | |
| 331 | 332 | protected ToStringHelper append(ToStringHelper tsh) { | |
| 332 | - return tsh.addValue(String.format("[%d, %d)", beginOffset, endOffsetExclusive)); | ||
| 333 | + return tsh.addValue(String.format(Locale.US, "[%d, %d)", beginOffset, endOffsetExclusive)); | ||
| 333 | 334 | } | |
| 334 | 335 | } | |
| 335 | 336 | ||
@@ -409,12 +410,12 @@ public ReadObjectRequest.Builder seekReadObjectRequest(ReadObjectRequest.Builder | |||
| 409 | 410 | ||
| 410 | 411 | @Override | |
| 411 | 412 | protected String fmtAsHttpRangeHeader() throws ArithmeticException { | |
| 412 | - return String.format("bytes=%d-%d", beginOffset, endOffsetInclusive); | ||
| 413 | + return String.format(Locale.US, "bytes=%d-%d", beginOffset, endOffsetInclusive); | ||
| 413 | 414 | } | |
| 414 | 415 | ||
| 415 | 416 | @Override | |
| 416 | 417 | protected ToStringHelper append(ToStringHelper tsh) { | |
| 417 | - return tsh.addValue(String.format("[%d, %d]", beginOffset, endOffsetInclusive)); | ||
| 418 | + return tsh.addValue(String.format(Locale.US, "[%d, %d]", beginOffset, endOffsetInclusive)); | ||
| 418 | 419 | } | |
| 419 | 420 | } | |
| 420 | 421 | ||
@@ -488,17 +489,17 @@ public ReadObjectRequest.Builder seekReadObjectRequest(ReadObjectRequest.Builder | |||
| 488 | 489 | @Override | |
| 489 | 490 | protected String fmtAsHttpRangeHeader() throws ArithmeticException { | |
| 490 | 491 | if (beginOffset > 0) { | |
| 491 | - return String.format("bytes=%d-", beginOffset); | ||
| 492 | + return String.format(Locale.US, "bytes=%d-", beginOffset); | ||
| 492 | 493 | } else if (beginOffset < 0) { | |
| 493 | - return String.format("bytes=%d", beginOffset); | ||
| 494 | + return String.format(Locale.US, "bytes=%d", beginOffset); | ||
| 494 | 495 | } else { | |
| 495 | 496 | return null; | |
| 496 | 497 | } | |
| 497 | 498 | } | |
| 498 | 499 | ||
| 499 | 500 | @Override | |
| 500 | 501 | protected ToStringHelper append(ToStringHelper tsh) { | |
| 501 | - return tsh.addValue(String.format("[%d, +INF)", beginOffset)); | ||
| 502 | + return tsh.addValue(String.format(Locale.US, "[%d, +INF)", beginOffset)); | ||
| 502 | 503 | } | |
| 503 | 504 | } | |
| 504 | 505 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | package com.google.cloud.storage; | |
| 18 | 18 | ||
| 19 | + import java.util.Locale; | ||
| 19 | 20 | import java.util.Objects; | |
| 20 | 21 | ||
| 21 | 22 | abstract class Crc32cValue<Res extends Crc32cValue<Res>> { | |
@@ -64,7 +65,7 @@ static Crc32cLengthKnown of(int value, long length) { | |||
| 64 | 65 | } | |
| 65 | 66 | ||
| 66 | 67 | static String fmtCrc32cValue(int value1) { | |
| 67 | - return String.format("crc32c{0x%08x}", value1); | ||
| 68 | + return String.format(Locale.US, "crc32c{0x%08x}", value1); | ||
| 68 | 69 | } | |
| 69 | 70 | ||
| 70 | 71 | static final class Crc32cLengthUnknown extends Crc32cValue<Crc32cLengthUnknown> { | |
@@ -142,7 +143,7 @@ public Crc32cLengthKnown concat(Crc32cLengthKnown other) { | |||
| 142 | 143 | ||
| 143 | 144 | @Override | |
| 144 | 145 | public String toString() { | |
| 145 | - return String.format("crc32c{0x%08x (length = %d)}", value, length); | ||
| 146 | + return String.format(Locale.US, "crc32c{0x%08x (length = %d)}", value, length); | ||
| 146 | 147 | } | |
| 147 | 148 | ||
| 148 | 149 | @Override | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | 19 | import com.google.cloud.storage.TransportCompatibility.Transport; | |
| 20 | 20 | import java.util.Arrays; | |
| 21 | + import java.util.Locale; | ||
| 21 | 22 | import java.util.stream.Collectors; | |
| 22 | 23 | ||
| 23 | 24 | final class CrossTransportUtils { | |
@@ -49,12 +50,20 @@ static <T> T throwTransportOnly(Class<?> clazz, String methodName, Transport tra | |||
| 49 | 50 | break; | |
| 50 | 51 | default: | |
| 51 | 52 | throw new IllegalStateException( | |
| 52 | - String.format("Broken Java Enum: %s received value: '%s'", Transport.class, transport)); | ||
| 53 | + String.format( | ||
| 54 | + Locale.US, | ||
| 55 | + "Broken Java Enum: %s received value: '%s'", | ||
| 56 | + Transport.class, | ||
| 57 | + transport)); | ||
| 53 | 58 | } | |
| 54 | 59 | String message = | |
| 55 | 60 | String.format( | |
| 61 | + Locale.US, | ||
| 56 | 62 | "%s#%s is only supported for %s transport. Please use %s to construct a compatible instance.", | |
| 57 | - clazz.getName(), methodName, transport, builder); | ||
| 63 | + clazz.getName(), | ||
| 64 | + methodName, | ||
| 65 | + transport, | ||
| 66 | + builder); | ||
| 58 | 67 | throw new UnsupportedOperationException(message); | |
| 59 | 68 | } | |
| 60 | 69 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,6 +42,7 @@ | |||
| 42 | 42 | import java.nio.ByteBuffer; | |
| 43 | 43 | import java.nio.channels.ClosedChannelException; | |
| 44 | 44 | import java.nio.channels.ScatteringByteChannel; | |
| 45 | + import java.util.Locale; | ||
| 45 | 46 | import java.util.concurrent.ArrayBlockingQueue; | |
| 46 | 47 | import java.util.concurrent.CancellationException; | |
| 47 | 48 | import java.util.concurrent.ExecutionException; | |
@@ -166,8 +167,10 @@ public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { | |||
| 166 | 167 | } else if (metadata.getGeneration() != respMetadata.getGeneration()) { | |
| 167 | 168 | throw closeWithError( | |
| 168 | 169 | String.format( | |
| 170 | + Locale.US, | ||
| 169 | 171 | "Mismatch Generation between subsequent reads. Expected %d but received %d", | |
| 170 | - metadata.getGeneration(), respMetadata.getGeneration())); | ||
| 172 | + metadata.getGeneration(), | ||
| 173 | + respMetadata.getGeneration())); | ||
| 171 | 174 | } | |
| 172 | 175 | } | |
| 173 | 176 | ChecksummedData checksummedData = resp.getChecksummedData(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -96,6 +96,7 @@ | |||
| 96 | 96 | import java.util.IdentityHashMap; | |
| 97 | 97 | import java.util.Iterator; | |
| 98 | 98 | import java.util.List; | |
| 99 | + import java.util.Locale; | ||
| 99 | 100 | import java.util.Map; | |
| 100 | 101 | import java.util.Map.Entry; | |
| 101 | 102 | import java.util.Objects; | |
@@ -210,10 +211,10 @@ private Tuple<StorageSettings, Opts<UserProject>> resolveSettingsAndOpts() throw | |||
| 210 | 211 | // unless for Direct Google Access try and strip here if we can | |
| 211 | 212 | switch (scheme) { | |
| 212 | 213 | case "http": | |
| 213 | - endpoint = String.format("%s:%s", uri.getHost(), port > 0 ? port : 80); | ||
| 214 | + endpoint = String.format(Locale.US, "%s:%s", uri.getHost(), port > 0 ? port : 80); | ||
| 214 | 215 | break; | |
| 215 | 216 | case "https": | |
| 216 | - endpoint = String.format("%s:%s", uri.getHost(), port > 0 ? port : 443); | ||
| 217 | + endpoint = String.format(Locale.US, "%s:%s", uri.getHost(), port > 0 ? port : 443); | ||
| 217 | 218 | break; | |
| 218 | 219 | } | |
| 219 | 220 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ | |||
| 19 | 19 | import com.google.api.gax.grpc.GrpcCallContext; | |
| 20 | 20 | import com.google.common.collect.ImmutableList; | |
| 21 | 21 | import com.google.common.collect.ImmutableMap; | |
| 22 | + import java.util.Locale; | ||
| 22 | 23 | ||
| 23 | 24 | final class GrpcUtils { | |
| 24 | 25 | ||
@@ -28,7 +29,8 @@ static GrpcCallContext contextWithBucketName(String bucketName, GrpcCallContext | |||
| 28 | 29 | if (bucketName != null && !bucketName.isEmpty()) { | |
| 29 | 30 | return baseContext.withExtraHeaders( | |
| 30 | 31 | ImmutableMap.of( | |
| 31 | - "x-goog-request-params", ImmutableList.of(String.format("bucket=%s", bucketName)))); | ||
| 32 | + "x-goog-request-params", | ||
| 33 | + ImmutableList.of(String.format(Locale.US, "bucket=%s", bucketName)))); | ||
| 32 | 34 | } | |
| 33 | 35 | return baseContext; | |
| 34 | 36 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,7 @@ | |||
| 21 | 21 | import java.io.IOException; | |
| 22 | 22 | import java.nio.ByteBuffer; | |
| 23 | 23 | import java.util.List; | |
| 24 | + import java.util.Locale; | ||
| 24 | 25 | import java.util.function.Supplier; | |
| 25 | 26 | import javax.annotation.concurrent.Immutable; | |
| 26 | 27 | import org.checkerframework.checker.nullness.qual.Nullable; | |
@@ -98,8 +99,10 @@ public void validate(Crc32cValue<?> expected, List<ByteBuffer> b) throws IOExcep | |||
| 98 | 99 | if (!actual.eqValue(expected)) { | |
| 99 | 100 | throw new IOException( | |
| 100 | 101 | String.format( | |
| 102 | + Locale.US, | ||
| 101 | 103 | "Mismatch checksum value. Expected %s actual %s", | |
| 102 | - expected.debugString(), actual.debugString())); | ||
| 104 | + expected.debugString(), | ||
| 105 | + actual.debugString())); | ||
| 103 | 106 | } | |
| 104 | 107 | } | |
| 105 | 108 | ||
@@ -109,8 +112,10 @@ public void validate(Crc32cValue<?> expected, Supplier<ByteBuffer> b) throws IOE | |||
| 109 | 112 | if (!actual.eqValue(expected)) { | |
| 110 | 113 | throw new IOException( | |
| 111 | 114 | String.format( | |
| 115 | + Locale.US, | ||
| 112 | 116 | "Mismatch checksum value. Expected %s actual %s", | |
| 113 | - expected.debugString(), actual.debugString())); | ||
| 117 | + expected.debugString(), | ||
| 118 | + actual.debugString())); | ||
| 114 | 119 | } | |
| 115 | 120 | } | |
| 116 | 121 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ | |||
| 19 | 19 | import static com.google.common.base.Preconditions.checkArgument; | |
| 20 | 20 | ||
| 21 | 21 | import com.google.common.base.MoreObjects; | |
| 22 | + import java.util.Locale; | ||
| 22 | 23 | import java.util.Objects; | |
| 23 | 24 | import java.util.function.UnaryOperator; | |
| 24 | 25 | ||
@@ -91,7 +92,8 @@ private Incomplete(ByteRangeSpec spec) { | |||
| 91 | 92 | ||
| 92 | 93 | @Override | |
| 93 | 94 | public String getHeaderValue() { | |
| 94 | - return String.format("bytes %d-%d/*", spec.beginOffset(), spec.endOffsetInclusive()); | ||
| 95 | + return String.format( | ||
| 96 | + Locale.US, "bytes %d-%d/*", spec.beginOffset(), spec.endOffsetInclusive()); | ||
| 95 | 97 | } | |
| 96 | 98 | ||
| 97 | 99 | @Override | |
@@ -145,7 +147,8 @@ private Total(ByteRangeSpec spec, long size) { | |||
| 145 | 147 | ||
| 146 | 148 | @Override | |
| 147 | 149 | public String getHeaderValue() { | |
| 148 | - return String.format("bytes %d-%d/%d", spec.beginOffset(), spec.endOffsetInclusive(), size); | ||
| 150 | + return String.format( | ||
| 151 | + Locale.US, "bytes %d-%d/%d", spec.beginOffset(), spec.endOffsetInclusive(), size); | ||
| 149 | 152 | } | |
| 150 | 153 | ||
| 151 | 154 | @Override | |
@@ -202,7 +205,7 @@ private Size(long size) { | |||
| 202 | 205 | ||
| 203 | 206 | @Override | |
| 204 | 207 | public String getHeaderValue() { | |
| 205 | - return String.format("bytes */%d", size); | ||
| 208 | + return String.format(Locale.US, "bytes */%d", size); | ||
| 206 | 209 | } | |
| 207 | 210 | ||
| 208 | 211 | @Override | |
| Back | FazBrowse Home | New Git URL |
0 commit comments