File Upload Widget NullPointerException null path in data app

Hello everyone,

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.

However the error happens only when I configure and execute it through the Data App component.
image

If I copy paste the same node next to itself and select the file manually then it executes just fine.

Same if I choose a file which is not empty through the data app, it executes fine.

Is this a bug or am I doing something wrong?

I am using KNIME AP 4.7.4

Thanks to anyone who can help!!

Hello @rastasanu,

Welcome back to the forum!

It looks like the path of the file to be uploaded is not passed correctly. Can you share a workflow with some dummy data to check the error properly?

Best,
Keerthan

1 Like

Hello @k10shetty1 ,

Thank you for your reply!

Here’s a super simple example which has only the File Upload Widget inside a component.

file_upload_nullpointer.knwf (508.8 KB)

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.

Thanks a lot!

Hello @rastasanu,

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.

2024-08-27_18h25_22

Best,
Keerthan

3 Likes

Hey @rastasanu,

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.

Greetings,
Daniel

3 Likes

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

Thanks again!

Hey,

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?

Greetings,
Daniel

3 Likes

Hi @DanielBog ,

Ok I see thanks!

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

Cheers,
Cristian

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.

Greetings,
Daniel

3 Likes

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:
image

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.

file_upload_nullpointer_2.knwf (171.4 KB)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.