/** * Invokes {@link #closeHandle(WinNT.HANDLE)} on each handle. If an exception * is thrown for a specific handle, then it is accumulated until all * handles have been closed. If more than one exception occurs, then it * is added as a suppressed exception to the first one. Once closed all * handles, the accumulated exception (if any) is thrown * * @param handles The handles to be closed * @see Throwable#getSuppressed() */ public static void closeHandles(HANDLE... handles) { Win32Exception err = null; for (HANDLE h : handles) { try { closeHandle(h); } catch(Win32Exception e) { if (err == null) { err = e; } else { err.addSuppressedReflected(e); } } } if (err != null) { throw err; } }
/** * Closes all referenced handles. If an exception is thrown for * a specific handle, then it is accumulated until all * handles have been closed. If more than one exception occurs, * then it is added as a suppressed exception to the first one. * Once closed all handles, the accumulated exception (if any) is thrown * * @param refs The references to close * @see #closeHandleRef(WinNT.HANDLEByReference) */ public static void closeHandleRefs(HANDLEByReference... refs) { Win32Exception err = null; for (HANDLEByReference r : refs) { try { closeHandleRef(r); } catch(Win32Exception e) { if (err == null) { err = e; } else { err.addSuppressedReflected(e); } } } if (err != null) { throw err; } } /**
err = e; } else { err.addSuppressedReflected(e);
Win32Exception we = new Win32Exception(Kernel32.INSTANCE.GetLastError()); if (err != null) { we.addSuppressedReflected(err);
we = e; } else { we.addSuppressedReflected(e);
err = e; } else { err.addSuppressedReflected(e); err = e; } else { err.addSuppressedReflected(e);
Win32Exception we = new Win32Exception(Kernel32.INSTANCE.GetLastError()); if (err != null) { we.addSuppressedReflected(err);
if (we != null) { Win32Exception e = new Win32Exception(Native.getLastError()); e.addSuppressedReflected(we); we = e;
Win32Exception ex = new Win32Exception(Native.getLastError()); if (we != null) { ex.addSuppressedReflected(we); Win32Exception ex = new Win32Exception(Native.getLastError()); if (we != null) { ex.addSuppressedReflected(we); Win32Exception ex = new Win32Exception(Native.getLastError()); if (we != null) { ex.addSuppressedReflected(we);
err = e; } else { err.addSuppressedReflected(e);
err = e; } else { err.addSuppressedReflected(e);
Win32Exception ex = new Win32Exception(Kernel32.INSTANCE.GetLastError()); if (we != null) { ex.addSuppressedReflected(we);