-
Notifications
You must be signed in to change notification settings - Fork 629
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
Wrong JNI type in getField: Not Long but Java Object #1482
Comments
+1 |
Could you send a pull request to fix it? |
I tried to fix it, but apparently there are more bugs related to that issue. |
@vonox7, would the following work?
|
Unfortunately, "Ljava/lang/Object;" won't work, as we get an NoSuchFieldError, see stacktrace: https://gist.github.com/vonox7/90f9bdd4c422f4925f99ba1933f7145e By using the followig hack we get the correct field (connectionLogger/operationQueueListener), but then there seems to be some threading issues, have a look at the stacktrace: https://gist.github.com/vonox7/5868369b8ce76f254e1c72c6a3edf3bb
|
Could you create a specific method for connectionLogger and send a pull request? |
As said above, even with the specific object call it will crash because of threading issues. Can you have a look into that threading issue? https://gist.github.com/vonox7/5868369b8ce76f254e1c72c6a3edf3bb |
Ah ok. We probably need to fix |
Any news about this issue? |
Same boat here. Having issues with Office365 SMTP and would love to be able to see the actual responses so I can pinpoint the issue better |
I'd also really benefit from this. I'm trying to debug why creating a "manual" IMAP connection works, but mailcore doesn't |
When setting a ConnectionLogger or OperationQueueListener to SMTPSession the setupNative function fails with the following error:
JNI GetObjectField called with pending exception java.lang.NoSuchFieldError: no "J" field "connectionLogger" in class "Lcom/libmailcore/SMTPSession;" or its superclasses
The connectionLogger/operationQueueListener field in SMTPSession is not a Long ("J") but an Object ("L..."), therefore the JNI GetFieldID function fails.
In File JavaHandle.cpp the function getField fetches through JNI an object, but GetFieldID falsly assumes that the type to search is a Long instead of an Java Object:
The getField function is only called by getObjectField():
Expected code:
jclass c = env->GetFieldID(c, fieldName, "Lcom/libmailcore/ConnectionLogger;")
and
jclass c = env->GetFieldID(c, fieldName, "Lcom/libmailcore/OperationQueueListener;")
To solve this issue for all functions that use the getObjectField function, we would need an additional parameter that specifies the Java class we are looking for. (ConnectionLogger, OperationQueueListener...).
The text was updated successfully, but these errors were encountered: