Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7578

camel-bindy - pattern attribute should not be ignored if locale is not set

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.13.1
    • Fix Version/s: 2.12.5, 2.13.3, 2.14.0
    • Component/s: camel-bindy
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      This code doesn't pad field mandant with "0" if locale is not set:

      @CsvRecord(separator = ",")
      public class Unity {
          @DataField(pos = 1, pattern = "000")
          public float mandant;
      

      Route:

      final BindyCsvDataFormat bindy = new BindyCsvDataFormat(Unity.class);
      from("direct:start")
          .marshal(bindy)
          .log("${body}");
      

      Testing with:

      final Unity unity = new Unity();
      unity.mandant = 50f;
      final ProducerTemplate template = context.createProducerTemplate();
      

      This prints:

      50.0

      Only when setting the locale, pattern is not ignored:

      bindy.setLocale(Locale.US.getISO3Country());
      

      This prints:

      050

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              Peter Keller Peter Keller
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: