6218397: Printing to file does not throw a PrinterException if the file cannot be created

Reviewed-by: prr, jdv
This commit is contained in:
Prasanta Sadhukhan 2016-07-01 10:54:18 +05:30
parent 41e155e1e1
commit fa55ad2d91
2 changed files with 9 additions and 1 deletions

View file

@ -1627,6 +1627,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
(!f.isFile() || !f.canWrite())) ||
((pFile != null) &&
(!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
if (f.exists()) {
f.delete();
}
throw new PrinterException("Cannot write to file:"+
dest);
}