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 {
99 * Render the supplied links from the supplied input text using a renderer. The parts of the text outside of links
1010 * are added to the result without processing.
1111 *
12- * @param input the input text
12+ * @param input the input text, must not be null
1313 * @param links the links to render, see {@link LinkExtractor} to extract them
1414 * @param linkRenderer the link rendering implementation
1515 * @return the rendered string
1616 */
1717 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+ }
1827 StringBuilder sb = new StringBuilder (input .length () + 16 );
1928 int lastIndex = 0 ;
2029 for (LinkSpan link : links ) {
Original file line number Diff line number Diff line change @@ -31,10 +31,13 @@ public static Builder builder() {
3131 /**
3232 * Extract the links from the input text. Can be called multiple times with different inputs (thread-safe).
3333 *
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
3636 */
3737 public Iterable <LinkSpan > extractLinks (final CharSequence input ) {
38+ if (input == null ) {
39+ throw new NullPointerException ("input must not be null" );
40+ }
3841 return new Iterable <LinkSpan >() {
3942 @ Override
4043 public Iterator <LinkSpan > iterator () {
You can’t perform that action at this time.
0 commit comments