adobe / adobe/aem-modernize-tools
Make order.components value check as optional
- Dominant language
- Java
- Stars
- 62
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
### Expected Behaviour
If user has configured "order.components" in "Page Rewrite Rule" OSGI configuration. The page conversion should NOT break if one the components mentioned in this configuration doesn't exist on any required page.
### Actual Behaviour
If user has configured "order.components" in "Page Rewrite Rule" OSGI configuration. The page conversion breaks if one the components mentioned in this configuration doesn't exist on any required page.
### Reproduce Scenario (including but not limited to)
Configure "order.components" in "Page Rewrite Rule" OSGI configuration with some components. Run page conversion on one of the page where one the component from "order.components" doesn't exist. breaks if one the components mentioned in this configuration doesn't exist on any required page. Below error (in log section) would come up & conversion will fail.
#### Steps to Reproduce
Configure "order.components" in "Page Rewrite Rule" OSGI configuration with some components. Run page conversion on one of the page where one the component from "order.components" doesn't exist. breaks if one the components mentioned in this configuration doesn't exist on any required page. error shown in log section would come up & conversion will fail.
#### Platform and Version
Version-2.1.0
#### Sample Code that illustrates the problem
#### Logs taken while reproducing problem
```
07.08.2022 21:23:12.399 *ERROR* [sling-threadpool-16016acd-95ff-4744-baaf-e0fb3661542c-(apache-sling-job-thread-pool)-1-AEM Modernize Tools Queue(com/adobe/aem/modernize/job/topic/convert/structure)] com.adobe.aem.modernize.structure.job.PageStructureJobExecutor Page structure conversion resulted in an error.
com.adobe.aem.modernize.RewriteException: Repository exception while performing rewrite operation.
at com.adobe.aem.modernize.structure.impl.StructureRewriteRuleServiceImpl.apply(StructureRewriteRuleServiceImpl.java:106) [com.adobe.aem.aem-modernize-tools.core:2.1.0]
at com.adobe.aem.modernize.structure.job.PageStructureJobExecutor.doProcess(PageStructureJobExecutor.java:98) [com.adobe.aem.aem-modernize-tools.core:2.1.0]
at com.adobe.aem.modernize.job.AbstractConversionJobExecutor.process(AbstractConversionJobExecutor.java:82) [com.adobe.aem.aem-modernize-tools.core:2.1.0]
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:351) [org.apache.sling.event:4.2.24]
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60) [org.apache.sling.event:4.2.24]
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:287) [org.apache.sling.event:4.2.24]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.jcr.ItemNotFoundException: Not a child: dropdown1
at org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.orderBefore(NodeDelegate.java:370) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220505140541-fbdad6b]
at org.apache.jackrabbit.oak.jcr.session.NodeImpl$6.performVoid(NodeImpl.java:339) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220505140541-fbdad6b]
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:280) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220505140541-fbdad6b]
at org.apache.jackrabbit.oak.jcr.session.NodeImpl.orderBefore(NodeImpl.java:330) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220505140541-fbdad6b]
at com.adobe.aem.modernize.structure.rule.PageRewriteRule.orderNodes(PageRewriteRule.java:285) [com.adobe.aem.aem-modernize-tools.core:2.1.0]
at com.adobe.aem.modernize.structure.rule.PageRewriteRule.applyTo(PageRewriteRule.java:175) [com.adobe.aem.aem-modernize-tools.core:2.1.0]
at com.adobe.aem.modernize.structure.impl.StructureRewriteRuleServiceImpl.apply(StructureRewriteRuleServiceImpl.java:101) [com.adobe.aem.aem-modernize-tools.core:2.1.0]
... 8 common frames omitted
```
Contributor guide
Research direction
Start in PageRewriteRule.java, especially orderNodes and the applyTo path shown in the stack trace. Reproduce the Page Rewrite Rule configuration with a component that is absent from the page, then inspect the existing structure conversion tests if available. Done means conversion succeeds when a configured component is missing, without the reported ItemNotFoundException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100