mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
chore(style): replace var in more files no open PR touches (#5071)
* chore: replace var with explicit types in src/main files no open PR touches * chore: replace var with explicit types in src/test files no open PR touches * chore: replace var with explicit types in sdk-test-java files no open PR touches
This commit is contained in:
1 parent
97906c09b9
commit
ace5cbfc63
20 files changed
+153
-165
No files matched your search
+3
-3
@@ -1317,8 +1317,8 @@ public class ContainerLifecycleManager {
|
||||
private EndpointInfo resolveEndpoint(InspectContainerResponse inspect, int containerPort, String preferredNetwork) {
|
||||
if (!containerDetector.isRunningInContainer()) {
|
||||
// Native mode: use localhost and the bound host port
|
||||
var bindings = inspect.getNetworkSettings().getPorts().getBindings();
|
||||
var binding = bindings.get(ExposedPort.tcp(containerPort));
|
||||
Map<ExposedPort, Ports.Binding[]> bindings = inspect.getNetworkSettings().getPorts().getBindings();
|
||||
Ports.Binding[] binding = bindings.get(ExposedPort.tcp(containerPort));
|
||||
|
||||
if (binding != null && binding.length > 0) {
|
||||
int hostPort = Integer.parseInt(binding[0].getHostPortSpec());
|
||||
@@ -1343,7 +1343,7 @@ public class ContainerLifecycleManager {
|
||||
}
|
||||
|
||||
private String resolveContainerIp(InspectContainerResponse inspect, String preferredNetwork) {
|
||||
var networks = inspect.getNetworkSettings().getNetworks();
|
||||
Map<String, ContainerNetwork> networks = inspect.getNetworkSettings().getNetworks();
|
||||
if (networks != null) {
|
||||
// Prefer the configured network so that when the container is on both
|
||||
// bridge (default) and the service network, we return the right IP.
|
||||
|
||||
+1
-1
@@ -290,7 +290,7 @@ public class ContainerLogStreamer {
|
||||
private static final ScheduledExecutorService CLOSE_DRAIN_SCHEDULER = closeDrainScheduler();
|
||||
|
||||
private static ScheduledExecutorService closeDrainScheduler() {
|
||||
var scheduler = new ScheduledThreadPoolExecutor(1, runnable -> {
|
||||
ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1, runnable -> {
|
||||
Thread thread = new Thread(runnable, "floci-container-log-close");
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ public class CloudWatchMetricStreamsService {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Each member of StatisticsConfigurations requires at least one AdditionalStatistics entry.", 400);
|
||||
}
|
||||
for (var metric : configuration.getIncludeMetrics()) {
|
||||
for (MetricStreamStatisticsConfiguration.IncludeMetric metric : configuration.getIncludeMetrics()) {
|
||||
if (metric.namespace() == null || metric.namespace().isBlank()
|
||||
|| metric.metricName() == null || metric.metricName().isBlank()) {
|
||||
throw new AwsException("MissingParameter",
|
||||
|
||||
+3
-3
@@ -490,7 +490,7 @@ public class GlueSchemaRegistryService {
|
||||
info.getOtherMetadataValueList() != null
|
||||
? new ArrayList<>(info.getOtherMetadataValueList())
|
||||
: new ArrayList<>();
|
||||
for (var item : history) {
|
||||
for (MetadataInfo.OtherMetadataValueListItem item : history) {
|
||||
if (value.equals(item.getMetadataValue())) {
|
||||
throw new AwsException("AlreadyExistsException",
|
||||
"Metadata key/value pair already exists: " + key + "=" + value, 400);
|
||||
@@ -571,7 +571,7 @@ public class GlueSchemaRegistryService {
|
||||
return stored;
|
||||
}
|
||||
Map<String, MetadataInfo> filtered = new java.util.LinkedHashMap<>();
|
||||
for (var f : metadataList) {
|
||||
for (MetadataKeyValueFilter f : metadataList) {
|
||||
MetadataInfo info = stored.get(f.metadataKey());
|
||||
if (info == null) continue;
|
||||
if (f.metadataValue() == null || f.metadataValue().isBlank()) {
|
||||
@@ -579,7 +579,7 @@ public class GlueSchemaRegistryService {
|
||||
} else if (f.metadataValue().equals(info.getMetadataValue())) {
|
||||
filtered.put(f.metadataKey(), info);
|
||||
} else if (info.getOtherMetadataValueList() != null) {
|
||||
for (var item : info.getOtherMetadataValueList()) {
|
||||
for (MetadataInfo.OtherMetadataValueListItem item : info.getOtherMetadataValueList()) {
|
||||
if (f.metadataValue().equals(item.getMetadataValue())) {
|
||||
filtered.put(f.metadataKey(), info);
|
||||
break;
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import io.apicurio.registry.content.canon.AvroContentCanonicalizer;
|
||||
import io.apicurio.registry.content.canon.ContentCanonicalizer;
|
||||
import io.apicurio.registry.content.canon.JsonContentCanonicalizer;
|
||||
import io.apicurio.registry.content.canon.ProtobufContentCanonicalizer;
|
||||
import io.apicurio.registry.rules.RuleViolation;
|
||||
import io.apicurio.registry.rules.compatibility.AvroCompatibilityChecker;
|
||||
import io.apicurio.registry.rules.compatibility.CompatibilityChecker;
|
||||
import io.apicurio.registry.rules.compatibility.CompatibilityDifference;
|
||||
@@ -194,7 +195,7 @@ public final class SchemaCompatibilityChecker {
|
||||
}
|
||||
return result.getIncompatibleDifferences().stream()
|
||||
.map(d -> {
|
||||
var rv = d.asRuleViolation();
|
||||
RuleViolation rv = d.asRuleViolation();
|
||||
String desc = rv != null ? rv.getDescription() : null;
|
||||
String ctx = rv != null ? rv.getContext() : null;
|
||||
if (desc == null) {
|
||||
|
||||
@@ -416,7 +416,7 @@ public class WarmPool implements ContainerTeardown {
|
||||
long idleTimeoutMs = config.services().lambda().containerIdleTimeoutSeconds() * 1000L;
|
||||
long now = clock.millis();
|
||||
|
||||
for (var entry : poolStates.entrySet()) {
|
||||
for (Map.Entry<String, PoolState> entry : poolStates.entrySet()) {
|
||||
String functionName = entry.getKey();
|
||||
PoolState poolState = entry.getValue();
|
||||
List<ContainerHandle> toEvict = new ArrayList<>();
|
||||
|
||||
+7
-5
@@ -1,5 +1,6 @@
|
||||
package io.github.hectorvent.floci.services.lambda.launcher;
|
||||
|
||||
import com.github.dockerjava.api.command.ExecCreateCmd;
|
||||
import io.github.hectorvent.floci.config.EmulatorConfig;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerBuilder;
|
||||
@@ -56,6 +57,7 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Starts and stops Docker containers for Lambda function execution.
|
||||
@@ -315,7 +317,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
|
||||
}
|
||||
|
||||
if (fn.getFileSystemConfigs() != null && !fn.getFileSystemConfigs().isEmpty()) {
|
||||
var efsCfg = config.storage().efs();
|
||||
EmulatorConfig.EfsSharingConfig efsCfg = config.storage().efs();
|
||||
fn.getFileSystemConfigs().forEach(fileSystem -> {
|
||||
String volumeName = efsVolumeName(fileSystem.getArn());
|
||||
lifecycleManager.ensureSharedVolume(volumeName,
|
||||
@@ -1119,7 +1121,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
|
||||
static boolean shouldUseCodeVolume(Path codeDir) {
|
||||
final long threshold = CODE_VOLUME_MIN_BYTES;
|
||||
final long[] total = {0L};
|
||||
try (var stream = Files.walk(codeDir)) {
|
||||
try (Stream<Path> stream = Files.walk(codeDir)) {
|
||||
for (Path path : (Iterable<Path>) stream::iterator) {
|
||||
if (Files.isRegularFile(path)) {
|
||||
total[0] += Files.size(path);
|
||||
@@ -1419,7 +1421,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
|
||||
for (String name : extensionNames) {
|
||||
try {
|
||||
String path = EXTENSIONS_DIR + "/" + name;
|
||||
var create = dockerClient.execCreateCmd(containerId)
|
||||
ExecCreateCmd create = dockerClient.execCreateCmd(containerId)
|
||||
.withCmd(path)
|
||||
.withAttachStdout(true)
|
||||
.withAttachStderr(true);
|
||||
@@ -1524,7 +1526,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
|
||||
*/
|
||||
private static void createTarFromDir(Path sourceDir, OutputStream out) throws IOException {
|
||||
try (TarArchiveOutputStream tar = RetryingTarCopier.newTarStream(out);
|
||||
var stream = Files.walk(sourceDir)) {
|
||||
Stream<Path> stream = Files.walk(sourceDir)) {
|
||||
for (Path path : (Iterable<Path>) stream::iterator) {
|
||||
if (Files.isDirectory(path)) {
|
||||
continue;
|
||||
@@ -1534,7 +1536,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
|
||||
entry.setSize(Files.size(path));
|
||||
entry.setMode(0755);
|
||||
tar.putArchiveEntry(entry);
|
||||
try (var fis = Files.newInputStream(path)) {
|
||||
try (InputStream fis = Files.newInputStream(path)) {
|
||||
fis.transferTo(tar);
|
||||
}
|
||||
tar.closeArchiveEntry();
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.jboss.logging.Logger;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -265,7 +266,7 @@ public class MwaaEnvironmentManager {
|
||||
return false;
|
||||
}
|
||||
String body;
|
||||
try (var in = conn.getInputStream()) {
|
||||
try (InputStream in = conn.getInputStream()) {
|
||||
body = new String(in.readAllBytes(), StandardCharsets.UTF_8);
|
||||
}
|
||||
return body.contains("\"metadatabase\"") && body.contains("\"scheduler\"")
|
||||
|
||||
@@ -6791,7 +6791,7 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
|
||||
String requestedTag = engineVersion.trim();
|
||||
// Aurora MySQL versions read 8.0.mysql_aurora.3.08.0. The MySQL image tag is the part in front.
|
||||
var auroraSuffix = requestedTag.indexOf(".mysql_aurora.");
|
||||
int auroraSuffix = requestedTag.indexOf(".mysql_aurora.");
|
||||
if (auroraSuffix > 0) {
|
||||
requestedTag = requestedTag.substring(0, auroraSuffix);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class SesQueryHandler {
|
||||
private Response handleGetIdentityVerificationAttributes(MultivaluedMap<String, String> params, String region) {
|
||||
List<String> identities = extractMembers(params, "Identities");
|
||||
|
||||
var xml = new XmlBuilder().start("VerificationAttributes");
|
||||
XmlBuilder xml = new XmlBuilder().start("VerificationAttributes");
|
||||
for (String identityValue : identities) {
|
||||
Identity identity =
|
||||
identityService.getIdentityVerificationAttributes(identityValue, region);
|
||||
@@ -306,7 +306,7 @@ public class SesQueryHandler {
|
||||
}
|
||||
|
||||
private Response handleGetSendQuota(String region) {
|
||||
var xml = new XmlBuilder()
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.elem("Max24HourSend", "200.0")
|
||||
.elem("MaxSendRate", "1.0")
|
||||
.elem("SentLast24Hours",
|
||||
@@ -316,7 +316,7 @@ public class SesQueryHandler {
|
||||
|
||||
private Response handleGetSendStatistics(String region) {
|
||||
long sentCount = sentEmailService.countInRegion(region);
|
||||
var xml = new XmlBuilder().start("SendDataPoints");
|
||||
XmlBuilder xml = new XmlBuilder().start("SendDataPoints");
|
||||
if (sentCount > 0) {
|
||||
xml.start("member")
|
||||
.elem("DeliveryAttempts", String.valueOf(sentCount))
|
||||
@@ -344,7 +344,7 @@ public class SesQueryHandler {
|
||||
|
||||
private Response handleListVerifiedEmailAddresses(String region) {
|
||||
List<String> emails = identityService.getVerifiedEmailAddresses(region);
|
||||
var xml = new XmlBuilder().start("VerifiedEmailAddresses");
|
||||
XmlBuilder xml = new XmlBuilder().start("VerifiedEmailAddresses");
|
||||
for (String email : emails) {
|
||||
xml.elem("member", email);
|
||||
}
|
||||
@@ -370,7 +370,7 @@ public class SesQueryHandler {
|
||||
private Response handleGetIdentityNotificationAttributes(MultivaluedMap<String, String> params, String region) {
|
||||
List<String> identities = extractMembers(params, "Identities");
|
||||
|
||||
var xml = new XmlBuilder().start("NotificationAttributes");
|
||||
XmlBuilder xml = new XmlBuilder().start("NotificationAttributes");
|
||||
for (String identityValue : identities) {
|
||||
Identity identity =
|
||||
identityService.getIdentityNotificationAttributes(identityValue, region);
|
||||
@@ -400,7 +400,7 @@ public class SesQueryHandler {
|
||||
private Response handleGetIdentityDkimAttributes(MultivaluedMap<String, String> params, String region) {
|
||||
List<String> identities = extractMembers(params, "Identities");
|
||||
|
||||
var xml = new XmlBuilder().start("DkimAttributes");
|
||||
XmlBuilder xml = new XmlBuilder().start("DkimAttributes");
|
||||
for (String identityValue : identities) {
|
||||
Identity identity =
|
||||
identityService.getIdentityVerificationAttributes(identityValue, region);
|
||||
@@ -442,7 +442,7 @@ public class SesQueryHandler {
|
||||
private Response handleVerifyDomainDkim(MultivaluedMap<String, String> params, String region) {
|
||||
String domain = getParam(params, "Domain");
|
||||
List<String> tokens = identityService.verifyDomainDkim(domain, region);
|
||||
var xml = new XmlBuilder().start("DkimTokens");
|
||||
XmlBuilder xml = new XmlBuilder().start("DkimTokens");
|
||||
for (String token : tokens) {
|
||||
xml.elem("member", token);
|
||||
}
|
||||
@@ -496,7 +496,7 @@ public class SesQueryHandler {
|
||||
|
||||
private Response handleGetIdentityMailFromDomainAttributes(MultivaluedMap<String, String> params, String region) {
|
||||
List<String> identities = extractMembers(params, "Identities");
|
||||
var xml = new XmlBuilder().start("MailFromDomainAttributes");
|
||||
XmlBuilder xml = new XmlBuilder().start("MailFromDomainAttributes");
|
||||
for (String identityValue : identities) {
|
||||
Identity identity = identityService.getMailFromAttributes(identityValue, region);
|
||||
xml.start("entry");
|
||||
@@ -529,7 +529,7 @@ public class SesQueryHandler {
|
||||
String identity = requireParam(params, "Identity");
|
||||
List<String> names = extractMembers(params, "PolicyNames");
|
||||
Map<String, String> policies = policyService.getIdentityPolicies(identity, names, region);
|
||||
var xml = new XmlBuilder().start("Policies");
|
||||
XmlBuilder xml = new XmlBuilder().start("Policies");
|
||||
policies.forEach((name, doc) -> xml.start("entry").elem("key", name).elem("value", doc).end("entry"));
|
||||
xml.end("Policies");
|
||||
return Response.ok(AwsQueryResponse.envelope("GetIdentityPolicies", AwsNamespaces.SES, xml.build())).build();
|
||||
@@ -537,7 +537,7 @@ public class SesQueryHandler {
|
||||
|
||||
private Response handleListIdentityPolicies(MultivaluedMap<String, String> params, String region) {
|
||||
String identity = requireParam(params, "Identity");
|
||||
var xml = new XmlBuilder().start("PolicyNames");
|
||||
XmlBuilder xml = new XmlBuilder().start("PolicyNames");
|
||||
for (String name : policyService.listIdentityPolicyNames(identity, region)) {
|
||||
xml.elem("member", name);
|
||||
}
|
||||
@@ -569,7 +569,7 @@ public class SesQueryHandler {
|
||||
private Response handleGetTemplate(MultivaluedMap<String, String> params, String region) {
|
||||
String templateName = getParam(params, "TemplateName");
|
||||
EmailTemplate template = templateService.getTemplate(templateName, region);
|
||||
var xml = new XmlBuilder().start("Template")
|
||||
XmlBuilder xml = new XmlBuilder().start("Template")
|
||||
.elem("TemplateName", template.getTemplateName());
|
||||
if (template.getSubject() != null) {
|
||||
xml.elem("SubjectPart", template.getSubject());
|
||||
@@ -1448,7 +1448,7 @@ public class SesQueryHandler {
|
||||
private static final java.util.Map<String, String> INTERNAL_EVENT_TYPE_TO_V1;
|
||||
static {
|
||||
java.util.Map<String, String> reverse = new java.util.HashMap<>();
|
||||
for (var e : V1_EVENT_TYPE_TO_INTERNAL.entrySet()) {
|
||||
for (Map.Entry<String, String> e : V1_EVENT_TYPE_TO_INTERNAL.entrySet()) {
|
||||
reverse.put(e.getValue(), e.getKey());
|
||||
}
|
||||
INTERNAL_EVENT_TYPE_TO_V1 = java.util.Map.copyOf(reverse);
|
||||
|
||||
Reference in new issue
Block a user