https://bz.apache.org/bugzilla/show_bug.cgi?id=61282
--- Comment #2 from Jack <94544...@qq.com> --- (In reply to Violeta Georgieva from comment #1) > What is the problem that you think there is? I am sorry, let me state it one more time, I hope I can make it clear this time. servlet specification support nio, so when a user upload a file to server, at the server side, a servlet does not have to use the inputstream=request.getInputStream() to read the data. Instead, we set a readListener to the inputstream, when data is available, we got notified onDataAvailable(). This is good. The problem is that inside onDataAvailable, we read data byte[] ab=new byte[4096]; int len=is.read(ab,0,ab.length); we have to use ab inside onDataAvailable method, once this method returns, the content of ab will be changed for no reason! This is very weird, and should not happen unless the specification indicates the data is only valid inside onDataAvailable method. so what I do to get around it is to copy the data. byte[] ab2=new byte[len]; System.arraycopy(ab,0,ab2,0,len); then the content of ab2 is reliable, even after long time, the content of ab2 is not changed. Did I succeed in explaining this? Let me know if you have any doubt. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org