net.sf.okapi.lib.xliff2.metadata.Meta.setType() should accept empty strings

Issue #20 resolved
Nikolai Weibull created an issue

The type attribute on mda:meta isn’t limited to non-empty strings, so checking that its value isn’t empty isn’t right. The patch for this is simple, just change the test to

type == null

on line 69 of, see

For further reference, see the XML Schema for mda:meta,

The relevant part is

  <xs:element name="meta">
    <xs:complexType mixed="true">
      <xs:attribute name="type" use="required" type="xs:string"/>

and, as I’m sure you know, this doesn’t limit type to non-empty strings. The type would have to be something along the lines of

<simpleType name="non-empty-string">
  <restriction base="xs:string">
    <minLength value="1"/>

for that to be the case.

Now I haven’t looked at the rest of the code that uses Meta.getType() to verify that no callers expect a non-empty string. I assume that you know where to look to apply any further necessary patches. The comments on line 32 and line 40 should be updated to reflect that type must only be non-null.

Thank you!


Comments (3)

  1. Log in to comment