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