Uploaded image for project: 'Data Collection, Analytics, and Events'
  1. Data Collection, Analytics, and Events
  2. DCAEGEN2-2489

BPGenerator yaml Fixes are different for yaml file and string

XMLWordPrintable

      For yaml file removing ' looks like:

       

      while((line = br.readLine()) != null) {
      //  lines.add(ensureNoSingleQuotes(line));
        if(line.contains("'")) {
          line = line.replace("'", "");
        }
        if(line.contains("\"\"") && (line.contains("m") || line.contains("M"))) {
          line = line.replaceAll("\"\"", "\"");
        }
        lines.add(line);
      }
      

      while for string ensureNoSingleQuotes method is used:

      private static String ensureNoSingleQuotes(String line) {
         // TODO: Should probably use regex instead
         // REVIEW: The condition under which to remove the single quotes
         if ((line.contains("concat") || line.contains("default: ")) && line.contains("'")) {
            return line.replace("'", "");
         } else {
            return line;
         }
      }
      

       

      using ensureNoSingleQuotes leaves string typed properties as:

      property: '"stringValue"'
      

      which causes consul configuration to look like:

      "property": "\"stringValue\""
      

      I don't think that there are singleQuotes in result file/string that should be kept there.

      Don't know what is the reason for the code below, but it's possible that it should be also added to string fixes.

      if(line.contains("\"\"") && (line.contains("m") || line.contains("M"))) {
        line = line.replaceAll("\"\"", "\"");
      }
      

            vv770d vv770d
            rjanecze rjanecze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: