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 13, 2018
1 parent bb408ff commit bf680a5
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).
* [#822](https://github.com/java-native-access/jna/issues/822): `Native#loadLibrary` requires that the interface class passed in is an instance of Library. The runtime check can be enhanced by using a constraint generic. This breaks binary compatibility (see notes below) - [@d-noll](https://github.com/d-noll).
* [#889](https://github.com/java-native-access/jna/issues/889): The `Structure#newInstance` receive the target type as a parameter. This adds a limited generic type, so that the return type ist the target type and not a generic structure, removing the necessity to do an explizit cast - [@matthiasblaesing](https://github.com/matthiasblaesing).

Expand Down Expand Up @@ -69,6 +70,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 bf680a5

Please sign in to comment.