upload component - 2 problems

Hello,

I am quite new to Vaadin flow and I am having troubles with the ‘vaadin-upload’ component.

Problem #1: User can clear uploaded file by clicking ‘x’ next to uploaded file but the backend does not get information which file was removed.
I guess it was intended that ‘vaadin-file-upload’ fires ‘file-abort’ which gets caughts by ‘vaadin-upload’ which fires ‘upload-abort’. Then I dont know how ‘vaadin-file-upload’ should fire ‘file-remove’ event, this should be again caught by ‘vaadin-upload’ which should update the property ‘files’. So the backend can eventually use two DOM events to get notification about file upload being aborted or about uploaded file being removed: event listener for ‘upload-abort’ or event listener for ‘files’ property change. Here’s the trap: event listener for ‘files’ property change does not detect any events when new file is successfully uploaded nor in case uploaded file is removed. And ‘upload-abort’ event does not contain file name -so at the BE I dont know which file was removed by client.

Problem #2: when I try to use on BE event listener for ‘before-upload’ event there is thrown uncaught exception when new upload starts:

java.lang.ClassCastException: Cannot cast elemental.json.impl.JreJsonString to elemental.json.JsonObject
	at java.lang.Class.cast(Class.java:3369)
	at com.vaadin.flow.internal.JsonCodec.decodeAs(JsonCodec.java:224)
	at com.vaadin.flow.component.ComponentEventBus.lambda$createEventDataObjects$3(ComponentEventBus.java:240)
	at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
	at com.vaadin.flow.component.ComponentEventBus.createEventDataObjects(ComponentEventBus.java:235)
	at com.vaadin.flow.component.ComponentEventBus.createEventForDomEvent(ComponentEventBus.java:354)
	at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:324)
	at com.vaadin.flow.component.ComponentEventBus.lambda$addDomTrigger$5ee67f2b$1(ComponentEventBus.java:190)
	at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$2(ElementListenerMap.java:378)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:378)
	at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:58)
	at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:63)
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:377)
	at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$0(ServerRpcHandler.java:367)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:367)
	at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:309)
	at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89)
	at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1495)
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:300)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:835)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1685)
	at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
	at org.eclipse.jetty.server.Server.handle(Server.java:517)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
	at java.lang.Thread.run(Thread.java:748)

For me it looks like the BE does not correctly handle event data.

Any hints how to fix these 2 problems are highly appreciated. Thanks!

UPDATE - problems are not related to the UI component. Just in case someone would be searching for this kind of problem, it is now tracked by two issues:
https://github.com/vaadin/vaadin-upload-flow/issues/57
https://github.com/vaadin/vaadin-upload-flow/issues/58