Skip to content

Commit

Permalink
Add COMException changes to CHANGES.md and adjust msoffice demo to fo…
Browse files Browse the repository at this point in the history
…llow the changes
  • Loading branch information
matthiasblaesing committed Jan 7, 2018
1 parent 0c49cbf commit 6731831
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Release 5.0.0 (Next release)

Features
--------
* [#???](https://github.com/java-native-access/jna/pull/???): Carry `HRESULT` in `c.s.j.p.win32.COM.COMException`, introduce `c.s.j.p.win32.COM.COMInvokeException` as subclass of `COMException` for exception as the result of a `IDispatch#Invoke`. The `EXECPINFO` is unwrapped into fields in the `COMInvokeException` and correctly freed. - [@matthiasblaesing](https://github.com/matthiasblaesing).

Bug Fixes
---------
Expand Down Expand Up @@ -67,6 +68,9 @@ Breaking Changes
* `com.sun.jna.platform.win32.Kernel32Util.formatMessageFromHR(HRESULT)`
was replaced by
`com.sun.jna.platform.win32.Kernel32Util.formatMessage(HRESULT)`
* `com.sun.jna.platform.win32.COM.COMException` was structurally modified. The
`pExcepInfo` and `puArgErr` members were removed and `hresult` member was added.
The now missing information in `COMException` was moved to `COMInvokeException`.

Release 4.5.0
=============
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.sun.jna.Pointer;

import com.sun.jna.platform.win32.COM.COMException;
import com.sun.jna.platform.win32.COM.COMInvokeException;
import com.sun.jna.platform.win32.COM.Helper;
import com.sun.jna.platform.win32.Ole32;
import com.sun.jna.platform.win32.WinDef.LONG;
Expand Down Expand Up @@ -103,9 +104,10 @@ public void testMSWord() throws IOException {
// save the document and prompt the user
msWord.Save(false, wdPromptUser);
} catch (COMException e) {
if (e.getExcepInfo() != null) {
System.out.println("bstrSource: " + e.getExcepInfo().bstrSource);
System.out.println("bstrDescription: " + e.getExcepInfo().bstrDescription);
if (e instanceof COMInvokeException) {
COMInvokeException cie = (COMInvokeException) e;
System.out.println("bstrSource: " + cie.getSource());
System.out.println("bstrDescription: " + cie.getDescription());
}
} finally {
if (msWord != null) {
Expand Down

0 comments on commit 6731831

Please sign in to comment.