Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.2
-
Fix Version/s: 1.2
-
Component/s: XML code generator
-
Labels:None
-
Environment:Windows using Intellij Idea. Java 1.5.
Description
I just tried out the snapshot release of Castor 1.1.3 and found what seems to be a bug. My schema has an element, screenSize, that is an enumeration that consists of the values Small, Medium, and Large. I set the enumeration to have the default value of Medium. screenSize is an element in a complex type typeMyUser. The source generator created the classes TypeMyUser.java and ScreenSizeType.java. TypeMyUser.java has a member variable called _screenSize with a default value being set. The problem is the way the default value is being set. It has something like
private ScreenSizeType _screenSize = ScreenSizeType.valueOf("Medium");
The problem is the enum constant name that it is passing into the valueOf method does not exist. The enum constants that were created were SMALL, MEDIUM, and LARGE (all caps). So, the line above should have passed the all caps enum constant name instead:
private ScreenSizeType _screenSize = ScreenSizeType.valueOf("MEDIUM");
Just to make sure that I get a few things right:
Actually, why not attach the castorbuilder.properties you are using, in case you are using one ?
- you want Java 5.0 code to be generated, right ?
- you want an enum to be generated for the screenSizeType definition ?
Actually, why not attach the castorbuilder.properties you are using, in case you are using one ?