Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMBindingBaseObject should use COMUtils#checkRC() #646

Closed
matthiasblaesing opened this issue Apr 25, 2016 · 0 comments
Closed

COMBindingBaseObject should use COMUtils#checkRC() #646

matthiasblaesing opened this issue Apr 25, 2016 · 0 comments
Labels

Comments

@matthiasblaesing
Copy link
Member

@SevenOf9Sleeper rightly noticed, that the error message generated by subclasses of COMBindingBaseObject generate misleading messages - one offending place:

        // This is line 128
        } else {
            hr = Ole32.INSTANCE.CoCreateInstance(clsid, null, dwClsContext,
                    IDispatch.IID_IDISPATCH, this.pDispatch);
        }

        if (COMUtils.FAILED(hr)) {
            throw new COMException("COM object with ProgID '" + progId
                    + "' and CLSID " + clsid.toGuidString()
                    + " not registered properly!");
        }

In the sample ComUtils#checkRC would have yielded:

com.sun.jna.platform.win32.COM.COMException: CoInitialize wurde nicht aufgerufen.(HRESULT: 800401f0) (puArgErr=)

English translation: "CoInitialize was not called" which would have pointed to the real problem instead of implying a registry problem.

matthiasblaesing added a commit to matthiasblaesing/jna that referenced this issue May 4, 2016
The exception thrown from COMBindingBaseObject when instatiation fails
is misleading:

COM object with CLSID {0002DF01-0000-0000-C000-000000000046} not registered properly!

In the concrete case COM was not properly initialized, the same error now
reports (in german locale):

CoInitialize wurde nicht aufgerufen.(HRESULT: 800401f0) (puArgErr=)

For english locale this should be along the lines of:

CoInitialize was not called.(HRESULT: 800401f0) (puArgErr=)

The message now points out the correct problem (as far as the windows
error code translation works) and the HRESULT can be used for a locale
independend report + search.

Closes java-native-access#646
matthiasblaesing added a commit to matthiasblaesing/jna that referenced this issue May 4, 2016
The exception thrown from COMBindingBaseObject when instatiation fails
is misleading:

COM object with CLSID {0002DF01-0000-0000-C000-000000000046} not registered properly!

In the concrete case COM was not properly initialized, the same error now
reports (in german locale):

CoInitialize wurde nicht aufgerufen.(HRESULT: 800401f0) (puArgErr=)

For english locale this should be along the lines of:

CoInitialize was not called.(HRESULT: 800401f0) (puArgErr=)

The message now points out the correct problem (as far as the windows
error code translation works) and the HRESULT can be used for a locale
independend report + search.

Closes java-native-access#646
mstyura pushed a commit to mstyura/jna that referenced this issue Sep 9, 2024
Motivation:

At the moment the android jobs fail as it seems like ANDROID_HOME is not
provided anymore. Until we have time to look into it let's just not run
the jobs.

Modifications:

Add expression to disable android jobs for now

Result:

CI checks pass again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant