@@ -46,10 +46,10 @@ applyv25patches() {
4646 esac
4747 # # TODO: document in migration guide to 25
4848 patchImports ' import com.fasterxml.jackson.core.type.TypeReference;' ' import tools.jackson.core.type.TypeReference;'
49- patchImports ' import com.fasterxml.jackson.databind.node.ObjectNode;' ' import tools.jackson.databind.node.ObjectNode;'
50- patchImports ' import com.fasterxml.jackson.databind.node.ArrayNode;' ' import tools.jackson.databind.node.ArrayNode;'
49+ patchImports ' import com.fasterxml.jackson.databind' ' import tools.jackson.databind'
5150 patchImports ' import org.springframework.boot.autoconfigure.domain.EntityScan;' ' import org.springframework.boot.persistence.autoconfigure.EntityScan;'
5251 patchImports ' import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration;' ' import org.springframework.boot.webmvc.autoconfigure.error.ErrorMvcAutoConfiguration;'
52+ patchMapper
5353
5454 diff_=` git diff $D $F | egrep ' ^[+-]' `
5555 [ -z " $TEST " -a -n " $diff_ " ] && echo " " && warn " Patched sources\n" && dim " ====== BEGIN ======\n\n$diff_ \n====== END ======"
@@ -339,4 +339,22 @@ patchLumoImports() {
339339 fi
340340 fi
341341 done
342+ }
343+
344+ # # TODO: needs to be documented in vaadin migration guide to 25
345+ patchMapper () {
346+ # Find all Java files that contain the JavaTimeModule registration
347+ local java_files=$( grep -rl " .*mapper.registerModule.*JavaTimeModule.*" . --include=" *.java" 2> /dev/null)
348+ [ -z " $java_files " ] && return 0
349+
350+ local file
351+ for file in $java_files ; do
352+ [ -z " $TEST " ] && warn " patching ObjectMapper configuration in $file " || cmd " ## patching ObjectMapper configuration in $file "
353+
354+ # Remove the JavaTimeModule registration line
355+ perl -pi -e ' s|.*mapper.registerModule.*JavaTimeModule.*||' " $file "
356+
357+ # Replace IOException with Exception in the same file
358+ perl -pi -e ' s|catch \(IOException|catch (Exception|g' " $file "
359+ done
342360}
0 commit comments