Skip to content

Commit e14dbed

Browse files
committed
Address comments.
1 parent f6c32f1 commit e14dbed

File tree

4 files changed

+3
-12
lines changed

4 files changed

+3
-12
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/metrics/HttpMetric.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ private void checkAttribute(@Nullable String key, @Nullable String value) {
186186
throw new IllegalArgumentException(
187187
"HttpMetric has been logged already so unable to modify attributes");
188188
}
189-
if (key == null || value == null) {
190-
throw new IllegalArgumentException("Attribute must not have null key or value.");
191-
}
192189

193190
if (!customAttributesMap.containsKey(key)
194191
&& customAttributesMap.size() >= Constants.MAX_TRACE_CUSTOM_ATTRIBUTES) {

firebase-perf/src/main/java/com/google/firebase/perf/metrics/Trace.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,6 @@ private void checkAttribute(@NonNull String key, @NonNull String value) {
631631
String.format(Locale.ENGLISH, "Trace '%s' has been stopped", name));
632632
}
633633

634-
if (key == null || value == null) {
635-
throw new IllegalArgumentException("Attribute must not have null key or value.");
636-
}
637-
638634
if (!customAttributesMap.containsKey(key)
639635
&& customAttributesMap.size() >= Constants.MAX_TRACE_CUSTOM_ATTRIBUTES) {
640636
throw new IllegalArgumentException(

firebase-perf/src/main/java/com/google/firebase/perf/metrics/validator/PerfMetricValidator.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
/** An abstract class providing an interface to validate PerfMetric */
2929
public abstract class PerfMetricValidator {
3030

31-
private String format;
32-
3331
/**
3432
* Creates a list of PerfMetricValidator classes based on the contents of PerfMetric
3533
*
@@ -146,9 +144,9 @@ public static String validateAttribute(@NonNull Map.Entry<String, String> attrib
146144
String key = attribute.getKey();
147145
String value = attribute.getValue();
148146
if (key == null || key.length() == 0) {
149-
return "Attribute key must not be null";
147+
return "Attribute key must not be null or empty";
150148
} else if (value == null || value.length() == 0) {
151-
return "Attribute value must not be null";
149+
return "Attribute value must not be null or empty";
152150
} else if (key.length() > Constants.MAX_ATTRIBUTE_KEY_LENGTH) {
153151
return String.format(
154152
Locale.US,

firebase-perf/src/test/java/com/google/firebase/perf/metrics/validator/FirebasePerfTraceValidatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public void traceValidator_invalidCustomAttriubute_skipsAttribute() {
194194
assertThat(new FirebasePerfTraceValidator(trace.build()).isValidPerfMetric()).isFalse();
195195

196196
trace = trace.clone();
197-
trace.clearCustomAttributes().putCustomAttributes("value", "");
197+
trace.clearCustomAttributes().putCustomAttributes("", "value");
198198
assertThat(new FirebasePerfTraceValidator(trace.build()).isValidPerfMetric()).isFalse();
199199

200200
StringBuilder longString = new StringBuilder();

0 commit comments

Comments
 (0)