kopia lustrzana https://github.com/gaul/s3proxy
Use var in foreach loops with Map.Entry types
rodzic
b9b9d74b2d
commit
5a129e54cf
|
@ -26,7 +26,6 @@ import java.util.Base64;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -143,7 +142,7 @@ final class AwsSignature {
|
|||
}
|
||||
|
||||
builder.append('\n');
|
||||
for (Map.Entry<String, String> entry : canonicalizedHeaders.entries()) {
|
||||
for (var entry : canonicalizedHeaders.entries()) {
|
||||
builder.append(entry.getKey()).append(':')
|
||||
.append(entry.getValue()).append('\n');
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.gaul.s3proxy;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ForwardingMultimap;
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
@ -29,7 +28,7 @@ final class CaseInsensitiveImmutableMultimap
|
|||
|
||||
CaseInsensitiveImmutableMultimap(Multimap<String, String> map) {
|
||||
var builder = ImmutableMultimap.<String, String>builder();
|
||||
for (Map.Entry<String, String> entry : map.entries()) {
|
||||
for (var entry : map.entries()) {
|
||||
builder.put(lower(entry.getKey()), entry.getValue());
|
||||
}
|
||||
this.inner = builder.build();
|
||||
|
|
|
@ -42,8 +42,7 @@ public final class GlobBlobStoreLocator implements BlobStoreLocator {
|
|||
locator.get(identity);
|
||||
Map.Entry<String, BlobStore> globEntry = null;
|
||||
if (container != null) {
|
||||
for (Map.Entry<PathMatcher, Map.Entry<String, BlobStore>>
|
||||
entry : globLocator.entrySet()) {
|
||||
for (var entry : globLocator.entrySet()) {
|
||||
if (entry.getKey().matches(FileSystems.getDefault()
|
||||
.getPath(container))) {
|
||||
globEntry = entry.getValue();
|
||||
|
|
|
@ -198,7 +198,7 @@ public final class Main {
|
|||
ExecutorService executorService, Properties properties)
|
||||
throws IOException {
|
||||
Properties altProperties = new Properties();
|
||||
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
|
||||
for (var entry : properties.entrySet()) {
|
||||
String key = (String) entry.getKey();
|
||||
if (key.startsWith(S3ProxyConstants.PROPERTY_ALT_JCLOUDS_PREFIX)) {
|
||||
key = key.substring(
|
||||
|
|
|
@ -228,7 +228,7 @@ public final class RegexBlobStore extends ForwardingBlobStore {
|
|||
private String replaceBlobName(String name) {
|
||||
String newName = name;
|
||||
|
||||
for (Map.Entry<Pattern, String> entry : this.regexs) {
|
||||
for (var entry : this.regexs) {
|
||||
Pattern pattern = entry.getKey();
|
||||
Matcher match = pattern.matcher(name);
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import java.util.Base64;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
@ -2323,9 +2322,8 @@ public class S3ProxyHandler {
|
|||
|
||||
ImmutableMap<Integer, MultipartPart> partsByListing =
|
||||
builder.build();
|
||||
for (Iterator<Map.Entry<Integer, String>> it =
|
||||
requestParts.entrySet().iterator(); it.hasNext();) {
|
||||
Map.Entry<Integer, String> entry = it.next();
|
||||
for (var it = requestParts.entrySet().iterator(); it.hasNext();) {
|
||||
var entry = it.next();
|
||||
MultipartPart part = partsByListing.get(entry.getKey());
|
||||
if (part == null) {
|
||||
throw new S3Exception(S3ErrorCode.INVALID_PART);
|
||||
|
@ -2468,7 +2466,7 @@ public class S3ProxyHandler {
|
|||
(size == null ? 0L : (long) size) + part.partSize());
|
||||
}
|
||||
parts = new ArrayList<>();
|
||||
for (Map.Entry<Integer, Long> entry : map.entrySet()) {
|
||||
for (var entry : map.entrySet()) {
|
||||
String eTag = ""; // TODO: bogus value
|
||||
Date lastModified = null; // TODO: bogus value
|
||||
parts.add(MultipartPart.create(entry.getKey(),
|
||||
|
@ -2928,8 +2926,7 @@ public class S3ProxyHandler {
|
|||
response.addHeader(AwsHttpHeaders.STORAGE_CLASS,
|
||||
StorageClass.fromTier(tier).toString());
|
||||
}
|
||||
for (Map.Entry<String, String> entry :
|
||||
metadata.getUserMetadata().entrySet()) {
|
||||
for (var entry : metadata.getUserMetadata().entrySet()) {
|
||||
response.addHeader(USER_METADATA_PREFIX + entry.getKey(),
|
||||
entry.getValue());
|
||||
}
|
||||
|
@ -2997,7 +2994,7 @@ public class S3ProxyHandler {
|
|||
writeSimpleElement(xml, "Code", code.getErrorCode());
|
||||
writeSimpleElement(xml, "Message", message);
|
||||
|
||||
for (Map.Entry<String, String> entry : elements.entrySet()) {
|
||||
for (var entry : elements.entrySet()) {
|
||||
writeSimpleElement(xml, entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ final class ShardedBlobStore extends ForwardingBlobStore {
|
|||
String container) {
|
||||
Map<String, String> currentSuperblockMeta =
|
||||
blob.getMetadata().getUserMetadata();
|
||||
for (Map.Entry<String, String> entry : expectedMeta.entrySet()) {
|
||||
for (var entry : expectedMeta.entrySet()) {
|
||||
String current = currentSuperblockMeta.get(entry.getKey());
|
||||
String expected = entry.getValue();
|
||||
if (!expected.equalsIgnoreCase(current)) {
|
||||
|
@ -532,7 +532,7 @@ final class ShardedBlobStore extends ForwardingBlobStore {
|
|||
shardBlobs.add(blob);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, List<String>> entry : shardMap.entrySet()) {
|
||||
for (var entry : shardMap.entrySet()) {
|
||||
this.delegate().removeBlobs(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
|
@ -173,9 +172,7 @@ public class Decryption {
|
|||
int partCounter = 1;
|
||||
|
||||
// we need the map in reversed order
|
||||
for (Map.Entry<Integer, PartPadding> part : partList.descendingMap()
|
||||
.entrySet()) {
|
||||
|
||||
for (var part : partList.descendingMap().entrySet()) {
|
||||
// check the parts that are between offset and end
|
||||
plaintextSize = plaintextSize + part.getValue().getSize();
|
||||
if (endAt > plaintextSize) {
|
||||
|
@ -234,9 +231,7 @@ public class Decryption {
|
|||
long partStartAt = 0;
|
||||
|
||||
// we need the map in reversed order
|
||||
for (Map.Entry<Integer, PartPadding> part : partList.descendingMap()
|
||||
.entrySet()) {
|
||||
|
||||
for (var part : partList.descendingMap().entrySet()) {
|
||||
// compute the plaintext size of the current part
|
||||
plaintextSize = plaintextSize + part.getValue().getSize();
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue