Identify and apply robust Java exception handling practices to improve error clarity, security, debuggability, and system reliability.
Prerequisites: Run ./mvnw compile or mvn compile before applying any changes. If compilation fails, stop immediately — do not proceed until the project is in a valid state.
Core areas: Specific exception types instead of generic Exception/RuntimeException, try-with-resources for automatic resource cleanup, secure exception messages that avoid information leakage, exception chaining to preserve full error context, early input validation with IllegalArgumentException/NullPointerException, InterruptedException handling with interrupted-status restoration, @throws JavaDoc documentation,...
특정 예외 유형 사용, 리소스 사용 시도로 리소스 관리, 예외 메시지 보안, 예외 체인을 통한 오류 컨텍스트 보존, 빠른 실패 원칙으로 입력 조기 검증, 스레드 중단 올바르게 처리, @throws로 예외 문서화, 로깅 정책 적용, API 경계에서 예외 변환, 재시도 및 멱등성 관리, 시간 초과 적용, 억제된 예외 첨부, 실패 전파 등을 포함하여 Java 예외 처리 모범 사례를 적용해야 할 때 사용합니다. 비동기/반응형 코드. Skills-for-Java 프로젝트의 일부 출처: jabrena/cursor-rules-java.