Skip to content

Commit 0d85227

Browse files
committed
Replace isEmpty with .equals()
1 parent d97972b commit 0d85227

File tree

11 files changed

+16
-16
lines changed

11 files changed

+16
-16
lines changed

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/misc/RuntimeMetricsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private void testGaugeMetrics(
105105
.allMatch(
106106
dp -> {
107107
boolean valid = true;
108-
if (!attributeKey.isEmpty()) {
108+
if (!attributeKey.equals("")) {
109109
valid =
110110
dp.getAttributesList().stream()
111111
.anyMatch(attribute -> attribute.getKey().equals(attributeKey));
@@ -129,7 +129,7 @@ private void testCounterMetrics(
129129
.allMatch(
130130
dp -> {
131131
boolean valid = true;
132-
if (!attributeKey.isEmpty()) {
132+
if (!attributeKey.equals("")) {
133133
valid =
134134
dp.getAttributesList().stream()
135135
.anyMatch(attribute -> attribute.getKey().equals(attributeKey));

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/utils/MockCollectorClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private List<ResourceScopeMetric> fetchMetrics(Set<String> presentMetrics, boole
160160
.flatMap(x -> x.getMetricsList().stream())
161161
.map(x -> x.getName())
162162
.collect(Collectors.toSet());
163-
if (!exported.isEmpty() && receivedMetrics.containsAll(presentMetrics)) {
163+
if (!exported.equals("") && receivedMetrics.containsAll(presentMetrics)) {
164164
if (exactMatch) {
165165
return current.size() == exported.size();
166166
} else {
@@ -183,7 +183,7 @@ private List<ResourceScopeMetric> fetchMetrics(Set<String> presentMetrics, boole
183183
private <T> List<T> waitForContent(String url, TypeReference<List<T>> t) {
184184
// Verify that there is no more data to be received
185185
return this.waitForContent(
186-
url, t, (current, exported) -> (!exported.isEmpty() && current.size() == exported.size()));
186+
url, t, (current, exported) -> (!exported.equals("") && current.size() == exported.size()));
187187
}
188188

189189
private <T> List<T> waitForContent(

appsignals-tests/images/http-servers/tomcat/src/main/java/software/amazon/opentelemetry/appsignals/tests/images/httpservers/tomcat/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static void main(String[] args) throws Exception {
2626
// The port that we should run on can be set into an environment variable
2727
// Look for that variable and default to 8080 if it isn't there.
2828
String webPort = System.getenv("PORT");
29-
if (webPort == null || webPort.isEmpty()) {
29+
if (webPort == null || webPort.equals("")) {
3030
webPort = "8080";
3131
}
3232

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ private static String generateRemoteService(SpanData span) {
332332
String httpUrl = span.getAttributes().get(HTTP_URL);
333333
try {
334334
URL url = new URL(httpUrl);
335-
if (!url.getHost().isEmpty()) {
335+
if (!url.getHost().equals("")) {
336336
remoteService = url.getHost();
337337
if (url.getPort() != -1) {
338338
remoteService += ":" + url.getPort();
@@ -502,7 +502,7 @@ private static void setRemoteResourceTypeAndIdentifier(SpanData span, Attributes
502502
remoteResourceIdentifier = getDbConnection(span);
503503
}
504504

505-
if (cloudformationPrimaryIdentifier.isEmpty()) {
505+
if (cloudformationPrimaryIdentifier.equals("")) {
506506
cloudformationPrimaryIdentifier = remoteResourceIdentifier;
507507
}
508508

@@ -728,7 +728,7 @@ private static String getDBStatementRemoteOperation(
728728
}
729729

730730
Matcher matcher = SQL_DIALECT_PATTERN.matcher(remoteOperation.toUpperCase());
731-
if (matcher.find() && !matcher.group(0).isEmpty()) {
731+
if (matcher.find() && !matcher.group(0).equals("")) {
732732
remoteOperation = matcher.group(0);
733733
} else {
734734
remoteOperation = UNKNOWN_REMOTE_OPERATION;

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributesSpanExporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private List<SpanData> addMetricAttributes(Collection<SpanData> spans) {
115115
attributes = attributeMap.get(MetricAttributeGenerator.DEPENDENCY_METRIC);
116116
}
117117

118-
if (!attributes.isEmpty()) {
118+
if (!attributes.equals("")) {
119119
span = wrapSpanWithAttributes(span, attributes);
120120
}
121121
modifiedSpans.add(span);

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private void recordLatency(ReadableSpan span, Attributes attributes) {
165165

166166
private void recordMetrics(ReadableSpan span, SpanData spanData, Attributes attributes) {
167167
// Only record metrics if non-empty attributes are returned.
168-
if (!attributes.isEmpty()) {
168+
if (!attributes.equals("")) {
169169
recordErrorOrFault(spanData, attributes);
170170
recordLatency(span, attributes);
171171
}

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static String getEgressOperation(SpanData span) {
109109
* @return the first part from the http target. Eg, /payment
110110
*/
111111
static String extractAPIPathValue(String httpTarget) {
112-
if (httpTarget == null || httpTarget.isEmpty()) {
112+
if (httpTarget == null || httpTarget.equals("")) {
113113
return "/";
114114
}
115115
String[] paths = httpTarget.split("/");

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/ScopeBasedPeriodicMetricReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ CompletableResultCode doRun() {
200200
if (exportAvailable.compareAndSet(true, false)) {
201201
try {
202202
Collection<MetricData> metricData = collectionRegistration.collectAllMetrics();
203-
if (metricData.isEmpty()) {
203+
if (metricData.equals("")) {
204204
logger.log(Level.FINE, "No metric data to export - skipping export.");
205205
flushResult.succeed();
206206
exportAvailable.set(true);

awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ private void validateAttributesProducedForNonLocalRootSpanOfKind(
10051005
GENERATOR.generateMetricAttributeMapFromSpan(spanDataMock, resource);
10061006
Attributes serviceAttributes = attributeMap.get(SERVICE_METRIC);
10071007
Attributes dependencyAttributes = attributeMap.get(DEPENDENCY_METRIC);
1008-
if (!attributeMap.isEmpty()) {
1008+
if (!attributeMap.equals("")) {
10091009
if (SpanKind.PRODUCER.equals(kind)
10101010
|| SpanKind.CLIENT.equals(kind)
10111011
|| SpanKind.CONSUMER.equals(kind)) {
@@ -1120,7 +1120,7 @@ private void validateHttpStatusForNonLocalRootWithThrowableForClient(
11201120
Map<String, Attributes> attributeMap =
11211121
GENERATOR.generateMetricAttributeMapFromSpan(spanDataMock, resource);
11221122
Attributes actualAttributes = Attributes.empty();
1123-
if (!attributeMap.isEmpty()) {
1123+
if (!attributeMap.equals("")) {
11241124
if (SpanKind.PRODUCER.equals(spanKind)
11251125
|| SpanKind.CLIENT.equals(spanKind)
11261126
|| SpanKind.CONSUMER.equals(spanKind)) {

buildSrc/src/main/kotlin/software/amazon/adot/GradleUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import com.google.cloud.tools.jib.gradle.JibExtension
99
fun JibExtension.configureImages(sourceImage:String, destinationImage: String, localDocker: Boolean, multiPlatform: Boolean, tags: Set<String> = setOf<String>()) {
1010
to {
1111
image = destinationImage
12-
if (!tags.isEmpty()) {
12+
if (!tags.equals("")) {
1313
this.tags = tags;
1414
}
1515
}

0 commit comments

Comments
 (0)