줄맞춤
This commit is contained in:
@@ -147,7 +147,7 @@ public class GeoJsonValidator {
|
||||
Set<String> foundUnique = new HashSet<>();
|
||||
|
||||
// 중복된 scene_id 목록 (샘플 로그 출력용이라 순서 유지 가능한 LinkedHashSet 사용)
|
||||
Set<String> duplicates = new LinkedHashSet<>();
|
||||
// Set<String> duplicates = new LinkedHashSet<>();
|
||||
|
||||
// scene_id가 null 또는 blank인 feature의 개수 (데이터 이상)
|
||||
int nullIdCount = 0;
|
||||
@@ -179,9 +179,9 @@ public class GeoJsonValidator {
|
||||
}
|
||||
|
||||
// foundUnique.add(sceneId)가 false면 "이미 같은 값이 있었다"는 뜻 => 중복
|
||||
if (!foundUnique.add(sceneId)) {
|
||||
duplicates.add(sceneId);
|
||||
}
|
||||
// if (!foundUnique.add(sceneId)) {
|
||||
// duplicates.add(sceneId);
|
||||
// }
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
@@ -225,13 +225,13 @@ public class GeoJsonValidator {
|
||||
requested.size(), // 요청 도엽 유니크 수
|
||||
foundUnique.size(), // GeoJSON에서 발견된 scene_id 유니크 수
|
||||
nullIdCount, // scene_id가 비어있는 feature 수
|
||||
duplicates.size(), // 중복 scene_id 종류 수
|
||||
0, // 중복 scene_id 종류 수
|
||||
missing.size(), // 요청했지만 빠진 도엽 수
|
||||
extra.size()); // 요청하지 않았는데 들어온 도엽 수
|
||||
|
||||
// 중복/누락/추가 항목은 전체를 다 찍으면 로그 폭발하므로 샘플만
|
||||
if (!duplicates.isEmpty())
|
||||
log.warn("duplicates sample: {}", duplicates.stream().limit(20).toList());
|
||||
// if (!duplicates.isEmpty())
|
||||
// log.warn("duplicates sample: {}", duplicates.stream().limit(20).toList());
|
||||
|
||||
if (!missing.isEmpty()) log.warn("missing sample: {}", missing.stream().limit(50).toList());
|
||||
|
||||
@@ -250,12 +250,12 @@ public class GeoJsonValidator {
|
||||
// - 요청 문법은 맞지만(파일은 있고 JSON도 읽힘),
|
||||
// 내용(정합성)이 요구사항을 만족하지 못하는 경우에 적합.
|
||||
// =========================================================
|
||||
if (!missing.isEmpty() || !extra.isEmpty() || !duplicates.isEmpty() || nullIdCount > 0) {
|
||||
if (!missing.isEmpty() || !extra.isEmpty() || nullIdCount > 0) {
|
||||
throw new ResponseStatusException(
|
||||
HttpStatus.UNPROCESSABLE_ENTITY,
|
||||
String.format(
|
||||
"GeoJSON validation failed: missing=%d, extra=%d, duplicates=%d, nullId=%d",
|
||||
missing.size(), extra.size(), duplicates.size(), nullIdCount));
|
||||
missing.size(), extra.size(), 0, nullIdCount));
|
||||
}
|
||||
|
||||
// 모든 조건을 통과하면 정상
|
||||
|
||||
Reference in New Issue
Block a user