Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
14.7.0
-
None
-
Quasar
-
Team Quasar sprint 284
Description
Since a change in 14.7.0, CMS-14514, org.hippoecm.hst.util.HstRequestUtils#getCmsBaseURL produces a NullPointerException in case javax.servlet.http.HttpServletRequest#getPathInfo returns null (which is allowed)
public static String getCmsBaseURL(final HttpServletRequest cmsHostServletRequest) { ..snip.. final ResolvedMount resolvedMount = resolvedCmsHost.matchMount(cmsHostServletRequest.getPathInfo());
and ResolvedVirtualHostImpl#matchMount cannot handle null argument:
public ResolvedMount matchMount(final String requestPath) throws MatchException { if(portMount.getRootMount() == null) { log.error("Virtual Host '{}' for portnumber '{}' is not (correctly) mounted: We cannot return a ResolvedMount. Return null", virtualHost.getHostName(), String.valueOf(portMount.getPortNumber())); return null; } // strip leading and trailing slashes String path = PathUtils.normalizePath(requestPath); String matchingIgnoredPrefix = null; // check whether the requestPath starts with the cmsPreviewPrefix path: If so, first strip this prefix off and append it later to the resolvedMountPath if(!StringUtils.isEmpty(virtualHost.getVirtualHosts().getCmsPreviewPrefix())) { if (path.equals(virtualHost.getVirtualHosts().getCmsPreviewPrefix())) { // path is null!