< prev index next >

## src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java

Print this page

     494         } else if (special2 && !special1) {
     495             return  1;
     496         }
     497
     498         return compareNames(sf1.getAbsolutePath(), sf2.getAbsolutePath());
     499     }
     500
     501     static int compareNames(String name1, String name2) {
     502         // First ignore case when comparing
     503         int diff = name1.compareToIgnoreCase(name2);
     504         if (diff != 0) {
     505             return diff;
     506         } else {
     507             // May differ in case (e.g. "mail" vs. "Mail")
     508             // We need this test for consistent sorting
     509             return name1.compareTo(name2);
     510         }
     511     }
     512
     513     @Override

     514     protected Invoker createInvoker() {
     515         return new ComInvoker();
     516     }
     517
     518     private static class ComInvoker extends ThreadPoolExecutor implements ThreadFactory, ShellFolder.Invoker {
     519         private static Thread comThread;
     520
     521         private ComInvoker() {
     522             super(1, 1, 0, TimeUnit.DAYS, new LinkedBlockingQueue<>());
     523             allowCoreThreadTimeOut(false);
     524             setThreadFactory(this);
     525             final Runnable shutdownHook = () -> AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
     526                 shutdownNow();
     527                 return null;
     528             });
     529             AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
     530                 Thread t = new Thread(
     531                         ThreadGroupUtils.getRootThreadGroup(), shutdownHook,
     532                         "ShellFolder", 0, false);
     533                 Runtime.getRuntime().addShutdownHook(t);
     494         } else if (special2 && !special1) {
     495             return  1;
     496         }
     497
     498         return compareNames(sf1.getAbsolutePath(), sf2.getAbsolutePath());
     499     }
     500
     501     static int compareNames(String name1, String name2) {
     502         // First ignore case when comparing
     503         int diff = name1.compareToIgnoreCase(name2);
     504         if (diff != 0) {
     505             return diff;
     506         } else {
     507             // May differ in case (e.g. "mail" vs. "Mail")
     508             // We need this test for consistent sorting
     509             return name1.compareTo(name2);
     510         }
     511     }
     512
     513     @Override
     514     String getPath(File dir) {
     515         //Windows doesnot support paths with leading and lagging spaces
     516         return dir.getPath().trim();
     517     }
     518
     519     @Override
     520     protected Invoker createInvoker() {
     521         return new ComInvoker();
     522     }
     523
     524     private static class ComInvoker extends ThreadPoolExecutor implements ThreadFactory, ShellFolder.Invoker {
     525         private static Thread comThread;
     526
     527         private ComInvoker() {
     528             super(1, 1, 0, TimeUnit.DAYS, new LinkedBlockingQueue<>());
     529             allowCoreThreadTimeOut(false);
     530             setThreadFactory(this);
     531             final Runnable shutdownHook = () -> AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
     532                 shutdownNow();
     533                 return null;
     534             });
     535             AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
     536                 Thread t = new Thread(
     537                         ThreadGroupUtils.getRootThreadGroup(), shutdownHook,
     538                         "ShellFolder", 0, false);
     539                 Runtime.getRuntime().addShutdownHook(t);

< prev index next >