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
Changes from 2 commits
19a0efe
6607b61
4a36062
5b2c941
237d407
a481b29
10bae9b
4cd5a50
911bc70
5922469
09c7f8d
548dcef
5628578
d679dc0
b3ca9da
4835302
9e7bf90
0652197
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
* @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"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (minor) spacing. <1 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()) { | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -28,6 +28,7 @@ | ||
* sun.awt.shell.ShellFolder | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the comment here mean ? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"); | ||
There was a problem hiding this comment.
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"