我有一个Java Swing应用程序与第三方共享库(DLL)连接。应用程序间歇性崩溃,当我检查故障转储时,我发现尝试访问本机代码时发生了崩溃。请参阅下面的转储片段:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd32321fdc, pid=7692, tid=8816
Stack: [0x0000000014b00000,0x0000000014c00000], sp=0x0000000014bff2f0, free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [ftrScanAPI.dll+0x61fdc]
j my.pkg.finger.futronic.FutronicScanner.close()Z+4
j my.pkg.finger.ks.captureImage(Ljavax/swing/JLabel;Lcom/sf/sfxfinger/sfs;)Ljava/awt/image/BufferedImage;+25
j my.pkg.sfxfinger.sfs.captureFingerImage(Ljavax/swing/JLabel;Lcom/sf/sfxfinger/sfs;)Ljava/awt/image/BufferedImage;+6
j my.pkg.sc.laf.panels.FingerprintCaptureDialog$5.doInBackground()Ljava/lang/Object;+370
j javax.swing.SwingWorker$1.call()Ljava/lang/Object;+14
j java.util.concurrent.FutureTask.run()V+42
j javax.swing.SwingWorker.run()V+4
j java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+95
j java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
V [jvm.dll+0x1cf7f3]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.Futronic.ScanApiHelper.Scanner.CloseDevice()Z+0
j my.pkg.finger.futronic.FutronicScanner.close()Z+4
j my.pkg.finger.ks.captureImage(Ljavax/swing/JLabel;Lcom/sf/sfxfinger/sfs;)Ljava/awt/image/BufferedImage;+25
j my.pkg.sfxfinger.sfs.captureFingerImage(Ljavax/swing/JLabel;Lcom/sf/sfxfinger/sfs;)Ljava/awt/image/BufferedImage;+6
j my.pkg.sc.laf.panels.FingerprintCaptureDialog$5.doInBackground()Ljava/lang/Object;+370
j javax.swing.SwingWorker$1.call()Ljava/lang/Object;+14
j java.util.concurrent.FutureTask.run()V+42
j javax.swing.SwingWorker.run()V+4
j java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+95
j java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
是否可以捕获Java代码中本机代码抛出的异常?
注意: 该库是我无法访问的第三方库。此外,崩溃行为非常不稳定。如果它与使用有关,我的猜测是每次我尝试使用该设备时都会发生。