<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Split / ArrayIndexOutOfBoundsException in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342870#M110687</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a csv file:&lt;/P&gt;&lt;P&gt;COL1|COL2|COL3&lt;/P&gt;&lt;P&gt;avant|99999;88888;77777|après&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to split column 2.&lt;/P&gt;&lt;P&gt;So I did in a JavaRow:&lt;/P&gt;&lt;P&gt;output_row.COL1 = input_row.COL1;&lt;/P&gt;&lt;P&gt;output_row.COL2_1 = StringHandling.TRIM(input_row.COL2).split(";")[0];&lt;/P&gt;&lt;P&gt;output_row.COL2_2 = StringHandling.TRIM(input_row.COL2).split(";")[1];&lt;/P&gt;&lt;P&gt;output_row.COL2_3 = StringHandling.TRIM(input_row.COL2).split(";")[2];&lt;/P&gt;&lt;P&gt;output_row.COL3 = input_row.COL3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I have this error: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it's ok only with &lt;/P&gt;&lt;P&gt;output_row.COL2_1 = StringHandling.TRIM(input_row.COL2).split(";")[0]; &lt;/P&gt;&lt;P&gt;I don't understand because I have 3 elements and if I test with &lt;/P&gt;&lt;P&gt;StringHandling.TRIM(input_row.COL2).split(";").length, &lt;/P&gt;it turns out 3 for me...&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 02 May 2023 15:18:15 GMT</pubDate>
    <dc:creator>Canabral</dc:creator>
    <dc:date>2023-05-02T15:18:15Z</dc:date>
    <item>
      <title>Split / ArrayIndexOutOfBoundsException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342870#M110687</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a csv file:&lt;/P&gt;&lt;P&gt;COL1|COL2|COL3&lt;/P&gt;&lt;P&gt;avant|99999;88888;77777|après&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to split column 2.&lt;/P&gt;&lt;P&gt;So I did in a JavaRow:&lt;/P&gt;&lt;P&gt;output_row.COL1 = input_row.COL1;&lt;/P&gt;&lt;P&gt;output_row.COL2_1 = StringHandling.TRIM(input_row.COL2).split(";")[0];&lt;/P&gt;&lt;P&gt;output_row.COL2_2 = StringHandling.TRIM(input_row.COL2).split(";")[1];&lt;/P&gt;&lt;P&gt;output_row.COL2_3 = StringHandling.TRIM(input_row.COL2).split(";")[2];&lt;/P&gt;&lt;P&gt;output_row.COL3 = input_row.COL3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I have this error: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it's ok only with &lt;/P&gt;&lt;P&gt;output_row.COL2_1 = StringHandling.TRIM(input_row.COL2).split(";")[0]; &lt;/P&gt;&lt;P&gt;I don't understand because I have 3 elements and if I test with &lt;/P&gt;&lt;P&gt;StringHandling.TRIM(input_row.COL2).split(";").length, &lt;/P&gt;it turns out 3 for me...&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 15:18:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342870#M110687</guid>
      <dc:creator>Canabral</dc:creator>
      <dc:date>2023-05-02T15:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Split / ArrayIndexOutOfBoundsException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342871#M110688</link>
      <description>&lt;P&gt;Hello @Simon Thieffry​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I can't reproduce the issue in my side, could you please provide the whole job execution error log for more investigation? thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Aiming&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 01:50:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342871#M110688</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-04T01:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Split / ArrayIndexOutOfBoundsException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342872#M110689</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the error log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Démarrage du Job test à 10:31 04/05/2023.&lt;/P&gt;&lt;P&gt;[statistics] connecting to socket on port 3699&lt;/P&gt;&lt;P&gt;[statistics] connected&lt;/P&gt;&lt;P&gt;Exception in component tJavaRow_1 (test)&lt;/P&gt;&lt;P&gt;java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1&lt;/P&gt;&lt;P&gt;	at godin.test_0_1.test.tFileInputDelimited_1Process(test.java:1059)&lt;/P&gt;&lt;P&gt;	at godin.test_0_1.test.runJobInTOS(test.java:1513)&lt;/P&gt;&lt;P&gt;	at godin.test_0_1.test.main(test.java:1351)&lt;/P&gt;&lt;P&gt;[statistics] disconnected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Job test terminé à 10:31 04/05/2023. [Code de sortie&amp;nbsp;= 1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And more info on the job in the capture.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 08:38:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342872#M110689</guid>
      <dc:creator>Canabral</dc:creator>
      <dc:date>2023-05-04T08:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Split / ArrayIndexOutOfBoundsException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342874#M110691</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No, there is no space in my separator, that is semicolon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But using the code with the intermediate variable it works :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;String[] col2Values = StringHandling.TRIM(input_row.COL2).split("; ");&lt;/P&gt;&lt;P&gt;output_row.COL2_1 = col2Values.length &amp;gt;= 1 ? col2Values[0] : "";&lt;/P&gt;&lt;P&gt;output_row.COL2_2 = col2Values.length &amp;gt;= 2 ? col2Values[1] : "";&lt;/P&gt;&lt;P&gt;output_row.COL2_3 = col2Values.length &amp;gt;= 3 ? col2Values[2] : "";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 10:40:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-ArrayIndexOutOfBoundsException/m-p/2342874#M110691</guid>
      <dc:creator>Canabral</dc:creator>
      <dc:date>2023-05-09T10:40:22Z</dc:date>
    </item>
  </channel>
</rss>

