forked from jasder/antlr
resource leak fix from Coverity Scan
This commit is contained in:
parent
9c186c8d52
commit
d4f2abc5e3
|
@ -87,8 +87,8 @@ public class GraphicsSupport {
|
|||
StreamPrintServiceFactory[] factories =
|
||||
StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor, mimeType);
|
||||
System.out.println(Arrays.toString(factories));
|
||||
FileOutputStream out = new FileOutputStream(fileName);
|
||||
if (factories.length > 0) {
|
||||
FileOutputStream out = new FileOutputStream(fileName);
|
||||
PrintService service = factories[0].getPrintService(out);
|
||||
SimpleDoc doc = new SimpleDoc(new Printable() {
|
||||
@Override
|
||||
|
@ -115,6 +115,7 @@ public class GraphicsSupport {
|
|||
DocPrintJob job = service.createPrintJob();
|
||||
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
|
||||
job.print(doc, attributes);
|
||||
out.close();
|
||||
}
|
||||
} else {
|
||||
// parrt: works with [image/jpeg, image/png, image/x-png, image/vnd.wap.wbmp, image/bmp, image/gif]
|
||||
|
|
Loading…
Reference in New Issue