Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-1429

DefaultXmlFormatter: Should return plain text if formatting fails

XMLWordPrintable

      • Run the DMN editor.
      • Open an invalid model (see attached).
      • Save it.
      • Open the saved file in a text editor.

      DefaultXmlFormatter attempts to format the text returned from editors assuming it is a String representation of an XML document. However both DMN and BPMN editors allow saving invalid content i.e. plain text not being the representation of a valid XML document (in which scenarios both DMN and BPMN would have shown the ACE editor to Users). Consequentially calls to editor.getContent() may return a Promise that does not contain a String representation of an XML document. Passing this to the DefaultXmlFormatter leads to an error that is stored in the file.

      Revealed during other PR review, see the comment

        1. test.dmn
          0.0 kB
        2. Screenshot from 2021-01-12 15-16-52.png
          Screenshot from 2021-01-12 15-16-52.png
          145 kB
        3. KOGITO-1429-invalid content.png
          KOGITO-1429-invalid content.png
          107 kB
        4. KOGITO-1429-getContent result.png
          KOGITO-1429-getContent result.png
          114 kB
        5. broken (copy).dmn
          0.5 kB

            tfernand-1 Tiago Bento
            manstis@redhat.com Michael Anstis
            Jozef Marko Jozef Marko (Inactive)
            Jozef Marko Jozef Marko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: