8342635: javax/swing/JFileChooser/FileSystemView/WindowsDefaultIconSizeTest.java creates tmp file in src dir

8342634: javax/imageio/plugins/wbmp/WBMPStreamTruncateTest.java creates temp file in src dir

Reviewed-by: erikj, serb
This commit is contained in:
Harshitha Onkar 2024-10-30 21:53:12 +00:00
parent 7461dfe9c6
commit 02ea4b548e
2 changed files with 5 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024, 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
@ -46,9 +46,6 @@ public class WBMPStreamTruncateTest
static final int height = 100;
public static void main(String[] args) throws IOException
{
String sep = System.getProperty("file.separator");
String dir = System.getProperty("test.src", ".");
String filePath = dir+sep;
BufferedImage srcImage = new
BufferedImage(width, height, BufferedImage.TYPE_BYTE_BINARY);
Graphics2D g = (Graphics2D) srcImage.getGraphics();
@ -57,7 +54,7 @@ public class WBMPStreamTruncateTest
g.dispose();
// create WBMP image
File imageFile = File.
createTempFile("test", ".wbmp", new File(filePath));
createTempFile("test", ".wbmp", new File("./"));
imageFile.deleteOnExit();
ImageIO.write(srcImage, "wbmp", imageFile);
BufferedImage testImg =

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, 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
@ -44,18 +44,16 @@ public class WindowsDefaultIconSizeTest {
}
public void test() {
String sep = System.getProperty("file.separator");
String dir = System.getProperty("test.src", ".");
String filename = "test.not";
File testFile = new File(dir + sep + filename);
File testFile = new File(filename);
try {
if (!testFile.exists()) {
testFile.createNewFile();
testFile.deleteOnExit();
}
FileSystemView fsv = FileSystemView.getFileSystemView();
Icon icon = fsv.getSystemIcon(new File(dir + sep + filename));
Icon icon = fsv.getSystemIcon(new File(filename));
if (icon instanceof ImageIcon) {
Image image = ((ImageIcon) icon).getImage();
if (image instanceof MultiResolutionImage) {