Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.3.1
-
Fix Version/s: 1.3.4
-
Component/s: XML code generator
-
Labels:None
-
Environment:Java 1.6, Castor 1.3.1
-
Testcase included:yes
-
Number of attachments :
Description
Castor XML source generation creates file named "XMLnull.java".
Castor should not generate file names that have "null" in their file name.
Test case is attached.
Apparently, this issue occurs only when all below conditions hold:
- binding file is used with
- defaultBindingType="type"
- namingXML/complexTypeName/prefix is set (to "XML" in the example)
- package specification for namespace of the imported file
- two layers of <xsd:import> / <xsd:include> used
- complexType / element / complexType structure in 2nd-level included XSD.
Attached test case is a simple Ant file.
Adjust the path to the libraries, then call ant.
The issue is evident when output at the end shows:
"Strange file name: src-generated/include1/XMLnull.java"
The "null" likely comes from XMLBindingComponent.java lines 779 and 892
if (_prefix != null)
if (_suffix != null)
{ result = result + _suffix; }Maybe it helps to check for "result != null" around this (not tested)?
Unfortunately, we have loads of XSDs which have this structure. The "XMLnull.java" files overwrite each other, so that the "last one wins". We do not want to use defaultBindingType="element" because this would mean 1000+ code changes in our code that uses the generated code. Currently we're using an older version of Castor (<1.x) where this isse does not occur.
If there's another way around this we'd be happy to learn about it. Thanks.
One more detail: issue still exists when only one level of <import> is used, with no <include>. In this case, a file "src-generated/top/XMLnull.java" is created.