This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes Exception while uploading a zip file on Linux OS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Exception while uploading a zip file on Linux OS" Watch "Exception while uploading a zip file on Linux OS" New topic
Author

Exception while uploading a zip file on Linux OS

Anutosh Swamy
Ranch Hand

Joined: Sep 20, 2007
Posts: 30

Hi All,

I am getting an exception of

java.lang.IndexOutOfBoundsException
java.io.FileOutputStream.writeBytes(Native Method)
java.io.FileOutputStream.write(FileOutputStream.java:260)
com.aem.upload.ZipFileUploadServlet.processRequest(ZipFileUploadServlet.java:91)
com.aem.upload.ZipFileUploadServlet.doPost(ZipFileUploadServlet.java:115)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)

when I try uploading a ZIP file through my application running on Linux OS but the same is running fine on Windows OS (without any exception and uploading perfectly) kindly let me know where the code is wrong or I need to make some changes accordingly while making this run perfectly on Linux OS

Here's my Servlet code for uploading the Zip file:

ZipFileUploadServlet.java


index.jsp


Thank you in Advance


K. Anutosh<br /> <br />SCJP 1.4<br />SCWCD 1.4<br />OCA (Paper I)
Nitin Pathak
Ranch Hand

Joined: Sep 25, 2006
Posts: 70
There seems to be the problem with the length argument (endPos - startPos) of write(). As the exception clearly suggests, the code is trying to access the memory location outside the already-rigidly-assigned space.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Oh no, not again that roseindia.net ripoff.

Please read my answer in this topic: http://www.coderanch.com/t/414105/Servlets/java/Upload-Download-File
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception while uploading a zip file on Linux OS