[MAGNOLIA-6583] Appendablewriter is designed with wrong signature Created: 06/Mar/16  Updated: 13/Jan/17

Status: Accepted
Project: Magnolia
Component/s: rendering
Affects Version/s: 5.4.4
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Thomas Kratz Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: devwl
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Story Points: 5

 Description   

Writer is designed as

abstract public void write(char cbuf[], int off, int len) throws IOException;

but AppendableWriter overrides it as

@Override
public void write(char[] chars, int start, int end) throws IOException {
        appendable.append(new String(chars), start, end);
}

I found this when trying wo integrate with thymeleaf3. For now I can workaround by wrapping the AppendableWriter, but it gave me a headache and is simple wrong API, so I wanted to let you know.



 Comments   
Comment by Jan Haderka [ 06/Mar/16 ]

That truly sucks. Most likely coming from the fact that it was originally overriding append() instead of write().

There's no way to fix it and keep it backward compatible to prevent breakage of implementations that already went through the pain of working around the mistake at the same time.

The only way is to write new class with correct params and deprecate current one.

Generated at Mon Feb 12 04:15:53 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.