[Libreoffice-bugs] [Bug 121171] New: Add @NonNull annotation to out parameters in java interfaces generated by javamaker

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Nov 5 09:59:56 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=121171

            Bug ID: 121171
           Summary: Add @NonNull annotation to out parameters in java
                    interfaces generated by javamaker
           Product: LibreOffice
           Version: 6.1.0.3 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: sdk
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: straub at sb-software.de

Java interfaces generated by javamaker doesn't seem to use the @NonNull
annotation for out parameters.
When calling such a method with a null argument where an out parameter is
expected, the java uno bridge will terminate with an exception triggered by the
following code in urp.java (because args[i] == null).

         if (argTypes != null) {
             for (int i = 0; i < argTypes.length; ++i) {
                 if (argTypes[i] != null) {
                     Array.set(
                         args[i], 0,
                         unmarshal.readValue(
                             argTypes[i].getComponentType()));

When adding @NonNull to such out arguments, java would prevent the caller to
accidentally pass null.

To make this method more safe, I'd suggest to also add a try/catch around the
Array.set(...) call, which would return an exception to the caller.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20181105/68ad04f9/attachment.html>


More information about the Libreoffice-bugs mailing list