开发者

How to prevent ShellFolder.getFolderColumns(...) from crashing a lot

I'm using the secret hidden ShellFolder class in Java. It has a nice method called getFolderColumns which gives you access to some nice data about the file.

Problem is that a lot of files crash it with :

Exception in thread "pool-1-thread-2445" java.lang.InternalError: Unable to bind C:\Windows\System32\zonedon.reg to parent at sun.awt.shell.Win32ShellFolder2$4.call(Win32ShellFolder2.java:400) at sun.awt.shell.Win32ShellFolder2$4.call(Win32ShellFolder2.java:385) at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Win32ShellFolderManager2.java:523) at sun.awt.shell.ShellFolder.invoke(ShellFolder.java:399) at sun.awt.shell.ShellFolder.invoke(ShellFolder.java:385) at sun.awt.shell.Win32ShellFolder2.getIShellFolder(Win32ShellFolder2.java:384) at sun.awt.shell.Win32ShellFolder2$17.call(Win32ShellFolder2.java:1068) at sun.awt.shell.Win32ShellFolder2$17.call(Win32ShellFolder2.开发者_如何学编程java:1066) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Win32ShellFolderManager2.java:492) at java.lang.Thread.run(Thread.java:619)

You also can't catch this and resume as it throws a UncaughtException. I noticed that JFileChooser also uses this method but I can't seem to find its prevention/protection from these type of crashes.


getFolderColumns method only works for folders. So cache the column info(so you know the column position) and you can still get the column data needed from files. I haven't seen a case where the columns on folders are different from files.

Oh just to note that that this method is only good on windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