Skip to content

Android crash when Entry has >5000 characters #30144

@Nathan-Coit-FP

Description

@Nathan-Coit-FP

Description

If an Entry has text greater than 5000 characters, the Entry Handler will error when running the IsPassword mapper and crash.
The IsPassword mapper is run before the MaxLength mapper and is setting the input type on the AppCompatEditText which causes android to set a default max length of 5000 for single line inputs.
https://developer.android.com/reference/android/widget/TextView#setSingleLine(boolean)

Steps to Reproduce

  1. Open sample project app

Expected outcome: Page loads entry with >5000 characters of text
Actual outcome: App crash

Link to public reproduction project repository

https://github.com/Nathan-Coit-FP/AndroidEntryMaxLengthBug

Version with bug

9.0.50 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12 and up

Did you find any workaround?

Modify the IsPassword mapper to run the MaxLength mapping first when text is >5000 characters

EntryHandler.Mapper.ModifyMapping(nameof(IEntry.IsPassword), (handler, view, action) =>
{
      if (view?.Text?.Length > 5000)
      {
          handler.UpdateValue(nameof(IEntry.MaxLength));
      }
      action(handler, view);
});

Relevant log output

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions