0
votes

I have a simple flow that reads a csv file using a File Connector and I am trying to transform that data to json. Does not matter what I put as expression, I am always getting ArrayIndexOutOfBoundsException at design time and the preview does not generate. Below is the flow:

    <flow name="dw_exampleFlow">
        <file:inbound-endpoint path="C:\BNA\dw_sample" responseTimeout="10000" mimeType="application/csv" doc:name="File"/>
        <dw:transform-message doc:name="Transform Message" metadata:id="3496b3e4-708e-49c3-9f87-764eb149d1ee">
            <dw:set-payload><![CDATA[%dw 1.0
%output application/dw
---
payload]]></dw:set-payload>
        </dw:transform-message>
    </flow>
</mule>

Below is the error I am getting: Design Time Error

1
on a side note, may not be related to your issue but I think output type you want is json %output application/json - Charu Khurana
I tried that too, but getting the same error. So I wanted to try first with the dataweave canonical object and see if that works... - Satya

1 Answers

0
votes

What mule runtime are you using? it's working on me using 3.7.3

enter image description here enter image description here

<flow name="Flow">
        <file:inbound-endpoint
            path="/work/demo/workspace/3.7.3-dataweave/src/main/resources/input"
            moveToDirectory="/work/demo/workspace/3.7.3-dataweave/src/main/resources/output"
            responseTimeout="10000" doc:name="File" />
        <dw:transform-message metadata:id="ff8bbc88-efc7-4952-816a-a13f00ef6e6d"
            doc:name="Transform Message">
            <dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
payload]]></dw:set-payload>
        </dw:transform-message>
        <byte-array-to-string-transformer
            doc:name="Byte Array to String" />
        <logger message="#[payload]" level="INFO" doc:name="Logger" />
    </flow>