FlexDoc/XML - Generator

Error Reporting

Both FlexDoc/XML Generator and Template Designer may encounter various unexpected error situations. During the generation, the unexpected errors and exceptions may arise because of the following reasons:
  1. I/O errors (e.g. invalid file pathnames, disk full, etc.)
  2. Template errors/bugs (when something is wrongly specified in templates).
  3. Data source exceptions (in the case of FlexDoc/XML, these are exceptions thrown by the Apache Xerces2).
  4. FlexDoc core exceptions (may be caused by bugs not discovered and fixed yet).
FlexDoc tries to catch all such errors/exceptions and report about them along with the full diagnostics possible (i.e. where exactly and how the error has happened).

When the generator GUI is enabled, any error is reported via the error message dialog, like the one shown on the screenshot:

The error dialog shows brief information about the error. When more details are available, a full ERROR REPORT is created and dumped to the system clipboard. You can easily extract it (e.g. under MS Windows, just run Notepad and press Ctrl+V).

When the generator is executed without the GUI (-nodialog option is specified on the generator command line), by default, all exception/error details will be sent to the standard console. However, using -errlog option, you can specify a separate error log file. In that case, the ERROR REPORT will be dumped in that file; only brief messages will get on the console.
The detailed ERROR REPORT includes:
  • The general info about JVM, OS, command-line arguments, etc.
  • All available error messages.
  • Template Location Trace that shows precisely which templates/components/properties (i.e. template locations) were being interpreted when the error happened.
    Each template location is identified both verbally and, when applicable, with the line number in the template file, where the given component/property is defined. Additionally, for some template locations, the context element is reported that shows which XML element (along with its XML file) was being processed by the given template/component/property at the moment of the error.

    Having a line number in the template file, you can easily find the error location direct in the Template Designer.

  • Java Exception Stack Trace (when the error was caused by some unexpected Java exception).
Here is how an ERROR REPORT looks (the template line numbers and context elements are highlighted with special colors):
================================================================================
FLEXDOC.XYZ ERROR REPORT, 2024-10-12 09:09:22
================================================================================
FlexDoc/XML, Version 1.14
Main class: xyz.flexdoc.xml.Designer
Arguments: -m:IMAGE_PROVIDER=DiagramKit
Generator Config: C:\flexdoc-xml\WSDLDoc\config\generator.config
java.version=22.0.2
java.vendor=Oracle Corporation
sun.arch.data.model=64
os.name=Windows 10
os.arch=amd64
os.version=10.0
locale=en_US
--------------------------------------------------------------------------------
GENERATOR INFO
--------------------------------------------------------------------------------
Template Application: FlexDoc/XML WSDLDoc, Version 2.0
Main Template: C:\flexdoc-xml\WSDLDoc\templates\FramedDoc.tpl
XML Catalog(s):
	file:/C:/flexdoc-xml/lib/resources/catalog.xml
Loaded XML Files (4):
	C:\flexdoc-xml\WSDLDoc\demo\ndfdXML.wsdl
	C:\flexdoc-xml\lib\resources\schemas_xmlsoap_org\soap\encoding.xsd
	C:\flexdoc-xml\lib\resources\schemas_xmlsoap_org\wsdl\wsdl.xsd
	C:\flexdoc-xml\WSDLDoc\demo\overview.xhtml
Output Status: generating
Output Format: HTML
Output Folder: C:\flexdoc-xml\out\WSDLDoc\
--------------------------------------------------------------------------------
ERROR DETAIL
--------------------------------------------------------------------------------
Generator Exception:
No element map found with id 'substituting-elements'
--------------------------------------------------------------------------------
When executing function call 'countElementsByKey' (expr: Ln 1, Col 9)
--------------------------------------------------------------------------------
at Enabling Condition (index-letter.tpl:419)
at Panel Control (index-letter.tpl:418)
at Control Group (index-letter.tpl:383)
at Area Section for 'xs:element' (index-letter.tpl:378)
at Folder Section (index-letter.tpl:221)
at Folder Section (index-letter.tpl:216)
at Element Iterator by '<ANY>' (index-letter.tpl:156)
at Template: C:\flexdoc-xml\WSDLDoc\templates\lib\index-letter.tpl
   with context element: #CUSTOM
at Call Template 'lib\index-letter.tpl' (FramedDoc.tpl:9038)
at Element Iterator by '#CUSTOM' (FramedDoc.tpl:9016)
at Folder Section (FramedDoc.tpl:9012)
at Template: C:\flexdoc-xml\WSDLDoc\templates\FramedDoc.tpl
   with context element: #DOCUMENTS

Finding Error Location in Template

FlexDoc/XML templates are plain text files, where every component/property definition starts from a new line. So, having a line number in the template file, you can open it in some text editor and find the necessary line. However, that won't be very useful because templates are not supposed for manual editing.

Instead, using the same line number information, you can quickly find the error location directly in the Template Designer:

  1. Open the template in the Template Designer.
  2. In the main menu select: Edit | Find. You will see a dialog where in «Search for» combo-box should be: Line number in template file
  3. In the «Line Number» field enter the line number (that you took from the ERROR REPORT) and click «Search».
  4. Now, in the «Search Results» pane you should see a tree of some template components. The last node of that tree depicts the component/property that was searched for (corresponding the entered line number). All nodes above are its ancestors (that is all those components that contain the found one). You can walk that tree by clicking with mouse on particular nodes.
  5. When you click «Show Location» button, the Template Designer (behind the dialog) will adjust itself to show the component currently selected in the «Search Results» tree (or when it's a property, then the component containing it). That component will be selected in the designer pane as well. Now you can close the search dialog and edit the selected component or see its properties.
    The selected component is highlighted in the designer pane (on the right) with a faint blue box around it. When it is a template section, it is also highlighted in the section tree (on the left).
Below is the compound screenshot of the whole search process described above (click to see in full size):

See Also: