exceptions: Jackson 3 unchecked JacksonException hierarchy, Spring Boot 4.2 error handling, OpenRewrite and sed migration

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
This commit is contained in:
Claude
2026-12-03 23:41:56 +05:30
parent 26f64bc184
commit f97ec4e014
71 changed files with 2210 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# A deliberately small text-substitution migration for exception handling.
# Usage: scripts/migrate-regex.sh <project-dir> (edits the files in place: use a copy or a clean branch)
# Needs GNU sed. It renames types and packages. It cannot see which catch blocks are now wrong.
set -euo pipefail
find "$1" -name '*.java' -print0 | xargs -0 sed -i -E \
-e 's/com\.fasterxml\.jackson\.core\.JsonProcessingException/tools.jackson.core.JacksonException/g' \
-e 's/com\.fasterxml\.jackson\.core\.JsonParseException/tools.jackson.core.exc.StreamReadException/g' \
-e 's/com\.fasterxml\.jackson\.core\.JsonGenerationException/tools.jackson.core.exc.StreamWriteException/g' \
-e 's/com\.fasterxml\.jackson\.core\.io\.JsonEOFException/tools.jackson.core.exc.UnexpectedEndOfInputException/g' \
-e 's/com\.fasterxml\.jackson\.databind\.JsonMappingException/tools.jackson.databind.DatabindException/g' \
-e 's/com\.fasterxml\.jackson\.(core|databind|dataformat|datatype|module)/tools.jackson.\1/g' \
-e 's/\bJsonProcessingException\b/JacksonException/g' \
-e 's/\bJsonParseException\b/StreamReadException/g' \
-e 's/\bJsonGenerationException\b/StreamWriteException/g' \
-e 's/\bJsonEOFException\b/UnexpectedEndOfInputException/g' \
-e 's/\bJsonMappingException\b/DatabindException/g' \
-e 's/\.getFieldName\(\)/.getPropertyName()/g'
# jackson-annotations keeps the old package; the substitutions above never touch com.fasterxml.jackson.annotation.
find "$1" -name pom.xml -print0 | xargs -0 sed -i -E \
-e 's#<groupId>com\.fasterxml\.jackson\.core</groupId>#<groupId>tools.jackson.core</groupId>#' \
-e 's#<version>2\.23\.0</version>#<version>3.3.0</version>#'