Skip to content

server-side declining and the large file junking, with UploadFileHandler ? #100

Description

@rucko24

Hi @mstahv

Well, I'm writing to you directly because I understand that you're the developer of this class, from Viritin itself, hehe...

https://github.com/rucko24/xsd-validator-ui/blob/main/src/main/java/com/rubn/xsdvalidator/view/Input.java#L331

I just have this here.

When I upload an .mp4 file, which I have as an unsupported file, it jumps to the catch

but when that exception is triggered, the

return new UploadFileHandler((InputStream inputStream, UploadFileHandler.FileDetails metadata) -> {
            try (final FastByteArrayOutputStream fastOutputStream = new FastByteArrayOutputStream()) {
                if (SupportFilesEnum.fromExtension(FileUtils.getFileExtension(metadata.fileName())) == SupportFilesEnum.UNKNOWN) {
                    throw new IllegalArgumentException("File not supported!");
                }
                String fileName = metadata.fileName();
                if (this.decompressionService.isCompressedFile(fileName)) {
                    List<DecompressedFile> files = this.decompressionService.decompressFile(fileName, inputStream);
                    files.forEach(decompressedFile -> {
                        this.executeUI(() -> this.processFile(metadata, decompressedFile.content(), true, decompressedFile));
                    });
                } else {
                    inputStream.transferTo(fastOutputStream);
                    byte[] bytes = fastOutputStream.toByteArray();
                    this.executeUI(() -> {
                        this.processFile(metadata, bytes, false, new DecompressedFile(null, null, 0L));
                    });
                }
                return () -> {
                    this.uploader.clearFileList();
                    this.searchPopover.updateItems(this.getXsdXmlFiles());
                };
            } catch (Exception error) {
                return () -> {
                    log.error("Error catch uploader: {}", error.getMessage());
                    Notification.show("Upload failed: " + error.getMessage(),
                                    2000, Notification.Position.MIDDLE)
                            .addThemeVariants(NotificationVariant.LUMO_WARNING);
                    this.uploader.clearFileList();
                };
            }
        })
                .withClearAutomatically(true)
                .withAddedClassName("upload-xml-xsd", LumoUtility.Padding.XSMALL, LumoUtility.Width.FULL,
                        LumoUtility.Margin.Right.MEDIUM, LumoUtility.Margin.Left.NONE)
                .withDragAndDrop(true)
                .withDropLabelIcon(new Span())
                .withDropLabel(new Span("Drop files here, only support: " + XsdValidatorConstants.SUPPORT_FILES))
                .withUploadButton(attachment);
Notification.show(“Upload failed: ” + error.getMessage(),
                                    2000, Notification.Position.MIDDLE)
                            .addThemeVariants(NotificationVariant.LUMO_WARNING);

It notifies approximately 6 times.

2026-01-29T19:23:05.705+01:00 ERROR 2284174 --- [nio-8888-exec-4] com.rubn.xsdvalidator.view.Input         : Error catch uploader: File not supported!
2026-01-29T19:23:06.245+01:00 ERROR 2284174 --- [nio-8888-exec-7] com.rubn.xsdvalidator.view.Input         : Error catch uploader: File not supported!
2026-01-29T19:23:06.440+01:00 ERROR 2284174 --- [nio-8888-exec-9] com.rubn.xsdvalidator.view.Input         : Error catch uploader: File not supported!
2026-01-29T19:23:06.568+01:00 ERROR 2284174 --- [nio-8888-exec-3] com.rubn.xsdvalidator.view.Input         : Error catch uploader: File not supported!
2026-01-29T19:23:06.727+01:00 ERROR 2284174 --- [nio-8888-exec-8] com.rubn.xsdvalidator.view.Input         : Error catch uploader: File not supported!
2026-01-29T19:23:07.028+01:00 ERROR 2284174 --- [nio-8888-exec-5] com.rubn.xsdvalidator.view.Input         : Error catch uploader: File not supported!

From forum: https://vaadin.com/forum/t/uploadfilehandler-from-matti/179148

From Matti,

Sounds like a problem with server-side declining and the large file junking. Probably quite easy to fix, client side should check the error code (and server should set it to something else if not set already). Can you file an issue to the repo?

test with file size: 2.4GB

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions