InternalLinkType accepts links that does not start with /content
Using ResourceLink ends up in NPE when the content reference does not starts with /content
Although this can be prevented using validation in edit dialog, it is still strange that InternalLinkType accepts such links:
InternalLinkType must only accept links that start with /content
the accepts(String) method is only used for "guessing" the link type when no link type information is present - if it is present it should be possible to link to anywhere, not necessarily only to /content. at least this is the current assumption.
i still cannot reproduce your problem - if i pass in an invalid link references like "crap" in the unit test the link is marked as invalid - but no NPE is thrown.
well, the accepts(String) method has such a limitation and it would be consistent if the accepts(LinkRequst) method also implements the same behaviour.
You can reproduce the error with a linkContentRef without the leading slash, e.g. linkContentRef="scrap"
there is no hard-coded limitation that only links with /content area allowed, although it would be quite unusual to have links other than to /content/*.
i tried to create a unittest to reproduce the problem, but was not able to come up with one that throws this NPE - it seems the path is null, but this should not be the case.
i create the unittest in this branch: