Bug 570650 - [HyperlinkManager] handle empty array as null
Summary: [HyperlinkManager] handle empty array as null
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.14   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-26 00:03 EST by Christoph Laeubrich CLA
Modified: 2021-01-26 00:03 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2021-01-26 00:03:57 EST
HyperlinkManager currently enforces that no hyperlinks -> IHyperlinkDetector.detectHyperlinks return null

but this enforcement seems of no value and complicates client code.

The code

> if (hyperlinks == null)
>	continue;
> Assert.isLegal(hyperlinks.length > 0);

can simply be rewritten to 

> if (hyperlinks == null || hyperlinks.length == 0)
>	continue;

This would allow to simply return an array e.g. from a stream operation and is semantically equivalent.