You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MobileCenterLog.error(Analytics.LOG_TAG, logType + " name cannot be null or empty.");
259
-
returnfalse;
279
+
returnnull;
260
280
}
261
-
if (name.length() > maxNameLength) {
262
-
MobileCenterLog.error(Analytics.LOG_TAG, String.format("%s '%s' : name length cannot be longer than %s characters.", logType, name, maxNameLength));
263
-
returnfalse;
281
+
if (name.length() > MAX_NAME_LENGTH) {
282
+
MobileCenterLog.warn(Analytics.LOG_TAG, String.format("%s '%s' : name length cannot be longer than %s characters. Name will be truncated.", logType, name, MAX_NAME_LENGTH));
for (Map.Entry<String, String> property : properties.entrySet()) {
284
-
if (result.size() >= maxPropertiesCount) {
285
-
message = String.format("%s '%s' : properties cannot contain more than %s items. Skipping other properties.", logType, logName, maxPropertiesCount);
302
+
Stringkey = property.getKey();
303
+
Stringvalue = property.getValue();
304
+
if (result.size() >= MAX_PROPERTY_COUNT) {
305
+
message = String.format("%s '%s' : properties cannot contain more than %s items. Skipping other properties.", logType, logName, MAX_PROPERTY_COUNT);
286
306
MobileCenterLog.warn(Analytics.LOG_TAG, message);
287
307
break;
288
308
}
289
-
if (property.getKey() == null || property.getKey().isEmpty()) {
309
+
if (key == null || key.isEmpty()) {
290
310
message = String.format("%s '%s' : a property key cannot be null or empty. Property will be skipped.", logType, logName);
291
311
MobileCenterLog.warn(Analytics.LOG_TAG, message);
292
312
continue;
293
313
}
294
-
if (property.getKey().length() > maxPropertyItemLength) {
295
-
message = String.format("%s '%s' : property '%s' : property key length cannot be longer than %s characters. Property '%s' will be skipped.", logType, logName, property.getKey(), maxPropertyItemLength, property.getKey());
314
+
if (value == null) {
315
+
message = String.format("%s '%s' : property '%s' : property value cannot be null. Property '%s' will be skipped.", logType, logName, key, key);
296
316
MobileCenterLog.warn(Analytics.LOG_TAG, message);
297
317
continue;
298
318
}
299
-
if (property.getValue() == null) {
300
-
message = String.format("%s '%s' : property '%s' : property value cannot be null. Property '%s' will be skipped.", logType, logName, property.getKey(), property.getKey());
319
+
if (key.length() > MAX_PROPERTY_ITEM_LENGTH) {
320
+
message = String.format("%s '%s' : property '%s' : property key length cannot be longer than %s characters. Property key will be truncated.", logType, logName, key, MAX_PROPERTY_ITEM_LENGTH);
301
321
MobileCenterLog.warn(Analytics.LOG_TAG, message);
302
-
continue;
322
+
key = key.substring(0, MAX_PROPERTY_ITEM_LENGTH);
303
323
}
304
-
if (property.getValue().length() > maxPropertyItemLength) {
305
-
message = String.format("%s '%s' : property '%s' : property value cannot be longer than %s characters. Property '%s' will be skipped.", logType, logName, property.getKey(), maxPropertyItemLength, property.getKey());
324
+
if (value.length() > MAX_PROPERTY_ITEM_LENGTH) {
325
+
message = String.format("%s '%s' : property '%s' : property value cannot be longer than %s characters. Property value will be truncated.", logType, logName, key, MAX_PROPERTY_ITEM_LENGTH);
306
326
MobileCenterLog.warn(Analytics.LOG_TAG, message);
307
-
continue;
327
+
value = value.substring(0, MAX_PROPERTY_ITEM_LENGTH);
0 commit comments