DragAndDropWrapper FormatNumberException

Sorry, the title is wrong of course. It would be:

DragAndDropWrapper NumberFormatException

Hello everybody,

I’m building a File Uploader (with vaadin
7.0.3
) by using HTML5 File along with drag and drop.
The component is the one you can see in the enclosed “upload.PNG” file.

My problem is that if I upload a very big file (around 4GB) vaadin raises an exception stating:


mag 24, 2013 11:41:46 AM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE: 
java.lang.NumberFormatException: For input string: "3798213230"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:495)
	at java.lang.Integer.valueOf(Integer.java:582)
	at com.vaadin.server.JsonCodec.decodeInternalType(JsonCodec.java:385)
	at com.vaadin.server.JsonCodec.decodeUidlValue(JsonCodec.java:403)
	at com.vaadin.server.JsonCodec.decodeInternalType(JsonCodec.java:346)
	at com.vaadin.server.JsonCodec.decodeInternalOrCustomType(JsonCodec.java:246)
	at com.vaadin.server.JsonCodec.decodeStringMap(JsonCodec.java:504)
	at com.vaadin.server.JsonCodec.decodeMap(JsonCodec.java:452)
	at com.vaadin.server.JsonCodec.decodeInternalType(JsonCodec.java:358)
	at com.vaadin.server.JsonCodec.decodeUidlValue(JsonCodec.java:403)
	at com.vaadin.server.JsonCodec.decodeInternalType(JsonCodec.java:346)
	at com.vaadin.server.AbstractCommunicationManager.parseLegacyChangeVariablesInvocation(AbstractCommunicationManager.java:1830)
	at com.vaadin.server.AbstractCommunicationManager.parseInvocation(AbstractCommunicationManager.java:1808)
	at com.vaadin.server.AbstractCommunicationManager.parseInvocations(AbstractCommunicationManager.java:1762)
	at com.vaadin.server.AbstractCommunicationManager.handleBurst(AbstractCommunicationManager.java:1620)
	at com.vaadin.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1566)
	at com.vaadin.server.AbstractCommunicationManager.handleUidlRequest(AbstractCommunicationManager.java:582)
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:315)
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:201)
	at org.ceia.profiling.servlet.ProfilingApplicationServlet.service(ProfilingApplicationServlet.java:101)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
	at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)

I think this is because you are trying to parse the file-size that actually is bigger than then the Integer.MAX_VALUE.

A, I doing something wrong or is it a bug?

Best Regards
Guglielmo Moretti.
13002.png

don’t want to bother you, but it seems to be a bug… any help?

Not really sure where the problem is, but I have heard issues of having problems with very large uploads. Servlet containers do have have their limits of how big files they can accept as uploads - as just a limitation but also a security measure - you don’t want to open a way to attack your software by allowing a user to upload unlimited amount of data and filling up your server until it crashes. Browsers have also their own limitations.

Servlet containers’ limit can usually be upped in a configuration file, and I know that Tomcat, that you are using, has an option for that. Google up on “tomcat upload limit” and such.

However - it seems that the exception you got here comes from a Vaadin class (JsonCodec) and that it uses an integer in a place where it should use a long. I’d say that filing a ticket would be the appropiate action.

Has the drag and drop thing anything to do with this? does the upload work if you use the same file but with a standard upload component where you select the file trough a file system browser?

Hello Jens, and thank for your answer.

I need more tests before giving you answers about your question if it is only related to drag and drop. And I’ll do it.
The first thing that comes to my mind is that i wanted to use D&D to upload file (using HTML5 Files) but as stated inside Vaadin’s javadoc, that feature is only experimental. In fact, Internet Explorer does not support that and, as a fallback, I use a standard upload component only in case that the detected browser is Internet Eplorer.
In that circumstance ( using the Uplaod component) no error happened.
However i’ll report to you detailed info on Monday, thank you.

P.S.: If take a look at the stack trace, the
3798213230
that is reported is the exact file size of my upload. I don’t think this could be related to Tomcat in any way.

I’ll Keep you informed.

Best regards
Guglielmo Moretti

Hi,

We are using Vaadin 7.1 at the moment and encounter similar issue. At the moment close 2GB works fine, but seems like anything bigger throw the NumberFormatException. Is this something that fixed in later version ? or is there a way to perform the file check size prior to receive the file drop action ?

Cheers,

NVM, seems like it is fixed in Vaadin 7.2.x