Details

    • Type: Task Task
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.2.1
    • Fix Version/s: not determined
    • Component/s: xjc
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: HP

    • Issuezilla Id:
      770

      Description

      If I set jaxb:version="2.2" or jaxb:version="2.2.1" and run xjc, I get the
      following error message:

      [ERROR] JAXB version attribute must be "1.0"

      xjc will accept jaxb:version="2.1". I recommend that xjc be updated to accept
      "2.2" and "2.2.1". I also recommend that the error message be changed to:

      [ERROR] Unrecognized JAXB version in jaxb:version attribute.

        Activity

        Hide
        gmazza added a comment -

        According to the binding schema's definition of the version attribute, the
        jaxb:version is not the version of JAXB (xjc) you're using, but rather the
        schema version of the binding file--here, for example, is 2.0's schema:

        http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd

        Replacing the 2 with a 1 above will get you the 1.0 schema.

        Allowing values of 2.1, 2.2, 2.2.1, etc. will confuse things as it implies that
        you're specifying the desired version of xjc to use when in reality you're just
        stating the binding schema your binding file is following.

        I think the switch should be then to allow just 1.0 or 2.0 as values (not 2.1,
        as there's no binding schema with that version number), and instead of
        "Unrecognized JAXB version..." as the error message (which could imply it can't
        read the binding file, and also might confuse users who are expecting to place
        the xjc version there) to say "JAXB binding schema version attribute must be
        "1.0" or "2.0".

        Show
        gmazza added a comment - According to the binding schema's definition of the version attribute, the jaxb:version is not the version of JAXB (xjc) you're using, but rather the schema version of the binding file--here, for example, is 2.0's schema: http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd Replacing the 2 with a 1 above will get you the 1.0 schema. Allowing values of 2.1, 2.2, 2.2.1, etc. will confuse things as it implies that you're specifying the desired version of xjc to use when in reality you're just stating the binding schema your binding file is following. I think the switch should be then to allow just 1.0 or 2.0 as values (not 2.1, as there's no binding schema with that version number), and instead of "Unrecognized JAXB version..." as the error message (which could imply it can't read the binding file, and also might confuse users who are expecting to place the xjc version there) to say "JAXB binding schema version attribute must be "1.0" or "2.0".
        Hide
        gmazza added a comment -

        More info on this is in the JAXB 2.2 specification (Dec. 2009), Section 7.1.4:

        7.1.4 Version Attribute
        The normative binding schema specifies a global version attribute. It is used
        to identify the version of the binding declarations. For example, a future
        version of this specification may use the version attribute to specify backward
        compatibility. To indicate this version of the specification, the version
        should be "2.0". It is also valid for @version to be “1.0�. If any other
        version is specified, it must result in an invalid customization as specified in
        Section 7.1.5, “Invalid Customizations.�

        Show
        gmazza added a comment - More info on this is in the JAXB 2.2 specification (Dec. 2009), Section 7.1.4: 7.1.4 Version Attribute The normative binding schema specifies a global version attribute. It is used to identify the version of the binding declarations. For example, a future version of this specification may use the version attribute to specify backward compatibility. To indicate this version of the specification, the version should be "2.0". It is also valid for @version to be “1.0�. If any other version is specified, it must result in an invalid customization as specified in Section 7.1.5, “Invalid Customizations.�
        Hide
        gmazza added a comment -

        Created an attachment (id=359)
        Patch to require 1.0 or 2.0 for binding schema version numbers

        Show
        gmazza added a comment - Created an attachment (id=359) Patch to require 1.0 or 2.0 for binding schema version numbers
        Hide
        gmazza added a comment -

        Attached patch requires 1.0 or 2.0 for the binding schema value as required in
        Section 7.1.4 of the JAXB 2.2 spec. Acceptance of 2.1 has been removed.

        However, unfortunately all episode files created by xjc--which are really
        binding files--have been using 2.1 as the binding schema version. The attached
        patch also fixes that problem and makes it use 2.0.

        Unfortunately that will mean that those who use future versions of JAXB with
        their old episode files will need to lower the version number manually from 2.1
        to 2.0. Expect some future hate mail as a result of this change, but per the
        spec, I don't see how JAXB/xjc can/should allow 2.1 as a value. Thankfully,
        changing the version number in an episode file is a pretty minor change to make.

        Show
        gmazza added a comment - Attached patch requires 1.0 or 2.0 for the binding schema value as required in Section 7.1.4 of the JAXB 2.2 spec. Acceptance of 2.1 has been removed. However, unfortunately all episode files created by xjc--which are really binding files--have been using 2.1 as the binding schema version. The attached patch also fixes that problem and makes it use 2.0. Unfortunately that will mean that those who use future versions of JAXB with their old episode files will need to lower the version number manually from 2.1 to 2.0. Expect some future hate mail as a result of this change, but per the spec, I don't see how JAXB/xjc can/should allow 2.1 as a value. Thankfully, changing the version number in an episode file is a pretty minor change to make.
        Hide
        gmazza added a comment -

        Marking as patch attached.

        Show
        gmazza added a comment - Marking as patch attached.
        Hide
        Martin Grebac added a comment -

        marking higher so that I look at this one

        Show
        Martin Grebac added a comment - marking higher so that I look at this one

          People

          • Assignee:
            Martin Grebac
            Reporter:
            lrflesch
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: