Skip to content

Comments

Fix multi-value attribute encoding for non-ASCII characters#96

Merged
TharmiganK merged 8 commits intomasterfrom
fix-bug-8562
Jan 28, 2026
Merged

Fix multi-value attribute encoding for non-ASCII characters#96
TharmiganK merged 8 commits intomasterfrom
fix-bug-8562

Conversation

@TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented Jan 19, 2026

Description

When an LDAP attribute has multiple values containing non-ASCII characters, only the first value was returned. The processAttribute method was using attribute.getValueByteArray() (singular) which only returns the first value's byte array, ignoring subsequent values.

Fixes ballerina-platform/ballerina-library#8562

One line release note:

  • Fixed multi-value LDAP attributes with non-ASCII characters returning only the first encoded value

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Added testMultiValueAttributeWithNonAscii test that creates an entry with multi-value description attribute containing Japanese, Greek, and Chinese characters, then verifies all 3 values are returned

Test Configuration:

  • Ballerina Version: SwanLake Update 12
  • Operating System: Linux
  • Java SDK: 21

Checklist:

  • Added tests
  • Updated changelog

Security checks

@CLAassistant
Copy link

CLAassistant commented Jan 19, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.66%. Comparing base (e913a69) to head (24d1903).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
ballerina/client.bal 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master      #96   +/-   ##
=======================================
  Coverage   96.66%   96.66%           
=======================================
  Files           2        2           
  Lines          30       30           
  Branches       10       10           
=======================================
  Hits           29       29           
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where multi-value LDAP attributes containing non-ASCII characters only returned the first value. The root cause was the processAttribute method using attribute.getValueByteArray() (singular) which only returns the first value's byte array, when it should have been using getValueByteArrays() (plural) to get all values.

Changes:

  • Refactored processAttribute method to use getValueByteArrays() and handle multiple encoded values correctly
  • Added new encodeAttributeValues helper method for batch encoding
  • Updated encodeAttributeValue signature to accept attribute name and byte array separately
  • Added test case with Japanese, Greek, and Chinese characters in multi-value description field
  • Version bumped to 1.3.1

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
native/src/main/java/io/ballerina/lib/ldap/Client.java Fixed processAttribute to handle multi-value attributes with base64 encoding; added encodeAttributeValues helper method; refactored encodeAttributeValue signature
ballerina/tests/test.bal Added testMultiValueAttributeWithNonAscii test case to verify the fix
changelog.md Documented the bug fix in unreleased section
ballerina/Dependencies.toml Updated version to 1.3.1 and crypto dependency to 2.9.3 (auto-generated)
ballerina/Ballerina.toml Updated package version to 1.3.1 and native library to 1.3.1-SNAPSHOT

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

TharmiganK and others added 2 commits January 20, 2026 20:42
Co-authored-by: Nuvindu Nirmana <63797478+Nuvindu@users.noreply.github.com>
@TharmiganK TharmiganK merged commit d1423de into master Jan 28, 2026
4 of 5 checks passed
@TharmiganK TharmiganK deleted the fix-bug-8562 branch January 28, 2026 07:33
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.

LDAP client does not return the list values when one value has non-ASCII character

3 participants