I am getting a NullPointerException error when I am trying to upload an empty .csv file through the “File Upload Widget” node which is part of a data app component.
So if you try to open the component in the Interactive View mode and upload an empty .csv you will see the error.
I cannot upload also the file that I used as it is 0 bytes and it gives me an error but to simulate it you can create a .csv file without any data in it.
Since the file is stored on your system, I selected the option to disable output if the file doesn’t exist in the upload widget. After that, the component functioned properly.
I could reproduce the problem. I created a ticket to fix it (internal reference UIEXT-2126) and this thread will be updated as soon as the fix is release.
@k10shetty1 seems like it is working in your example as the CSV you selected still contains some empty cells. The size of your selected file still is 5b. As soon as you delete all content it will fail.
Thank you @k10shetty1 for the attempt.
Indeed as @DanielBog mentioned it does not work for a file which is 0b.
Thanks for the ticket, will be waiting!
Do you know if there will be the need to update to a newer version of KNIME or it will be available in the same version? Because we are bound for now to 4.7.4
this will definitely require a newer version as we are not able to patch existing versions. How do you create these empty csv files? As a workaround it might make sense to fill them with something and filter for that in the workflow?
I am doing it actually as a test so that I can create an alert if a user uploads an empty file so then I can redirect them to another page saying that they should upload a file that contains some data. So I am basically controlling if someone uploads something they shouldn’t, aka an empty file.
I am creating the file simply through a notebook saved as a .csv
I see in this case the only workaround that comes to my mind is to wrap the whole upload process in a try catch block. This way you can catch the error and handle it yourself until we allowed empty csv’s.
Thanks for the suggestion @DanielBog
However when I do it and execute it from the interactive view of the component the Try and Catch system doesn’t seem to work:
It works outside the component tho, but inside it just stops at the Catch Errors and doesn’t go further as the variable output port of the File Upload Widget is still open even tho in error.