Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8182043: Access to Windows Large Icons #2875

Closed
wants to merge 18 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -278,10 +278,9 @@ public Icon getSystemIcon(File f) {
* @param width width of the icon in user coordinate system.
* @param height height of the icon in user coordinate system.
* @return an icon as it would be displayed by a native file chooser
* or null if invalid parameters are passed such as reference to a
* non-existent file.
* @throws IllegalArgumentException if invalid parameter such
* as negative size or null file reference is passed.
* or null for a non-existent or inaccessible file.
* @throws IllegalArgumentException if an invalid parameter such
* as a negative size or a null file reference is passed.
* @see JFileChooser#getIcon
Copy link
Contributor

@prrace prrace May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor grammar : add "an"or "a" as appropriate, ie change to :
"if an invalid parameter such a negative size or a null file reference"

* @see AbstractMultiResolutionImage
* @see FileSystemView#getSystemIcon(File)
@@ -292,8 +291,8 @@ public Icon getSystemIcon(File f, int width, int height) {
throw new IllegalArgumentException("Icon size can not be below 1");
Copy link
Contributor

@prrace prrace May 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor) spacing. <1

Copy link
Member Author

@azuev-java azuev-java May 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. Fixed.

}

if (f == null){
throw new IllegalArgumentException("File reference should be specified");
if (f == null) {
throw new IllegalArgumentException("The file reference should not be null");
}

if(!f.exists()) {
@@ -28,6 +28,7 @@
* sun.awt.shell.ShellFolder
Copy link
Contributor

@prrace prrace May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the comment here mean ?

Copy link
Member Author

@azuev-java azuev-java May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a leftover from the first iteration of the test. I guess i have to remove it.

* @run main SystemIconTest
*/
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.filechooser.FileSystemView;
import java.awt.image.MultiResolutionImage;
@@ -55,18 +56,15 @@ static void testSystemIcon() {
}

static void negativeTests() {
ImageIcon icon;
boolean gotException = false;
Icon icon;
try {
icon = (ImageIcon) fsv.getSystemIcon(new File("."), -1, 16);
} catch (IllegalArgumentException iae) {
gotException = true;
}
if (!gotException) {
icon = fsv.getSystemIcon(new File("."), -1, 16);
throw new RuntimeException("Negative size icon should throw invalid argument exception");
} catch (IllegalArgumentException iae) {
// Expected
}

icon = (ImageIcon) fsv.getSystemIcon(new File("thereisdefinitelynosuchfile.why"),
icon = fsv.getSystemIcon(new File("thereisdefinitelynosuchfile.why"),
16, 16);
if (icon != null) {
throw new RuntimeException("Icons for files with invalid names should be null");