Just to let people know the outcome, there are no actual problems using JiBX with JDK 1.5 enums that I've been able to find. The problems in this case were due to (1) the actual classes weren't in the classpath specified to the binding compiler, and (2) the default value is the text form of the enum, which in this case would be just "English".

 - Dennis

Dennis Sosnoski wrote:

I haven't looked into the Java 1.5 enum implementation in any detail. >From the message it appears the class simply cannot be loaded. It may be that the enum classes use a representation that BCEL doesn't support. If you enter this in Jira I'll try to take a look before the 1.0 production release, in case there's an easy fix.

 - Dennis

Steffan Westcott wrote:

I am able to use a Java 1.5 style enum for unmarshalling, like this:

<value name="language" field="language" deserializer="Test.Language.valueOf"/>

----

package Test;
public enum Language
{
    English, French, German
}

----

However, I get an binding compiler error when attempting to specify a default value for the enum:

<value name="language" field="language" usage="optional" default="English" deserializer="Test.Language.valueOf"/>


[bind] Using the following paths:
[bind] C:\Borland\JBuilder2005\projects\JiBXBugExample\classes
[bind] Using the following binding paths:
[bind] mapping.xml
[bind] Running binding compiler version jibx-rc0
[bind] Error: Unable to load class Test.Language for converting default value of type Test.Language for value element at (line 4, col 118, in mapping.xml)
[bind] Error running binding compiler
[bind] org.jibx.runtime.JiBXException: Binding mapping.xml is unusable because of validation errors
[bind] at org.jibx.binding.Utility.loadBinding(Utility.java:361)
[bind] at org.jibx.binding.Utility.loadFileBinding(Utility.java:389)
[bind] at org.jibx.binding.Compile.compile(Compile.java:294)
...


It seems to have trouble loading my classes when trying to deal with the default value conversion. If I remove the default/deserialize properties, everything works correctly. What am I doing wrong?

Thanks,
Steffan




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to