File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
src/main/java/org/nibor/autolink Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,21 @@ public class Autolink {
9
9
* Render the supplied links from the supplied input text using a renderer. The parts of the text outside of links
10
10
* are added to the result without processing.
11
11
*
12
- * @param input the input text
12
+ * @param input the input text, must not be null
13
13
* @param links the links to render, see {@link LinkExtractor} to extract them
14
14
* @param linkRenderer the link rendering implementation
15
15
* @return the rendered string
16
16
*/
17
17
public static String renderLinks (CharSequence input , Iterable <LinkSpan > links , LinkRenderer linkRenderer ) {
18
+ if (input == null ) {
19
+ throw new NullPointerException ("input must not be null" );
20
+ }
21
+ if (links == null ) {
22
+ throw new NullPointerException ("links must not be null" );
23
+ }
24
+ if (linkRenderer == null ) {
25
+ throw new NullPointerException ("linkRenderer must not be null" );
26
+ }
18
27
StringBuilder sb = new StringBuilder (input .length () + 16 );
19
28
int lastIndex = 0 ;
20
29
for (LinkSpan link : links ) {
Original file line number Diff line number Diff line change @@ -31,10 +31,13 @@ public static Builder builder() {
31
31
/**
32
32
* Extract the links from the input text. Can be called multiple times with different inputs (thread-safe).
33
33
*
34
- * @param input the input text, must not be {@code null}
35
- * @return a lazy iterable for the links in order that they appear in the input, never {@code null}
34
+ * @param input the input text, must not be null
35
+ * @return a lazy iterable for the links in order that they appear in the input, never null
36
36
*/
37
37
public Iterable <LinkSpan > extractLinks (final CharSequence input ) {
38
+ if (input == null ) {
39
+ throw new NullPointerException ("input must not be null" );
40
+ }
38
41
return new Iterable <LinkSpan >() {
39
42
@ Override
40
43
public Iterator <LinkSpan > iterator () {
You can’t perform that action at this time.
0 commit comments