Skip to content

Fix native conversion for empty CFStringRef.#1275

Merged
dbwiddis merged 1 commit into
java-native-access:masterfrom
dyorgio:master
Nov 26, 2020
Merged

Fix native conversion for empty CFStringRef.#1275
dbwiddis merged 1 commit into
java-native-access:masterfrom
dyorgio:master

Conversation

@dyorgio

@dyorgio dyorgio commented Nov 24, 2020

Copy link
Copy Markdown
Contributor

If you try to convert a CFStringRef with empty string (char[0]) an Exception is throws in com.sun.jna.Memory(long) constructor:
java.lang.IllegalArgumentException: Allocation size must be greater than zero

Issue: #1274

@dbwiddis dbwiddis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the fix and the updated test case. One typo in the changelog, and can you squash the commits please?

Comment thread CHANGES.md Outdated
Comment thread contrib/platform/src/com/sun/jna/platform/mac/CoreFoundation.java
@dbwiddis dbwiddis linked an issue Nov 24, 2020 that may be closed by this pull request
Comment thread contrib/platform/src/com/sun/jna/platform/mac/CoreFoundation.java Outdated
Comment thread contrib/platform/src/com/sun/jna/platform/mac/CoreFoundation.java
@dbwiddis

Copy link
Copy Markdown
Contributor

Looks great to me. I'll merge after CI tests pass.

@dyorgio

dyorgio commented Nov 25, 2020

Copy link
Copy Markdown
Contributor Author

Tks @dbwiddis , looking forward to contribute with some macOs binds when I consider it more stable.

If you try to convert a CFStringRef with empty string (char[0]) an Exception is throws in con.sun.jna.Memory(long) constructor:
java.lang.IllegalArgumentException: Allocation size must be greater than zero
@dbwiddis
dbwiddis merged commit 3241510 into java-native-access:master Nov 26, 2020
tresf pushed a commit to tresf/jna that referenced this pull request Dec 1, 2020
If you try to convert a CFStringRef with empty string (char[0]) an Exception is throws in con.sun.jna.Memory(long) constructor:
java.lang.IllegalArgumentException: Allocation size must be greater than zero
dbwiddis pushed a commit to dbwiddis/jna that referenced this pull request Jan 29, 2021
If you try to convert a CFStringRef with empty string (char[0]) an Exception is throws in con.sun.jna.Memory(long) constructor:
java.lang.IllegalArgumentException: Allocation size must be greater than zero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty CFStringRefthrows Exception if stringValue is called (macOS)

3 participants