--- old/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java 2015-05-28 09:13:10.695861500 +0300 +++ new/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java 2015-05-28 09:13:10.183759100 +0300 @@ -956,7 +956,7 @@ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details private static native long extractIcon(long parentIShellFolder, long relativePIDL, - boolean getLargeIcon); + boolean getLargeIcon, boolean getDefaultIcon); // Returns an icon from the Windows system icon list in the form of an HICON private static native long getSystemIcon(int iconID); @@ -1007,7 +1007,14 @@ invoke(new Callable() { public Image call() { Image newIcon = null; - if (isFileSystem()) { + if (isLink()) { + ShellFolder folder = getLinkLocation(); + if (folder != null && "Library".equals( + folder.getFolderType())) { + return folder.getIcon(getLargeIcon); + } + } + if (isFileSystem() || "Library".equals(getFolderType())) { long parentIShellIcon = (parent != null) ? ((Win32ShellFolder2) parent).getIShellIcon() : 0L; @@ -1037,7 +1044,19 @@ if (newIcon == null) { // These are only cached per object long hIcon = extractIcon(getParentIShellFolder(), - getRelativePIDL(), getLargeIcon); + getRelativePIDL(), getLargeIcon, false); + // E_PENDING: loading can take time so get the default + if(hIcon <= 0) { + hIcon = extractIcon(getParentIShellFolder(), + getRelativePIDL(), getLargeIcon, true); + if(hIcon <= 0) { + if (isDirectory()) { + return getShell32Icon(4, getLargeIcon); + } else { + return getShell32Icon(1, getLargeIcon); + } + } + } newIcon = makeIcon(hIcon, getLargeIcon); disposeIcon(hIcon); }