You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Furkan KILIC (Jira)" <ji...@apache.org> on 2019/12/20 14:45:01 UTC

[jira] [Closed] (TEXT-174) ScriptStringLookup does not accept ":"

     [ https://issues.apache.org/jira/browse/TEXT-174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Furkan KILIC closed TEXT-174.
-----------------------------

Has been merged to Master

> ScriptStringLookup does not accept ":" 
> ---------------------------------------
>
>                 Key: TEXT-174
>                 URL: https://issues.apache.org/jira/browse/TEXT-174
>             Project: Commons Text
>          Issue Type: Bug
>    Affects Versions: 1.8
>            Reporter: Furkan KILIC
>            Priority: Minor
>             Fix For: 1.8.1
>
>
> The usage of ":" can be pretty usefull for inside a ScriptStringLookup
>  
> For example ternary operations : 
> {code:java}
> ${script:javascript:'${myKey:-}' == '' ? 'Not Present' : 'Present' }
> {code}
> Today it's not possible to do that because the lookup only expect one ":" 
> {code:java}
> final String[] keys = key.split(SPLIT_STR);
> final int keyLen = keys.length;
> if (keyLen != 2) {
>     throw IllegalArgumentExceptions.format("Bad script key format [%s]; expected format is DocumentPath:Key.",
>             key);
> }
> {code}
> But we can limit the number of split to two:
> {code:java}
> final String[] keys = key.split(SPLIT_STR, 2);
> {code}
>  
> I will create the PR for that later on
>  
> Thanks a lot
>  
> Best regards



--
This message was sent by Atlassian Jira
(v8.3.4#803005)