This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara 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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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