TWCable / grabbit

Grabbit - Fast Content Sync tool for AEM/CQ
Apache License 2.0
125 stars 64 forks source link

jcr.RepositoryException at a node with special characters #114

Closed akiranmutnuru closed 8 years ago

akiranmutnuru commented 8 years ago

I am using grabbit3.0.5 for cq5.6 while syching, At the node, /content/dcomm-unitymedia-de/masterdata/products/3PLAY_COMFORT120/features/feature[2] i am getting below error:

24.06.2016 16:00:40.895 ERROR [clientJobLauncherTaskExecutor-10] org.springframework.batch.core.step.AbstractStep Encountered an error executing step clientJcrNodes in job clientJob javax.jcr.RepositoryException: Invalid last path element for adding node feature[2] relative to node /content/abcd /masterdata/products/2PLAY_COMFORT120/features at org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:72) at org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:37) at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216) at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) at org.apache.jackrabbit.core.NodeImpl.addNodeWithUuid(NodeImpl.java:1814) at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1774) at org.apache.jackrabbit.commons.JcrUtils.getOrCreateByPath(JcrUtils.java:1136) at org.apache.jackrabbit.commons.JcrUtils.getOrCreateByPath(JcrUtils.java:1016) at org.apache.jackrabbit.commons.JcrUtils.getOrCreateByPath(JcrUtils.java:909) at com.twcable.grabbit.jcr.ProtoNodeDecorator.getOrCreateNode(ProtoNodeDecorator.groovy:85) at com.twcable.grabbit.jcr.ProtoNodeDecorator.writeToJcr(ProtoNodeDecorator.groovy:65) at com.twcable.grabbit.client.batch.steps.jcrnodes.JcrNodesWriter.writeToJcr(JcrNodesWriter.groovy:91) at com.twcable.grabbit.client.batch.steps.jcrnodes.JcrNodesWriter.write(JcrNodesWriter.groovy:74) at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175) at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151) at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:274) at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199) at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75) at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:395) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:267) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77) at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368) at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144) at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:253) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195) at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:141) at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64) at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:151) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:130) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:134) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

Is this because of the [] braces??? please let me know. and help me to resolve the issue

jbornemann commented 8 years ago

Nice catch. [ and ] are invalid JCR path characters.

I don't think we are escaping these characters properly on write.

akiranmutnuru commented 8 years ago

ok I got it:) is there any workaround? Or Do i have to exclude those paths??

jbornemann commented 8 years ago

Hey @akiranmutnuru , besides excluding those paths, I'm not sure there is a great workaround. We will need to get this fixed.

Thanks for finding it, and sorry you are having so much trouble

jbornemann commented 8 years ago

Hey @akiranmutnuru, how did this node get into the JCR? At first, I assumed 'feature[2]' was simply being displayed decoded; but it doesn't appear the CRX, or underlying NodeImpl pass-around the node in this decoded fashion.

akiranmutnuru commented 8 years ago

i dont know how they got created. No Idea. but i got to know that, this is NOT a valid node name

jbornemann commented 8 years ago

@akiranmutnuru would it be possible to get a content package with just that node? (Redacted if needed)?

JSR-284 doesn't allow these characters, but I still would like to make sure that there aren't "lost in translation" edge-cases that we aren't handling within Grabbit.

sagarsane commented 8 years ago

I am wondering if that node with a invalid node name got written on an older version of JCR / CQ (5.6 older version or 5.5 or something). I have seen similar cases in the past where older versions of CQ have not strictly adhered to the JCR specifications.

jdigger commented 8 years ago

Closing in favor of #124