<?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 Exception rutine in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Exception-rutine/m-p/2217083#M12822</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;In tjava I have this code for checking the values :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;File directory = new File(context.main_path+"/Logs/test/");
if (! directory.exists()){
        directory.mkdirs();
}

PrintWriter pw = null;
try {
	//path of the target file
	File file = new File(context.main_path+"/Logs/test/test.csv");
	//enable appending in the file if it exists
	//if it doesn't exist it will be created
	FileWriter fw = new FileWriter(file, true);
	pw = new PrintWriter(fw);
	
	//print in file the timestamp, when the error occured + generic problem
	pw.println(TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate()) + " , " + "Error in reading file: " + ((String)globalMap.get("tWaitForFile_1_FILENAME")) + " , " + "Error: " + input_row.errorMessage);
	
	//print in file the specific errorMessage
	//pw.println(input_row.errorMessage);	
}
catch (IOException e) {
	e.printStackTrace();
}
finally {
	if (pw != null) {
			pw.close();
	}
}&lt;/PRE&gt;
&lt;P&gt;I want to ask if there is any way in order to make this code as a routine and just call it in my component instead of write every time this code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Apr 2020 10:06:39 GMT</pubDate>
    <dc:creator>DrGenious</dc:creator>
    <dc:date>2020-04-21T10:06:39Z</dc:date>
    <item>
      <title>Exception rutine</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Exception-rutine/m-p/2217083#M12822</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;In tjava I have this code for checking the values :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;File directory = new File(context.main_path+"/Logs/test/");
if (! directory.exists()){
        directory.mkdirs();
}

PrintWriter pw = null;
try {
	//path of the target file
	File file = new File(context.main_path+"/Logs/test/test.csv");
	//enable appending in the file if it exists
	//if it doesn't exist it will be created
	FileWriter fw = new FileWriter(file, true);
	pw = new PrintWriter(fw);
	
	//print in file the timestamp, when the error occured + generic problem
	pw.println(TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate()) + " , " + "Error in reading file: " + ((String)globalMap.get("tWaitForFile_1_FILENAME")) + " , " + "Error: " + input_row.errorMessage);
	
	//print in file the specific errorMessage
	//pw.println(input_row.errorMessage);	
}
catch (IOException e) {
	e.printStackTrace();
}
finally {
	if (pw != null) {
			pw.close();
	}
}&lt;/PRE&gt;
&lt;P&gt;I want to ask if there is any way in order to make this code as a routine and just call it in my component instead of write every time this code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 10:06:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Exception-rutine/m-p/2217083#M12822</guid>
      <dc:creator>DrGenious</dc:creator>
      <dc:date>2020-04-21T10:06:39Z</dc:date>
    </item>
  </channel>
</rss>

