JiBX
  1. JiBX
  2. JIBX-307

Unable to handle same schema file names in different directories

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.2.1
    • Fix Version/s: JiBX 1.2.2
    • Component/s: CodeGen
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Trying to generate binding for HR-XML schemas (http://ns.hr-xml.org/AllHRXML/200704/HRXML200704.zip) following exception is raised:

      Exception in thread "main" java.lang.NullPointerException
      at org.jibx.schema.codegen.CodeGen.applyAndNormalize(CodeGen.java:610)
      at org.jibx.schema.codegen.CodeGen.main(CodeGen.java:1646)

      I realized that CodeGen has problem to distinguish between schemas with the same file name in different directories. For example HR-XML has these two schemas among others:

      HR-XML-2_5/Indicative/US/USLocalizations.xsd
      HR-XML-2_5/CPO/US/USLocalizations.xsd

      I found that the problem could be in the class org.jibx.schema.UrlResolver. There is the property:

      private final String m_name;

      which is set with only file name (without path). When I tried to change the constructor like this:

      public UrlResolver(String path, URL url)

      { m_url = url; m_id = url.getProtocol().toLowerCase() + "://" + url.getHost().toLowerCase() + url.getFile(); path.replace('\\', '/'); m_name = path; }

      then CodeGen worked as expected. The solution was to store the whole path into the name property. I'm not sure if this fix is suitable and could not have other consequencies.

      Jirka

        Activity

        Hide
        Dennis Sosnoski added a comment -

        Fixed in current code by passing full identifier for schema in various methods (rather than just the schema name).

        Show
        Dennis Sosnoski added a comment - Fixed in current code by passing full identifier for schema in various methods (rather than just the schema name).
        Dennis Sosnoski made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Dennis Sosnoski [ dsosnoski ]
        Resolution Fixed [ 1 ]
        Dennis Sosnoski made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Jiri Kotal
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: