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 8, 2018
1 parent 12b8ec3 commit 12ea4f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 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
--------
* [#903](https://github.com/java-native-access/jna/pull/903): 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 @@ -102,11 +103,10 @@ public void testMSWord() throws IOException {
msWord.insertText("Hello some changes from JNA!\n");
// save the document and prompt the user
msWord.Save(false, wdPromptUser);
} catch (COMInvokeException e) {
System.out.println("bstrSource: " + e.getSource());
System.out.println("bstrDescription: " + e.getDescription());
} catch (COMException e) {
if (e.getExcepInfo() != null) {
System.out.println("bstrSource: " + e.getExcepInfo().bstrSource);
System.out.println("bstrDescription: " + e.getExcepInfo().bstrDescription);
}
} finally {
if (msWord != null) {
msWord.quit();
Expand Down

0 comments on commit 12ea4f5

Please sign in to comment.