Buggy code:
public final class LinkExpression extends SimpleExpression { private static final Logger logger = LoggerFactory . getLogger ( LinkExpression . class ) ; private static final long serialVersionUID = - 564516592085017252L ; static final char SELECTOR = '@' ; private static final char PARAMS_START_CHAR = '(' ; private static final char PARAMS_END_CHAR = ')' ; private static final Pattern LINK_PATTERN = Pattern . compile ( "^\\s*\\@\\{(.+?)\\}\\s*$" , Pattern . DOTALL ) ; private static final String URL_PARAM_NO_VALUE = "%%%__NO_VALUE__%%%" ; private final Expression base ; private final AssignationSequence parameters ; public LinkExpression ( final Expression base , final AssignationSequence parameters ) { } public Expression getBase ( ) { } public AssignationSequence getParameters ( ) { } public boolean hasParameters ( ) { } @ Override public String getStringRepresentation ( ) { } static LinkExpression parseLink ( final String input ) { } private static Expression computeBase ( final String baseStr ) { } static Object executeLink ( final Configuration configuration , final IProcessingContext processingContext , final LinkExpression expression , final IStandardVariableExpressionEvaluator expressionEvaluator ) { if ( LinkExpression . logger . isTraceEnabled ( ) ) { LinkExpression . logger . trace ( "[THYMELEAF][{}]<seq2seq4repair_space>Evaluating<seq2seq4repair_space>link:<seq2seq4repair_space>\"{}\"" , TemplateEngine . threadIndex ( ) , expression . getStringRepresentation ( ) ) ; } final Expression baseExpression = expression . getBase ( ) ; Object base = Expression . execute ( configuration , processingContext , baseExpression , expressionEvaluator ) ; base = LiteralValue . unwrap ( base ) ; if ( ( ( base == null ) || ( ! ( base instanceof String ) ) ) || ( ( ( String ) ( base ) ) . trim ( ) . equals ( "" ) ) ) { <START_BUG> throw new TemplateProcessingException ( ( ( ( "Base<seq2seq4repair_space>for<seq2seq4repair_space>message<seq2seq4repair_space>resolution<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>non-null<seq2seq4repair_space>and<seq2seq4repair_space>non-empty<seq2seq4repair_space>String<seq2seq4repair_space>" + "(currently:<seq2seq4repair_space>" ) + ( base == null ? null : base . getClass ( ) . getName ( ) ) ) + ")" ) ) ; <END_BUG> } String linkBase = ( ( String ) ( base ) ) ; if ( ( ( ! ( LinkExpression . isWebContext ( processingContext . getContext ( ) ) ) ) && ( ! ( LinkExpression . isLinkBaseAbsolute ( linkBase ) ) ) ) && ( ! ( LinkExpression . isLinkBaseServerRelative ( linkBase ) ) ) ) { throw new TemplateProcessingException ( ( ( ( ( ( ( "Link<seq2seq4repair_space>base<seq2seq4repair_space>\"" + linkBase ) + "\"<seq2seq4repair_space>cannot<seq2seq4repair_space>be<seq2seq4repair_space>context<seq2seq4repair_space>relative<seq2seq4repair_space>(//)<seq2seq4repair_space>unless<seq2seq4repair_space>you<seq2seq4repair_space>implement<seq2seq4repair_space>the<seq2seq4repair_space>" ) + ( IWebContext . class . getName ( ) ) ) + "<seq2seq4repair_space>interface<seq2seq4repair_space>(context<seq2seq4repair_space>is<seq2seq4repair_space>of<seq2seq4repair_space>class:<seq2seq4repair_space>" ) + ( processingContext . getContext ( ) . getClass ( ) . getName ( ) ) ) + ")" ) ) ; } @ SuppressWarnings ( "unchecked" ) final Map < String , List < Object > > parameters = ( expression . hasParameters ( ) ) ? LinkExpression . resolveParameters ( configuration , processingContext , expression . getParameters ( ) , expressionEvaluator ) : ( ( Map < String , List < Object > > ) ( Collections . EMPTY_MAP ) ) ; final int hashPosition = linkBase . indexOf ( '#' ) ; String urlFragment = "" ; if ( hashPosition > 0 ) { urlFragment = linkBase . substring ( hashPosition ) ; linkBase = linkBase . substring ( 0 , hashPosition ) ; } final int questionMarkPosition = linkBase . indexOf ( "?" ) ; final StringBuffer parametersBuffer = new StringBuffer ( ) ; for ( final Map . Entry < String , List < Object > > parameterEntry : parameters . entrySet ( ) ) { final String parameterName = parameterEntry . getKey ( ) ; final List < Object > parameterValues = parameterEntry . getValue ( ) ; for ( final Object parameterObjectValue : parameterValues ) { if ( ( parametersBuffer . length ( ) ) == 0 ) { if ( questionMarkPosition == ( - 1 ) ) { parametersBuffer . append ( "?" ) ; } else { parametersBuffer . append ( "&" ) ; } } else { parametersBuffer . append ( "&" ) ; } final String parameterValue = ( parameterObjectValue == null ) ? "" : parameterObjectValue . toString ( ) ; if ( LinkExpression . URL_PARAM_NO_VALUE . equals ( parameterValue ) ) { parametersBuffer . append ( parameterName ) ; } else { try { parametersBuffer . append ( ( ( parameterName + "=" ) + ( URLEncoder . encode ( parameterValue , "UTF-8" ) ) ) ) ; } catch ( UnsupportedEncodingException e ) { throw new TemplateProcessingException ( "Exception<seq2seq4repair_space>while<seq2seq4repair_space>processing<seq2seq4repair_space>link<seq2seq4repair_space>parameters" , e ) ; } } } } if ( LinkExpression . isLinkBaseAbsolute ( linkBase ) ) { return ( linkBase + ( parametersBuffer . toString ( ) ) ) + urlFragment ; } else if ( ( ! ( LinkExpression . isWebContext ( processingContext . getContext ( ) ) ) ) && ( LinkExpression . isLinkBaseServerRelative ( linkBase ) ) ) { return ( ( linkBase . substring ( 1 ) ) + ( parametersBuffer . toString ( ) ) ) + urlFragment ; } final IWebContext webContext = ( ( IWebContext ) ( processingContext . getContext ( ) ) ) ; String sessionFragment = "" ; final HttpServletRequest request = webContext . getHttpServletRequest ( ) ; final HttpSession session = webContext . getHttpSession ( ) ; if ( null != session ) { final String sessionID = session . getId ( ) ; if ( ( ! ( request . isRequestedSessionIdFromCookie ( ) ) ) && ( ! ( LinkExpression . isUserAgentGoogleBot ( request ) ) ) ) { sessionFragment = ";jsessionid=" + sessionID ; } } if ( LinkExpression . isLinkBaseContextRelative ( linkBase ) ) { final String contextName = request . getContextPath ( ) ; if ( questionMarkPosition == ( - 1 ) ) { return ( ( ( contextName + linkBase ) + sessionFragment ) + ( parametersBuffer . toString ( ) ) ) + urlFragment ; } final String linkBasePart1 = linkBase . substring ( 0 , questionMarkPosition ) ; final String linkBasePart2 = linkBase . substring ( questionMarkPosition ) ;

Fix:
throw new TemplateProcessingException ( ( ( ( "Base<seq2seq4repair_space>for<seq2seq4repair_space>link<seq2seq4repair_space>URL<seq2seq4repair_space>creation<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>non-null<seq2seq4repair_space>and<seq2seq4repair_space>non-empty<seq2seq4repair_space>String<seq2seq4repair_space>" + "(currently:<seq2seq4repair_space>" ) + ( base == null ? null : base . getClass ( ) . getName ( ) ) ) + ")" ) ) ;