tomcat - Java webapp can't write image to folder created by webapp -
i have web application, have several actions. 1 of actions writes image folder out of context, lets to:
/home/user/images/subfolder1/image.jpg
now, action copies image folder located inside images, different extension, lets to:
/home/user/images/subfolder2/subsubfolder2-1/image.png
now, first image form, second image path first image saved, both images written same method:
inputstream in = new fileinputstream(origen); outputstream out = new fileoutputstream(destination.getabsolutepath()); while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); }
the webapp creates every folder, including "subfolder2/subsubfolder2-1/" using mkdirs() if don't exist.
this works fine in test enviroment running ubuntu 14.04 apache tomcat 6.0.43, but, on production, centos 6(or 6.5), same apache tomcat version, image created, no data written it, mean, image.png file created, size 0. folders have correct permissions, drwxrwxrwx, image.png reason, lacks them, having rw.
what can causing this?
for uknown reason, changed how write file to:
inputstream in = new fileinputstream(origen); outputstream out = new fileoutputstream(destination.getabsolutepath()); int byteread = 0; byte[] buffer = new byte[8192]; while ((byteread = in.read(buffer, 0, 8192)) != -1){ out.write(buffer, 0, byteread); }
and worked properly, don't know reason behind it.
Comments
Post a Comment