Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions test/jdk/javax/imageio/ReadAbortTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
* calling IIOReadProgressListener.readAborted() for all readers.
* @run main ReadAbortTest
*/
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.nio.file.Files;
import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.event.IIOReadProgressListener;
import javax.imageio.stream.ImageInputStream;
import java.awt.Color;
import java.awt.Graphics2D;
import java.nio.file.Files;

public class ReadAbortTest implements IIOReadProgressListener {

Expand Down Expand Up @@ -103,7 +104,9 @@ public ReadAbortTest(String format) throws Exception {
} catch (Exception e) {
throw e;
} finally {
Files.delete(file.toPath());
if (file != null && file.exists()) {
Files.delete(file.toPath());
}
}
}

Expand Down
15 changes: 9 additions & 6 deletions test/jdk/javax/imageio/WriteAbortTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,15 +30,16 @@
* calling IIOWriteProgressListener.readAborted() for all readers.
* @run main WriteAbortTest
*/
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.nio.file.Files;

import javax.imageio.ImageIO;
import javax.imageio.ImageWriter;
import javax.imageio.event.IIOWriteProgressListener;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;

public class WriteAbortTest implements IIOWriteProgressListener {
Expand Down Expand Up @@ -98,7 +99,9 @@ public WriteAbortTest(String format) throws Exception {
+ format);
}
} finally {
Files.delete(file.toPath());
if (file != null && file.exists()) {
Files.delete(file.toPath());
}
}
}

Expand Down