fix: toLocalDateTime 변환 강화 — 타입 불일치 로깅 + toString 폴백
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
부모
508cc264ee
커밋
6c63133fd8
@ -228,14 +228,23 @@ public class MonitoringController {
|
|||||||
return quality;
|
return quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LocalDateTime toLocalDateTime(Object raw) {
|
private LocalDateTime toLocalDateTime(Object raw) {
|
||||||
if (raw instanceof java.sql.Timestamp ts) {
|
if (raw == null) return null;
|
||||||
return ts.toLocalDateTime();
|
if (raw instanceof LocalDateTime ldt) return ldt;
|
||||||
} else if (raw instanceof java.time.OffsetDateTime odt) {
|
if (raw instanceof java.sql.Timestamp ts) return ts.toLocalDateTime();
|
||||||
return odt.toLocalDateTime();
|
if (raw instanceof java.time.OffsetDateTime odt) return odt.toLocalDateTime();
|
||||||
} else if (raw instanceof LocalDateTime ldt) {
|
if (raw instanceof java.time.Instant inst) {
|
||||||
return ldt;
|
return inst.atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
|
||||||
|
}
|
||||||
|
log.warn("Unexpected temporal type: {} (class={})", raw, raw.getClass().getName());
|
||||||
|
try {
|
||||||
|
String s = raw.toString();
|
||||||
|
if (s.contains("+") || s.endsWith("Z")) {
|
||||||
|
return java.time.OffsetDateTime.parse(s).toLocalDateTime();
|
||||||
|
}
|
||||||
|
return LocalDateTime.parse(s.replace(" ", "T"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user