#vulnerable code 
                             public static UriComponentsBuilder getBuilder() {

		if (RequestContextHolder.getRequestAttributes() == null) {
			return UriComponentsBuilder.fromPath("/");
		}

		HttpServletRequest request = getCurrentRequest();
		UriComponentsBuilder builder = ServletUriComponentsBuilder.fromServletMapping(request);

		// special case handling for X-Forwarded-Ssl:
		// apply it, but only if X-Forwarded-Proto is unset.

		String forwardedSsl = request.getHeader("X-Forwarded-Ssl");
		ForwardedHeader forwarded = ForwardedHeader.of(request.getHeader(ForwardedHeader.NAME));
		String proto = hasText(forwarded.getProto()) ? forwarded.getProto() : request.getHeader("X-Forwarded-Proto");

		if (!hasText(proto) && hasText(forwardedSsl) && forwardedSsl.equalsIgnoreCase("on")) {
			builder.scheme("https");
		}

		return builder;
	} 
                            #location 13 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             public static UriComponentsBuilder getBuilder() {

		if (RequestContextHolder.getRequestAttributes() == null) {
			return UriComponentsBuilder.fromPath("/");
		}

		HttpServletRequest request = getCurrentRequest();
		ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromServletMapping(request);

		// Spring 5.1 can handle X-Forwarded-Ssl headers...
		if (isSpringAtLeast5_1()) {
			return builder;
		} else {
			return handleXForwardedSslHeader(request, builder);
		}
	}