This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/commons-secure-xml.git


The following commit(s) were added to refs/heads/main by this push:
     new 33125bd  Fix the OpenRewrite migration recipe to target static method 
calls instead of class references.
33125bd is described below

commit 33125bd5df2da136701a884f7510c793ee16f137
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Sep 6 11:23:55 2026 -0400

    Fix the OpenRewrite migration recipe to target static method calls
    instead of class references.
---
 src/changes/changes.xml                            |  1 +
 .../commons/xml/secure/doc-files/rewrite.yml       | 71 ++++++++++++++++------
 2 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4d55480..7d9aed1 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -33,6 +33,7 @@ The <action> type attribute can be add, update, fix, or 
remove.
   <body>
     <release version="1.0.1" date="YYYY-MM-DD" description="Second release, 
requires Java 8 or above.">
       <!-- FIX -->
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix the 
OpenRewrite migration recipe to target static method calls instead of class 
references.</action>
       <!-- ADD -->
       <!-- UPDATE -->
     </release>
diff --git a/src/main/java/org/apache/commons/xml/secure/doc-files/rewrite.yml 
b/src/main/java/org/apache/commons/xml/secure/doc-files/rewrite.yml
index 8d67fc7..8af5cfe 100644
--- a/src/main/java/org/apache/commons/xml/secure/doc-files/rewrite.yml
+++ b/src/main/java/org/apache/commons/xml/secure/doc-files/rewrite.yml
@@ -16,23 +16,56 @@
 type: specs.openrewrite.org/v1beta/recipe
 name: org.apache.commons.xml.secure.UseSecureXmlFactories
 displayName: Use Apache Commons Secure XML factories
-description: Replaces JAXP factory types with their Apache Commons Secure XML 
equivalents.
+description: Replaces JAXP static factory method calls with their Apache 
Commons Secure XML equivalents.
 recipeList:
-  - org.openrewrite.java.ChangeType:
-      oldFullyQualifiedTypeName: javax.xml.parsers.DocumentBuilderFactory
-      newFullyQualifiedTypeName: 
org.apache.commons.xml.secure.SecureDocumentBuilderFactory
-  - org.openrewrite.java.ChangeType:
-      oldFullyQualifiedTypeName: javax.xml.parsers.SAXParserFactory
-      newFullyQualifiedTypeName: 
org.apache.commons.xml.secure.SecureSAXParserFactory
-  - org.openrewrite.java.ChangeType:
-      oldFullyQualifiedTypeName: javax.xml.validation.SchemaFactory
-      newFullyQualifiedTypeName: 
org.apache.commons.xml.secure.SecureSchemaFactory
-  - org.openrewrite.java.ChangeType:
-      oldFullyQualifiedTypeName: javax.xml.transform.TransformerFactory
-      newFullyQualifiedTypeName: 
org.apache.commons.xml.secure.SecureTransformerFactory
-  - org.openrewrite.java.ChangeType:
-      oldFullyQualifiedTypeName: javax.xml.stream.XMLInputFactory
-      newFullyQualifiedTypeName: 
org.apache.commons.xml.secure.SecureXMLInputFactory
-  - org.openrewrite.java.ChangeType:
-      oldFullyQualifiedTypeName: javax.xml.xpath.XPathFactory
-      newFullyQualifiedTypeName: 
org.apache.commons.xml.secure.SecureXPathFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.parsers.DocumentBuilderFactory 
newDefaultInstance()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureDocumentBuilderFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.parsers.DocumentBuilderFactory 
newDefaultNSInstance()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureDocumentBuilderFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.parsers.DocumentBuilderFactory newInstance(..)
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureDocumentBuilderFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.parsers.DocumentBuilderFactory newNSInstance(..)
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureDocumentBuilderFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.parsers.SAXParserFactory newDefaultInstance()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureSAXParserFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.parsers.SAXParserFactory newDefaultNSInstance()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureSAXParserFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.parsers.SAXParserFactory newInstance(..)
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureSAXParserFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.parsers.SAXParserFactory newNSInstance(..)
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureSAXParserFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.validation.SchemaFactory newDefaultInstance()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureSchemaFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.validation.SchemaFactory newInstance(..)
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureSchemaFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.transform.TransformerFactory 
newDefaultInstance()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureTransformerFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.transform.TransformerFactory newInstance(..)
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureTransformerFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.stream.XMLInputFactory newDefaultFactory()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureXMLInputFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.stream.XMLInputFactory newFactory(..)
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureXMLInputFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.stream.XMLInputFactory newInstance()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureXMLInputFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.xpath.XPathFactory newDefaultInstance()
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureXPathFactory
+  - org.openrewrite.java.ChangeMethodTargetToStatic:
+      methodPattern: javax.xml.xpath.XPathFactory newInstance(..)
+      fullyQualifiedTargetTypeName: 
org.apache.commons.xml.secure.SecureXPathFactory

Reply via email to