Uploaded image for project: 'Commons Text'
  1. Commons Text
  2. TEXT-174

ScriptStringLookup does not accept ":"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8
    • 1.9
    • None

    Description

      The usage of ":" can be pretty usefull for inside a ScriptStringLookup

       

      For example ternary operations : 

      ${script:javascript:'${myKey:-}' == '' ? 'Not Present' : 'Present' }
      

      Today it's not possible to do that because the lookup only expect one ":" 

      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);
      }
      

      But we can limit the number of split to two:

      final String[] keys = key.split(SPLIT_STR, 2);
      

       

      I will create the PR for that later on

       

      Thanks a lot

       

      Best regards

      Attachments

        Activity

          People

            Unassigned Unassigned
            furkilic Furkan KILIC
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: