Skip to content

Add error analysis of ReqIF parser#1

Merged
Tob1as864 merged 7 commits into
masterfrom
claude/reqif-parser-error-analysis-fz13y4
Jul 23, 2026
Merged

Add error analysis of ReqIF parser#1
Tob1as864 merged 7 commits into
masterfrom
claude/reqif-parser-error-analysis-fz13y4

Conversation

@Tob1as864

Copy link
Copy Markdown
Owner

Documents all identified defects, grouped by severity:

  • Multiselect enums: only first ENUM-VALUE-REF is parsed, single-string data model, lost enum defaults
  • Image/object conversion: invalid toString output, path separator corruption, namespace prefix mismatch, broken picture map lookup, resource leaks, zip-slip
  • Crashes on valid files: null map key for unknown datatypes, missing null checks, NumberFormatExceptions, ClassCastException in getXHTMLContent, System.exit in library code
  • Robustness and code quality issues

Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_011mat2d7AJkouKhXWUYzHxs

claude added 7 commits July 23, 2026 17:50
Documents all identified defects, grouped by severity:
- Multiselect enums: only first ENUM-VALUE-REF is parsed, single-string data model, lost enum defaults
- Image/object conversion: invalid toString output, path separator corruption, namespace prefix mismatch, broken picture map lookup, resource leaks, zip-slip
- Crashes on valid files: null map key for unknown datatypes, missing null checks, NumberFormatExceptions, ClassCastException in getXHTMLContent, System.exit in library code
- Robustness and code quality issues

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011mat2d7AJkouKhXWUYzHxs
- Move sources to standard Maven layout (src/main/java)
- Add pom.xml (Java 17, JUnit 5, Surefire)
- Add CI workflow running mvn verify on every push and pull request

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011mat2d7AJkouKhXWUYzHxs
- Parse documents namespace-aware and match XHTML elements by local
  name, so prefixed content (xhtml:div, reqif-xhtml:object, ...) is no
  longer dropped or causes NPEs
- Expose XHTML tag names without namespace prefix
- Replace System.exit(1) on parse errors with ReqIFParseException
- Disallow DOCTYPE and external entities (XXE hardening)
- Navigate TYPE/DEFINITION/DEFAULT-VALUE/SPEC-ATTRIBUTES by element
  instead of fixed child indices, so minified XML no longer breaks
- Add XmlUtils helper for namespace/whitespace-independent DOM access
- Tests: XHTMLNamespaceTest, ParserHardeningTest

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011mat2d7AJkouKhXWUYzHxs
- Read ALL ENUM-VALUE-REF children of an enumeration attribute value;
  previously only the first selected value survived parsing
- AttributeValueEnumeration now carries the full value list (getValues/
  getValueRefs); getValue() returns the joined string for compatibility
- AttributeDefinitionEnumeration resolves DEFAULT-VALUE enum refs (they
  are elements, not a THE-VALUE attribute) and exposes MULTI-VALUED
- Rewrite DatatypeEnumeration parsing: element-based navigation instead
  of fixed child indices, optional LONG-NAME/KEY/OTHER-CONTENT handled
- Null-safe enum lookups in DatatypeEnumeration and SpecType (unknown
  ids no longer throw NPE)
- Tests: MultiselectEnumTest

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011mat2d7AJkouKhXWUYzHxs
- XHTMLElementObject renders a valid data="..." attribute (plus type),
  keeps URI forward slashes on every platform and no longer NPEs when
  the data attribute is missing; adds getMimeType/getDataAsFilePath
- Restore the dead XHTML deconstruction mapping so P/TBL/L/H/OBJ tokens
  (including image paths) are extracted again; expose getElementList()
- Fix picture association: consistent map keys (full document name) with
  extension-less fallback, lookup by object data URI or plain file name
- ReqIFz: guard against zip-slip, close streams while extracting, drop
  unused swing import; ReqIF/ReqIFz path handling no longer breaks on
  dots or mixed separators in paths
- ReqIFFile implements Closeable so picture streams can be released
- Fix var extraction in list items reading the wrong node
- Tests: ImagePipelineTest

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011mat2d7AJkouKhXWUYzHxs
- ReqIFCoreContent: register unknown datatypes under their ID instead of
  a null key; treat MIN/MAX/MAX-LENGTH as optional
- DatatypeInteger: long-range bounds with BigInteger clamping (DOORS
  exports exceed int); DatatypeString: missing MAX-LENGTH = unbounded
- AttributeValueInteger/Double: empty THE-VALUE parses as 0 instead of
  NumberFormatException
- SpecHierarchy.getXHTMLContent: return the element list via its getter
  (the former cast threw ClassCastException on every call)
- Specification: parse DATE and REAL attribute values (formerly dropped),
  fill DATE/DOUBLE defaults, fail with ExceptionSpecObject instead of NPE
  on unresolvable datatypes; null-safe getAttribute/getDescription
- SpecObject: null-safe getAttribute, consistent empty REAL handling
- ReqIFHeader: no crash on comments without 'Created by:' or unexpected
  CREATION-TIME formats
- XHTMLElement.hasChildren: fix inverted logic
- Remove unused javax.xml.crypto.Data import
- Tests: RobustnessTest

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011mat2d7AJkouKhXWUYzHxs
@Tob1as864
Tob1as864 merged commit 42b71b6 into master Jul 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants