Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
23 lines
1.7 KiB
Bash
Executable File
23 lines
1.7 KiB
Bash
Executable File
#!/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>#'
|