<?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 Re: [resolved] Catch Java Exception tFileCopy in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261653#M42372</link>
    <description>Put down a tFlowToIterate followed by a tJavaFlex:&lt;BR /&gt;Begin:&lt;BR /&gt;try {&lt;BR /&gt;end:&lt;BR /&gt;} catch (Exception ex) {&lt;BR /&gt;&amp;nbsp;System.out.println(ex.getLocalizedMessage());&lt;BR /&gt;}</description>
    <pubDate>Mon, 08 Dec 2014 12:45:42 GMT</pubDate>
    <dc:creator>Dezzsoke</dc:creator>
    <dc:date>2014-12-08T12:45:42Z</dc:date>
    <item>
      <title>[resolved] Catch Java Exception tFileCopy</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261651#M42370</link>
      <description>Hi everybody, 
&lt;BR /&gt;I am getting a trouble using Talend : 
&lt;BR /&gt;I am copy/pasting XML file with the component tFileCopy. 
&lt;BR /&gt;The Destination Repertory and the PATH to the file are given with a row main linked to the tFileCopy. 
&lt;BR /&gt;I have actually no trouble when the file exist, it's working fine. 
&lt;BR /&gt;But if the file don't exist, i am getting a Java Exception, that is actually normal. 
&lt;BR /&gt;But i don't want that the Job stop because of that. 
&lt;BR /&gt;That's why I am trying to catch the error with a tWarn. 
&lt;BR /&gt;The error is catch, I have the row passing in tWarn, but I still have my Java Exception, and the job stop. 
&lt;BR /&gt;How can I do to catch the Exception without stopping the Job ? 
&lt;BR /&gt;I tried to use a java class : 
&lt;BR /&gt; 
&lt;PRE&gt;File f = new File("%PATH_TO_FILE%");&lt;BR /&gt;if ( f.exists() ) {}&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;/PRE&gt; 
&lt;BR /&gt;But actually I don't know how to use it ( I have to add something in the routine, but I don't know how/what to include ). 
&lt;BR /&gt;Is there an other way to do what I want ? 
&lt;BR /&gt;Thanks for watching, 
&lt;BR /&gt;regards, 
&lt;BR /&gt;Mathis 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBsB.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/148073iF19FAD6477ABA4AB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBsB.png" alt="0683p000009MBsB.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Mon, 08 Dec 2014 10:10:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261651#M42370</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-08T10:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Catch Java Exception tFileCopy</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261652#M42371</link>
      <description>Hi Mathis,&lt;BR /&gt;- Next to tUniqRow, use tjavarow and save the file name in the context variable&lt;BR /&gt;- use iterate link from tjavarow to connect to tFileCopy...&lt;BR /&gt;When you do this, if there is no row, then iterate will not work and you need not manage exceptions...&lt;BR /&gt;Try this way.&lt;BR /&gt;Vaibhav</description>
      <pubDate>Mon, 08 Dec 2014 10:28:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261652#M42371</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-08T10:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Catch Java Exception tFileCopy</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261653#M42372</link>
      <description>Put down a tFlowToIterate followed by a tJavaFlex:&lt;BR /&gt;Begin:&lt;BR /&gt;try {&lt;BR /&gt;end:&lt;BR /&gt;} catch (Exception ex) {&lt;BR /&gt;&amp;nbsp;System.out.println(ex.getLocalizedMessage());&lt;BR /&gt;}</description>
      <pubDate>Mon, 08 Dec 2014 12:45:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261653#M42372</guid>
      <dc:creator>Dezzsoke</dc:creator>
      <dc:date>2014-12-08T12:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Catch Java Exception tFileCopy</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261654#M42373</link>
      <description>I am trying the solution of Vaibhav,&lt;BR /&gt;but I still don't know which routine does I have to add in my job.&lt;BR /&gt;&lt;PRE&gt;File f = new File(input_row.dirname+"/"+input_row.NOM_FIC_XML);&lt;BR /&gt;if ( f.exists() ) { &amp;nbsp;&lt;BR /&gt;context.dirname=input_row.dirname;&lt;BR /&gt;context.NOM_FIC_XML=input_row.NOM_FIC_XML;&lt;BR /&gt;}&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;If i am using this code i have an error :&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;File isn't recognize as a valid type&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I think that's because I didn't add a routine for the type File, but I don't know where to find it.</description>
      <pubDate>Mon, 08 Dec 2014 13:05:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261654#M42373</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-08T13:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Catch Java Exception tFileCopy</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261655#M42374</link>
      <description>can you try tFileExist component with "if" connector. I think this will also work.&lt;BR /&gt;after tunique row component use tFileExist and then use "IF" connectors to check whether file is exist or not.&amp;nbsp;</description>
      <pubDate>Mon, 08 Dec 2014 13:13:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261655#M42374</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-08T13:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Catch Java Exception tFileCopy</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261656#M42375</link>
      <description>Thank you all for your answer. 
&lt;BR /&gt;I took a bit of each, and i solved my problem. 
&lt;BR /&gt;I am using a tJavaRow to assign the context variable, a tFlowToIterate to change the flux to an Iterate, 
&lt;BR /&gt;a tFileExist to check if the File is here, and the row IF to copy the file, or to write an error log in my database. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBo3.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/141203i0208DBC5663AAE21/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBo3.png" alt="0683p000009MBo3.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;Here is the code in the tjavaRow :&amp;nbsp; 
&lt;BR /&gt; 
&lt;PRE&gt;context.dirname=input_row.dirname;&lt;BR /&gt;context.NOM_FIC_XML=input_row.NOM_FIC_XML;&lt;BR /&gt;output_row.pathtoxml=input_row.dirname+"/"+input_row.NOM_FIC_XML;&lt;BR /&gt;&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Here is the NameofFileField in my tFileExist_1 : 
&lt;BR /&gt; 
&lt;PRE&gt;context.dirname+"/"+context.NOM_FIC_XML&lt;/PRE&gt; 
&lt;BR /&gt;and the condition IF linked to the tFileCopy_1:&amp;nbsp; 
&lt;BR /&gt; 
&lt;PRE&gt;((Boolean)globalMap.get("tFileExist_1_EXISTS"))&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Problem solved, thank you all 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Mon, 08 Dec 2014 13:39:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261656#M42375</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-08T13:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Catch Java Exception tFileCopy</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261657#M42376</link>
      <description>Great!!!&amp;nbsp;
&lt;BR /&gt;Thanks for updating the solution here..
&lt;BR /&gt;Vaibhav</description>
      <pubDate>Tue, 09 Dec 2014 05:09:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Catch-Java-Exception-tFileCopy/m-p/2261657#M42376</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-09T05:09:50Z</dc:date>
    </item>
  </channel>
</rss>

