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

'null' when using "ItemAt" transformation from List<> -> Number #667

Closed
mmelko opened this issue Oct 31, 2018 · 5 comments
Closed

'null' when using "ItemAt" transformation from List<> -> Number #667

mmelko opened this issue Oct 31, 2018 · 5 comments

Comments

@mmelko
Copy link
Contributor

mmelko commented Oct 31, 2018

I have simple mapping from List to Double type field. When I add "ItemAt" transformaion I'm getting following exception from camel during processing of mapping:

io.atlasmap.api.AtlasException: Errors: [Unexpected exception is thrown while reading source field: null: docId='io.atlasmap.qe.test.SourceListsClass', path='/strings<>'], 
	at org.apache.camel.component.atlasmap.AtlasEndpoint.onExchange(AtlasEndpoint.java:213)
	at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)
	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
	at org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
	at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
	at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
	at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
	at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369)
	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506)
	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
	at org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndProperty(DefaultProducerTemplate.java:223)
	at org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndProperty(DefaultProducerTemplate.java:218)
	at io.atlasmap.qe.test.MappingValidator.processMappingInputMap(MappingValidator.java:94)
	at io.atlasmap.qe.test.MappingValidator.processMapping(MappingValidator.java:69)
	at io.atlasmap.qe.test.MappingValidator.verifyMapping(MappingValidator.java:103)
	at io.atlasmap.qe.test.MappingValidator.verifyMapping(MappingValidator.java:145)
	at io.atlasmap.qe.test.atlas.steps.BackendSteps.saveAndVerifyMappingAs(BackendSteps.java:95)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at cucumber.runtime.Utils$1.call(Utils.java:32)
	at cucumber.runtime.Timeout.timeout(Timeout.java:16)
	at cucumber.runtime.Utils.invoke(Utils.java:26)
	at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:37)
	at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:40)
	at cucumber.api.TestStep.executeStep(TestStep.java:102)
	at cucumber.api.TestStep.run(TestStep.java:83)
	at cucumber.api.TestCase.run(TestCase.java:58)
	at cucumber.runner.Runner.runPickle(Runner.java:80)
	at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:99)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:41)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:108)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

<Mappings>
        <Mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Collection" collectionType="List" mappingType="Collection">
            <Mappings>
                <Mapping xsi:type="Mapping" id="mapping.322350" mappingType="Map">
                    <InputField xsi:type="ns2:JavaField" name="strings" docId="io.atlasmap.qe.test.SourceListsClass" path="/strings&lt;&gt;" fieldType="String">
                        <Actions>
                            <ItemAt index="5"/>
                        </Actions>
                    </InputField>
                    <OutputField xsi:type="ns2:JavaField" name="targetDouble" docId="io.atlasmap.qe.test.TargetMappingTestClass" path="/targetDouble" fieldType="Double"/>
                </Mapping>
            </Mappings>
        </Mapping>
@igarashitm
Copy link
Member

Maybe ArrayIndexOutOfBoundsException was thrown? is the array size <5?

@igarashitm
Copy link
Member

As it's string > double it could be number format exception as well. Which one is this test for?

@mmelko
Copy link
Contributor Author

mmelko commented Oct 31, 2018

well behavior is the same for string, integer double. Array has size=10; In this case it was string but I'm testing it with integers. I believe it might be a problem with resolution of source field: Unexpected exception is thrown while reading source field: null:

@igarashitm igarashitm self-assigned this Oct 31, 2018
@igarashitm
Copy link
Member

Can you get a debug log? This line should emit a original stacktrace
https://github.com/atlasmap/atlasmap/blob/master/runtime/core/src/main/java/io/atlasmap/core/DefaultAtlasContext.java#L506

@igarashitm
Copy link
Member

Nevermind, I managed to reproduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants