Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

OutputStream gets a IndexOutOfBoundsException

 
Ludovik Lax
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I try to copy an xsd file from a mvn project structure (the resource is in /template folder), so that , when I launch jar, the Main calls the xsd and copies it to current directory (outside the jar):


But when main method calls CopyXSD(), this returns an exception:

Exception in thread "main" java.lang.IndexOutOfBoundsException
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at eu.europa.schengen.dataengine.enginerunner.Main.copyXSD(Main.java:94)
at eu.europa.schengen.dataengine.enginerunner.Main.main(Main.java:49)


Thanks for any help;

Regards,

NB.

 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your call to the "write" method is outside the while-loop and therefore you are calling it when len is -1.
 
Ludovik Lax
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

as there is a test in while loop for positive values only, it can't write outside while loop.
But, i've found another way, much more simpler :



 
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!