
Anonymous
Not applicable
2007-11-22
10:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Component tFileDelete cannot delete file created by tFileOutputExcel
Hello,
I am trying to delete files created with the component tFileOutputExcel depending
on a condition (deleteIfEmpty), but they cannot be deleted.
To simplify this sample, I substituted the component deleteIfEmpty by the component
tFileDelete, and deactivated deleteIfEmpty (see image).
Looking at the flow, all created files (with tFileOutputExcel) should be deleted by the tFileDelete
component, but they are not being deleted. It looks like the output file is still opened and cannot
be deleted.
I tried to connect (with "OnOK") the component "set Vars" and "tFileInputExcel_1" and none of
them is working.
Any hints?
- the component deleteIfEmpty should delete the file depending on the number of written rows
(i.e. globalMap.get("tFileOutputExcel_1_NB_LINE"))
- the code responsible for the deletion returns always "file could not be deleted":
java.io.File df = new java.io.File((String)globalMap.get("currentOutputFileName"));
if (df.exists() && df.isFile()) {
if (df.delete()) {
System.out.println("file deleted");
} else {
System.out.println("file could not be deleted");
}
Thanks!
eripet
---
Using...
TOS Version: 2.2.2
Language: Java
I am trying to delete files created with the component tFileOutputExcel depending
on a condition (deleteIfEmpty), but they cannot be deleted.
To simplify this sample, I substituted the component deleteIfEmpty by the component
tFileDelete, and deactivated deleteIfEmpty (see image).
Looking at the flow, all created files (with tFileOutputExcel) should be deleted by the tFileDelete
component, but they are not being deleted. It looks like the output file is still opened and cannot
be deleted.
I tried to connect (with "OnOK") the component "set Vars" and "tFileInputExcel_1" and none of
them is working.
Any hints?
- the component deleteIfEmpty should delete the file depending on the number of written rows
(i.e. globalMap.get("tFileOutputExcel_1_NB_LINE"))
- the code responsible for the deletion returns always "file could not be deleted":
java.io.File df = new java.io.File((String)globalMap.get("currentOutputFileName"));
if (df.exists() && df.isFile()) {
if (df.delete()) {
System.out.println("file deleted");
} else {
System.out.println("file could not be deleted");
}
Thanks!
eripet
---
Using...
TOS Version: 2.2.2
Language: Java
939 Views
- « Previous Replies
-
- 1
- 2
- Next Replies »
12 Replies

Anonymous
Not applicable
2007-11-23
12:27 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Replace your deleteIfEmpty component by a tJavaFlex.
Put your code in the end part and link it to your tFileOuputExcel with a RunIf.
RunIf condition can be something like globalMap.get("tFileOutputExcel_1_NB_LINE"))>0
Regards,
Replace your deleteIfEmpty component by a tJavaFlex.
Put your code in the end part and link it to your tFileOuputExcel with a RunIf.
RunIf condition can be something like globalMap.get("tFileOutputExcel_1_NB_LINE"))>0
Regards,
816 Views

Anonymous
Not applicable
2007-11-26
09:59 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello mhirt,
thanks for your reply, but I am afraid your solution does not work neither.
The output Excel file is at the moment the code is executed (in JavaFlex -> End code) still open. I tried to attach it to different components (set Vars, tFileOutputExcel -see picture above-), but it did not work....
It looks like there is a bug, and the component does not close the files as it should, not even at the end of the whole job...
If I link a tFileDelete component to the showInfo component the file will NOT be deleted. If I check the "fail on Error" box the code throws no exception, as the file is still there and delete() returns only true if the file exists and was deleted or false it it exists and was not deleted.
If thousands of files are to be created by such a job, I can imagine that it would get slower and slower and crash at some stage, as the needed OS ressources are limited!
Can you please take a closer look to this issue?
Thanks!
eripet
thanks for your reply, but I am afraid your solution does not work neither.
The output Excel file is at the moment the code is executed (in JavaFlex -> End code) still open. I tried to attach it to different components (set Vars, tFileOutputExcel -see picture above-), but it did not work....
It looks like there is a bug, and the component does not close the files as it should, not even at the end of the whole job...
If I link a tFileDelete component to the showInfo component the file will NOT be deleted. If I check the "fail on Error" box the code throws no exception, as the file is still there and delete() returns only true if the file exists and was deleted or false it it exists and was not deleted.
If thousands of files are to be created by such a job, I can imagine that it would get slower and slower and crash at some stage, as the needed OS ressources are limited!
Can you please take a closer look to this issue?
Thanks!
eripet
816 Views

