Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP inbound endpoint migration fails when having a property in the address field #565

Closed
afelisatti opened this issue Nov 26, 2021 · 0 comments

Comments

@afelisatti
Copy link

Version used
1.2.0

Describe the bug
This issue is similar to #562, there seems to be some calculation over the address field of endpoints which does not account for the fact that the value could be a property. So, it is likely that this issue affects all transports and all components relying on this address parsing to identify components.

Expected Behavior
If the value cannot be analyzed, there should be a report entry explaining the situation and a best effort to migrate the component regardless.

Actual Behavior
The component is partially migrated but leaving invalid fields and further occurrences of the component are left without migrating them, creating an invalid Mule 4 application.

Relevant logs

Migrator: Executing migrator 1.2.1-SNAPSHOT...
Migrator: ERROR 2021-11-26 17:35:04,242 [main] com.mulesoft.tools.migration.engine.MigrationJob: Failed to apply task, rolling back and continuing with the next one.
Migrator: com.mulesoft.tools.migration.exception.MigrationTaskException: Task execution exception. Task execution exception (named capturing group is missing trailing '}') migrating node:
Migrator: <http:listener xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:migration="migration" address="${http.address}" exchange-pattern="request-response" doc:name="Profile API" migration:isMessageSource="true" />
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.execute(AbstractMigrationTask.java:94) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.engine.MigrationJob.execute(MigrationJob.java:98) [mule-migration-tool-engine-1.2.1-SNAPSHOT.jar:1.2.1-SNAPSHOT]
Migrator:       at com.mulesoft.tools.migration.MigrationRunner.main(MigrationRunner.java:79) [mule-migration-assistant-runner-1.2.1-SNAPSHOT.jar:1.2.1-SNAPSHOT]
Migrator: Caused by: com.mulesoft.tools.migration.exception.MigrationStepException: Task execution exception (named capturing group is missing trailing '}') migrating node:
Migrator: <http:listener xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:migration="migration" address="${http.address}" exchange-pattern="request-response" doc:name="Profile API" migration:isMessageSource="true" />
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.lambda$fetchAndProcessNodes$7(AbstractMigrationTask.java:108) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask$$Lambda$143/0x0000000000000000.accept(Unknown Source) ~[?:?]
Migrator:       at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
Migrator:       at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
Migrator:       at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1239) ~[?:?]
Migrator:       at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:497) ~[?:?]
Migrator:       at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:487) ~[?:?]
Migrator:       at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
Migrator:       at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
Migrator:       at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:239) ~[?:?]
Migrator:       at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.fetchAndProcessNodes(AbstractMigrationTask.java:102) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.lambda$execute$3(AbstractMigrationTask.java:73) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask$$Lambda$118/0x0000000000000000.accept(Unknown Source) ~[?:?]
Migrator:       at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.execute(AbstractMigrationTask.java:71) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       ... 2 more
Migrator: Caused by: java.lang.IllegalArgumentException: named capturing group is missing trailing '}'
Migrator:       at java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1052) ~[?:?]
Migrator:       at java.util.regex.Matcher.appendReplacement(Matcher.java:998) ~[?:?]
Migrator:       at java.util.regex.Matcher.replaceFirst(Matcher.java:1408) ~[?:?]
Migrator:       at java.lang.String.replaceFirst(String.java:3160) ~[?:?]
Migrator:       at com.mulesoft.tools.migration.report.DefaultMigrationReport.report(DefaultMigrationReport.java:83) ~[mule-migration-tool-engine-1.2.1-SNAPSHOT.jar:1.2.1-SNAPSHOT]
Migrator:       at com.mulesoft.tools.migration.step.util.TransportsUtils.processAddress(TransportsUtils.java:88) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.library.mule.steps.http.HttpInboundEndpoint.execute(HttpInboundEndpoint.java:84) ~[mule-migration-tool-library-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.library.mule.steps.http.HttpInboundEndpoint.execute(HttpInboundEndpoint.java:50) ~[mule-migration-tool-library-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.lambda$fetchAndProcessNodes$7(AbstractMigrationTask.java:105) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask$$Lambda$143/0x0000000000000000.accept(Unknown Source) ~[?:?]
Migrator:       at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
Migrator:       at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
Migrator:       at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1239) ~[?:?]
Migrator:       at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:497) ~[?:?]
Migrator:       at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:487) ~[?:?]
Migrator:       at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
Migrator:       at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
Migrator:       at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:239) ~[?:?]
Migrator:       at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.fetchAndProcessNodes(AbstractMigrationTask.java:102) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.lambda$execute$3(AbstractMigrationTask.java:73) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask$$Lambda$118/0x0000000000000000.accept(Unknown Source) ~[?:?]
Migrator:       at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
Migrator:       at com.mulesoft.tools.migration.task.AbstractMigrationTask.execute(AbstractMigrationTask.java:71) ~[mule-migration-tool-api-1.2.1-SNAPSHOT.jar:?]
Migrator:       ... 2 more
Migrator: ===============================================================================
Migrator: MIGRATION ASSIST

Reproducible Test Case
There's an E2E featuring an HTTP inbound endpoint were this can be reproduced: OAuth2ProviderMigrationTestCase. Add a mule arg to the test with a property value and replace the first endpoint with:

        <http:inbound-endpoint address="${http.address}" exchange-pattern="request-response" doc:name="Profile API"/>
olamiral-mulesoft referenced this issue in olamiral-mulesoft/mule-migration-assistant Dec 5, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
- Added error handler to provide more information about the message and message param being processed in case of failure when generating a report message.
- Added message parameter escaping to handle values corresponding to property placeholders (replace operation fails when the replacement contains special characters such as $, { or }).
@olamiral-mulesoft olamiral-mulesoft linked a pull request Dec 5, 2021 that will close this issue
@machaval machaval closed this as completed Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants