• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Exception while uploading a zip file on Linux OS

 
Ranch Hand
Posts: 30
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh no, not again that roseindia.net ripoff.

Please read my answer in this topic: https://coderanch.com/t/414105/Servlets/java/Upload-Download-File
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic