@@ -73,30 +73,39 @@ static void negativeTests() {
7373static void testSystemIcon (File file ,boolean implComplete ) {
7474int []sizes =new int [] {16 ,32 ,48 ,64 ,128 };
7575for (int size :sizes ) {
76- ImageIcon icon = ( ImageIcon ) fsv .getSystemIcon (file ,size ,size );
76+ Icon i = fsv .getSystemIcon (file ,size ,size );
7777
78+ if (i ==null ) {
79+ throw new RuntimeException (file .getAbsolutePath () +" icon is null" );
80+ }
81+
82+ if (!(i instanceof ImageIcon )) {
83+ // Default UI resource icon returned - it is not covered
84+ // by new implementation so we can not test it
85+ continue ;
86+ }
87+
88+ ImageIcon icon = (ImageIcon )i ;
7889//Enable below to see the icon
7990//JLabel label = new JLabel(icon);
8091//JOptionPane.showMessageDialog(null, label);
8192
82- if (icon ==null ) {
83- throw new RuntimeException ("icon is null!!!" );
84- }
85-
8693if (implComplete &&icon .getIconWidth () !=size ) {
8794throw new RuntimeException ("Wrong icon size " +
88- icon .getIconWidth () +" when requested " +size );
95+ icon .getIconWidth () +" when requested " +size +
96+ " for file " +file .getAbsolutePath ());
8997 }
9098
9199if (icon .getImage ()instanceof MultiResolutionImage ) {
92100MultiResolutionImage mri = (MultiResolutionImage )icon .getImage ();
93101if (mri .getResolutionVariant (size ,size ) ==null ) {
94102throw new RuntimeException ("There is no suitable variant for the size "
95- +size +" in the multi resolution icon" );
103+ +size +" in the multi resolution icon " + file . getAbsolutePath () );
96104 }
97105 }else {
98106if (implComplete ) {
99- throw new RuntimeException ("icon is supposed to be multi-resolution but it is not" );
107+ throw new RuntimeException ("icon is supposed to be" +
108+ " multi-resolution but it is not for " +file .getAbsolutePath ());
100109 }
101110 }
102111 }