Skip to content

Do not throw Win32Exception on success for empty section in Kernel32Util#getPrivateProfileSection#1411

Merged
dbwiddis merged 2 commits intojava-native-access:masterfrom
mkarg:fix-1410
Feb 23, 2022
Merged

Do not throw Win32Exception on success for empty section in Kernel32Util#getPrivateProfileSection#1411
dbwiddis merged 2 commits intojava-native-access:masterfrom
mkarg:fix-1410

Conversation

@mkarg
Copy link
Copy Markdown
Contributor

@mkarg mkarg commented Jan 26, 2022

Fixes #1410

Apparently what the caller in such a situation expects is to get the content of the existing section, i. e. an empty String array.

Using a constant object to reduce heap pollution.

@mkarg mkarg marked this pull request as ready for review January 26, 2022 09:58
@matthiasblaesing
Copy link
Copy Markdown
Member

Change looks sane to me. Thank you. I would not have pulled out the empty array creation as filling the heap is kind of helpful for JNA (memory freeing is tied to GC), but I see the idea. Would you please

  • use the title of the issue as the commit message
  • add a entry to the CHANGES.md file

Thank you.

btw: there is no need to open issues, if you want to directly fix them. A PR is enough :-)

@dbwiddis dbwiddis changed the title Fixes #1410 Do not throw Win32Exception on success for empty section in Kernel32Util#getPrivateProfileSection Feb 23, 2022
in Kernel32Util#getPrivateProfileSection
@dbwiddis dbwiddis merged commit 69bf22f into java-native-access:master Feb 23, 2022
@mkarg mkarg deleted the fix-1410 branch February 24, 2022 15:30
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.

Kernel32Util.getPrivateProfileSection() throws Win32Exception for empty sections

3 participants