Skip to content

Commit

Permalink
Break up lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer committed Mar 31, 2019
1 parent e9e4b49 commit 0e2bb14
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions common/src/main/java/bisq/common/util/ExtraDataMapValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ public static Map<String, String> getValidatedExtraDataMap(@Nullable Map<String,
return getValidatedExtraDataMap(extraDataMap, MAX_SIZE, MAX_KEY_LENGTH, MAX_VALUE_LENGTH);
}

public static Map<String, String> getValidatedExtraDataMap(@Nullable Map<String, String> extraDataMap, int maxSize, int maxKeyLength, int maxValueLength) {
public static Map<String, String> getValidatedExtraDataMap(@Nullable Map<String, String> extraDataMap, int maxSize,
int maxKeyLength, int maxValueLength) {
if (extraDataMap == null)
return null;

try {
checkArgument(extraDataMap.entrySet().size() <= maxSize, "Size of map must not exceed " + maxSize);
checkArgument(extraDataMap.entrySet().size() <= maxSize,
"Size of map must not exceed " + maxSize);
extraDataMap.forEach((key, value) -> {
checkArgument(key.length() <= maxKeyLength, "Length of key must not exceed " + maxKeyLength);
checkArgument(value.length() <= maxValueLength, "Length of value must not exceed " + maxValueLength);
checkArgument(key.length() <= maxKeyLength,
"Length of key must not exceed " + maxKeyLength);
checkArgument(value.length() <= maxValueLength,
"Length of value must not exceed " + maxValueLength);
});
return extraDataMap;
} catch (Throwable t) {
Expand All @@ -62,14 +66,18 @@ public static void validate(@Nullable Map<String, String> extraDataMap) {
validate(extraDataMap, MAX_SIZE, MAX_KEY_LENGTH, MAX_VALUE_LENGTH);
}

public static void validate(@Nullable Map<String, String> extraDataMap, int maxSize, int maxKeyLength, int maxValueLength) {
public static void validate(@Nullable Map<String, String> extraDataMap, int maxSize, int maxKeyLength,
int maxValueLength) {
if (extraDataMap == null)
return;

checkArgument(extraDataMap.entrySet().size() <= maxSize, "Size of map must not exceed " + maxSize);
checkArgument(extraDataMap.entrySet().size() <= maxSize,
"Size of map must not exceed " + maxSize);
extraDataMap.forEach((key, value) -> {
checkArgument(key.length() <= maxKeyLength, "Length of key must not exceed " + maxKeyLength);
checkArgument(value.length() <= maxValueLength, "Length of value must not exceed " + maxValueLength);
checkArgument(key.length() <= maxKeyLength,
"Length of key must not exceed " + maxKeyLength);
checkArgument(value.length() <= maxValueLength,
"Length of value must not exceed " + maxValueLength);
});
}
}

0 comments on commit 0e2bb14

Please sign in to comment.