Anonymous
Not applicable
2007-11-28
01:08 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're right.
I tried and even if the file.close() command is sent at the end of the component tFileOutputExcel, before the call to the delete, the file.delete() command return false.
Same tJavaFlex in another independant job works.
Can you add a bugtracker entry for this problem ? I think it's related to the API used by the tFileOutputExcel.
Thanks for your support.
I tried and even if the file.close() command is sent at the end of the component tFileOutputExcel, before the call to the delete, the file.delete() command return false.
Same tJavaFlex in another independant job works.
Can you add a bugtracker entry for this problem ? I think it's related to the API used by the tFileOutputExcel.
Thanks for your support.
816 Views

Anonymous
Not applicable
2007-12-03
04:13 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello mhirt,
thanks for your reply.
New bug related to this issue opened: 2558
Thnx again!
eripet
thanks for your reply.
New bug related to this issue opened: 2558
Thnx again!
eripet
816 Views

Anonymous
Not applicable
2010-11-03
07:12 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
New bug related to this issue opened: 2558
This may not be a bug. Although you do say " the component does not close the files as it should, not even at the end of the whole job..." it does not seem to be the case in other contexts: as I describe it in https://community.talend.com/t5/Design-and-Development/create-an-excel-document-with-multiple-sheets... you can only touch the generated Excel file in a different subjob. Let me know.
816 Views

Anonymous
Not applicable
2011-10-13
12:24 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I've somewhat the same issue, i'm triggering an error on my database connection and in that case i don't want any file generated. Yet talend still generates an empty file.
I cannot just check the "don't generate empty file' as some report can be empty.
I just want to have no report when there is a java error and i cannot find how to do it, because the file is opened until the end of the job and i cannot delete it or anything...
I've somewhat the same issue, i'm triggering an error on my database connection and in that case i don't want any file generated. Yet talend still generates an empty file.
I cannot just check the "don't generate empty file' as some report can be empty.
I just want to have no report when there is a java error and i cannot find how to do it, because the file is opened until the end of the job and i cannot delete it or anything...
816 Views

Anonymous
Not applicable
2012-09-21
09:05 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Long Path Tool helped me in this situation. http://PathTooDeep.com
816 Views

Specialist III
2012-09-29
11:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why not you are trying long path tool? Long Path Tool helped me in this situation. http://PathTooDeep.com
816 Views

Contributor
2014-07-09
07:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using temp space as a my disk for lookup so it is creating so many oracle files in that space when job failed any reasong those files and folder I am trying to delete but it is not deleting folder.
I tried the below senarios.
onSubjobOk
tPostJob->tOracleClose>tFileExist->tFileDelete
this is using for only if job logging purpose--tLogCatcher>tsendMailonComponetOk->tFileDelete
tFileDelete<-onSubjobOk<tLogCatcher->tsendMail
Please let me know as soon as possibel.
Thanks
Narendharr
I am using temp space as a my disk for lookup so it is creating so many oracle files in that space when job failed any reasong those files and folder I am trying to delete but it is not deleting folder.
I tried the below senarios.
onSubjobOk
tPostJob->tOracleClose>tFileExist->tFileDelete
this is using for only if job logging purpose--tLogCatcher>tsendMailonComponetOk->tFileDelete
tFileDelete<-onSubjobOk<tLogCatcher->tsendMail
Please let me know as soon as possibel.
Thanks
Narendharr
816 Views

- « Previous Replies
-
- 1
- 2
- Next Replies »