-1
I have the following strange behavior. I am creating a text file using Filewriter and Bufferedwriter. At the end of the run (void main), the generated file is deleted. If I debug and stop the execution, the file is kept. I realized that this behavior started from some version of Java. Someone went through it?
public static void write( String dir, String fileName, boolean append, String content ) {
FileWriter fw = null;
BufferedWriter bw = null;
try {
fw = new FileWriter(new File(dir,fileName),append);
bw = new BufferedWriter(fw);
bw.write(content);
bw.flush();
} catch (Exception e) {
// TODO: handle exception
} finally {
try {bw.close();}catch(Exception e) {}
try {fw.close();}catch(Exception e) {}
}
}