Upload does not work when using the same file again, when previous update was interrupted. Tested in Chrome using Tomcat 7. Uploading a big file and interrupting the process then leads to inability to upload the same file right after that.
Trying to upload another(different) file works fine and also after that uploading of the first file works as expected.
Was not able to reproduce in Firefox/ IE, only Chrome.
Also running the below code on jetty server in Chrome doesn't do anything on cancel button click. Works fine in other browsers
Vaadin version : 7.7.10
Also there was an older ticket about similar issue which is closed as resolved, but it was updated with similar issues after being closed also.
[ https://github.com/vaadin/framework/issues/4212 ]
Example to reproduce:
`
final VerticalLayout layout = new VerticalLayout();
Upload upload = new Upload();
upload.setImmediate(true);
Button cancel = new Button("Cancel upload");
cancel.setEnabled(false);
cancel.addClickListener(event -> {
System.out.print("Cancel button");
upload.interruptUpload();
});
Label name = new Label("nothing uploaded");
Label numBytes = new Label();
upload.setReceiver((filename, mime) -> {
return new OutputStream() {
long c = 0;
@Override
public void write(int b) throws IOException {
c++;
}
@Override
public void close() throws IOException {
super.close();
numBytes.setValue("Finished: read " + c + " at " + new Date());
}
};
});
upload.addStartedListener(ev -> {
name.setValue(ev.getFilename());
numBytes.setValue("started");
cancel.setEnabled(true);
UI.getCurrent().setPollInterval(1000);
});
upload.addProgressListener((bytes, total) -> numBytes.setValue("received " + bytes + " of " + total));
upload.addFinishedListener(ev -> cancel.setEnabled(false));
layout.addComponent(upload);
layout.addComponent(name);
layout.addComponent(numBytes);
layout.addComponent(cancel);
setContent(layout);`
There seem to be a few related tickets, including #6989, #5165 and the above mentioned (closed) #4212.
The bug is still present and reproducible with the Upload demo. and in 8.1.2
I've stepped through the code and made sure the ref to the tempfile was deleted after each upload. It seems that if the file name/path is the same, no events get fired.
I have this problem in 8.2.0 .
That is because the PR for Vaadin 8 is still stuck in the Pull Request queue in #10265.
Reopening until the above mentioned PR is resolved.
Most helpful comment
The bug is still present and reproducible with the Upload demo. and in 8.1.2
I've stepped through the code and made sure the ref to the tempfile was deleted after each upload. It seems that if the file name/path is the same, no events get fired.