Skip to content

Migrate web.xml xsi:schemaLocation from J2EE 1.4 namespace - #1177

Merged
steve-aom-elliott merged 1 commit into
mainfrom
fix-web-xml-j2ee-schema-location
Jul 27, 2026
Merged

Migrate web.xml xsi:schemaLocation from J2EE 1.4 namespace#1177
steve-aom-elliott merged 1 commit into
mainfrom
fix-web-xml-j2ee-schema-location

Conversation

@steve-aom-elliott

@steve-aom-elliott steve-aom-elliott commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The JavaxWebXmlToJakartaWebXml recipe updated xmlns and version attributes on J2EE 1.4 web.xml descriptors (http://java.sun.com/xml/ns/j2ee, version="2.4") but left xsi:schemaLocation pointing at the old j2ee schema. The ChangeTagAttribute step for xsi:schemaLocation gated on a regex (?s).*xml/ns/javaee.* that only matched the newer javaee namespace, so J2EE 1.4 descriptors fell through and produced this inconsistent output:

<web-app version="5.0"
         xmlns="https://jakarta.ee/xml/ns/jakartaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

Broaden the regex to (?s).*xml/ns/(j2ee|javaee).* so J2EE 1.4 descriptors also have xsi:schemaLocation rewritten to the Jakarta EE 9 web-app_5_0.xsd, per the Eclipse Foundation's Jakarta EE XML Schemas index (Jakarta EE 9+ descriptors share the https://jakarta.ee/xml/ns/jakartaee namespace, and web-app_5_0.xsd is the Servlet 5.0 deployment descriptor schema).

Sibling recipes for faces-config, facelet-taglib, and web-fragment overwrite xsi:schemaLocation unconditionally (no oldValue), so they don't have this bug. Added a migrateJ2ee test covering the 2.4 → 5.0 case.

The web.xml Jakarta migration updated xmlns and version attributes on
J2EE 1.4 descriptors (http://java.sun.com/xml/ns/j2ee) but left the
xsi:schemaLocation pointing at the old j2ee schema, because the
oldValue regex only matched the newer 'javaee' namespace. Broaden the
regex to also match 'j2ee' so schemaLocation is rewritten to the
Jakarta EE 9 web-app_5_0.xsd.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jul 27, 2026
@steve-aom-elliott steve-aom-elliott added bug Something isn't working test provided recipe Recipe requested labels Jul 27, 2026
@steve-aom-elliott steve-aom-elliott moved this from In Progress to Ready to Review in OpenRewrite Jul 27, 2026
@steve-aom-elliott
steve-aom-elliott merged commit 39b31e8 into main Jul 27, 2026
1 check passed
@steve-aom-elliott
steve-aom-elliott deleted the fix-web-xml-j2ee-schema-location branch July 27, 2026 18:09
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Jul 27, 2026
mergify Bot added a commit to robfrank/linklift that referenced this pull request Aug 4, 2026
…40.0 to 3.41.0 [skip ci]

Bumps [org.openrewrite.recipe:rewrite-migrate-java](https://github.com/openrewrite/rewrite-migrate-java) from 3.40.0 to 3.41.0.
Release notes

*Sourced from [org.openrewrite.recipe:rewrite-migrate-java's releases](https://github.com/openrewrite/rewrite-migrate-java/releases).*

> 3.41.0
> ------
>
> What's Changed
> --------------
>
> * Add Mockito Java agent surefire config in reactor modules by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1169](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1169)
> * Move Java EE 8 servlet update into separate recipe by [`@​rlsanders4`](https://github.com/rlsanders4) in [openrewrite/rewrite-migrate-java#1170](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1170)
> * Update NoGuavaRefaster expected output for upstream static-import change by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1171](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1171)
> * Set Develocity `projectId` to "openrewrite" by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1172](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1172)
> * Add `mapstruct-processor` to annotation processor paths when Lombok and MapStruct are used by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1175](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1175)
> * Fix method patterns for dead `UnsignedInts`/`UnsignedLongs` recipes by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#1176](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1176)
> * Migrate web.xml xsi:schemaLocation from J2EE 1.4 namespace by [`@​steve-aom-elliott`](https://github.com/steve-aom-elliott) in [openrewrite/rewrite-migrate-java#1177](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1177)
> * Forward Code Genome Project publish credentials to `ci-gradle.yml` by [`@​jkschneider`](https://github.com/jkschneider) in [openrewrite/rewrite-migrate-java#1178](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/1178)
>
> **Full Changelog**: <openrewrite/rewrite-migrate-java@v3.40.0...v3.41.0>


Commits

* [`128764a`](openrewrite/rewrite-migrate-java@128764a) Forward Code Genome Project publish credentials to `ci-gradle.yml` ([#1178](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1178))
* [`39b31e8`](openrewrite/rewrite-migrate-java@39b31e8) Migrate web.xml xsi:schemaLocation from J2EE 1.4 namespace ([#1177](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1177))
* [`e7f0b34`](openrewrite/rewrite-migrate-java@e7f0b34) [Auto] SDKMAN! Java candidates as of 2026-07-27T1252
* [`e29c330`](openrewrite/rewrite-migrate-java@e29c330) Fix method patterns for dead `UnsignedInts`/`UnsignedLongs` recipes ([#1176](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1176))
* [`7c45df7`](openrewrite/rewrite-migrate-java@7c45df7) Add `mapstruct-processor` to annotation processor paths when Lombok and MapSt...
* [`ab370a9`](openrewrite/rewrite-migrate-java@ab370a9) Set Develocity `projectId` to "openrewrite" ([#1172](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1172))
* [`cddded8`](openrewrite/rewrite-migrate-java@cddded8) Move Develocity to community.develocity.cloud
* [`577446f`](openrewrite/rewrite-migrate-java@577446f) Update NoGuavaRefaster expected output for upstream static-import change ([#1171](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1171))
* [`9b7a874`](openrewrite/rewrite-migrate-java@9b7a874) [Auto] SDKMAN! Java candidates as of 2026-07-20T1212
* [`a5b7ddc`](openrewrite/rewrite-migrate-java@a5b7ddc) Move Java EE 8 servlet update into separate recipe ([#1170](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/1170))
* Additional commits viewable in [compare view](openrewrite/rewrite-migrate-java@v3.40.0...v3.41.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working recipe Recipe requested test provided

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant