Re: [castor-dev] Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper

Jene Jasper wrote:
Keith,
To get validation working correctly for an UnmarhalHandler, that 
supports xsi:nil, I have created the attached 
TestCaseBug1723Unmarshaller. The used classes are generated based on 
the attached bug1723.xsd. The asserts and fails that don't work as 
expected are commented out. For some ValidationException a wrong 
reason is creating the correct behavior in which case I have added a 
temporary alternative assert. Could you take a look if my validation 
assumptions are correct ?

To get the validation correct for the above asserts and fails the 
Validator needs to have some notion if  the tag was supplied  (for 
example <...Tag/>) or supplied and has attribute xsi:nil set (for 
example <...Tag xsi::nil="true"/>) or if the tag wasn't there. In 
other words handle <...Tag/> and <...Tag xsi::nil="true"/> as field is 
null and fieldNilOption is true (Note: exception is  which 
has field = "" and nilOption is false). When the tag is missing handle 
it as field is null and field nilOption is false. Or should <...Tag/> 
as if <...Tag xsi::nil="false"/> and thus throw required field 
exception with  still the only exception. In the latter 
case some of my validation assumptions aren't correct (and even a 
hasFieldOption might be necessary) !
Tought of a better option to avoid a hasField/TagOption: Use instead of 
the boolean a NilState object with initial value STATE_NIL_UNKNOWN 
instead of false; and of course the other options STATE_NIL_TRUE and 
STATE_NIL_FALSE.

An example of a generated class that could be used for this purpose is 
the attached TopValidationTag with nilOptions: private boolean 
_nil_requiredNillableDateTag and private java.util.ArrayList 
_nilRequiredMultipleDateTag.

To set those nilOptions I would like to add a new method public void 
setValue( java.lang.Object object, java.lang.Object value, boolean 
nil) to XMLFieldHandler. But the UnmarhalHandler makes use of  the 
FieldHandler. Should I move it to FieldHandler or create a 
helpermethod in UnmarhalHandler for all  handler.setValue calls that 
checks if the handler is an instanceof XMLFieldHandler and then call 
the new method because in the end all handler that are encountered are 
XMLFieldHandler anyway ?

Because e-mail was too large for castor-dev I will try to send smaller 
parts of the above mentioned attachments as replies.

Thanks,
Jene
By the way: should I already add the patches for UnmarshalHandler with 
xsi:nil support, but without the proper validation, to the bug ?


--- If you 
wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
   unsubscribe castor-dev


--- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
   unsubscribe castor-dev


Re: [castor-dev] Castor 0.9.6-RC3 lazy loading net.sf.cglib.core.CodeGenerationException

2005-01-16 Thread Jon Wilmoth

Done...It's
http://bugzilla.exolab.org/show_bug.cgi?id=1855

--- Werner Guttmann <[EMAIL PROTECTED]> wrote:

> 
> Jon,
> 
> can you please file a bug report at
> http://bugzilla.exolab.org, and I'll look into this
> issue tomorrow. Actually, I have not changed lazy
> loading for 
> collections, but only introduced support for lazy
> loading for 1:1 relations. But it looks to me like
> Castor is getting confused a bug about where to
> apply 
> which method.
> 
> Thanks
> Werner
> 
> On Sat, 15 Jan 2005 18:23:40 -0800 (PST), Jon
> Wilmoth wrote:
> 
> >
> >It looks like the lazy loading has changed in 0.9.6
> >from 0.9.5.3. I'm getting an reflection based
> >exception trying to load a class that has a
> property
> >who in turn has a lazy loaded collection.  The lazy
> >loaded property on the Project class has the
> following
> >mapping/java declaration:
> >
> >//marked transient since the castor persistent
> >collection is not serializeable
> >protected transient Collection phases = new
> >ArrayList();
> >
> > >type="com.apex.chronos.app.project.Phase"
> lazy="true"
> >collection="collection">
> >  
> >   >transient="false"/>
> >
> >
> >What do I need to do to get lazy loading working in
> >this release?
> >
> >Thanks,
> >Jon
> >
> >
> >Jan-15-2005 5:56:56:020 PM, PST [ERROR]
> >(org.exolab.castor.persist.SingleProxy:?) -- error
> on
> >enhance class com.apex.chronos.app.project.Project
> >net.sf.cglib.core.CodeGenerationException:
> >java.lang.IllegalAccessException-->Class
> >org.exolab.castor.persist.SingleProxy can not
> access a
> >member of class
> >com.apex.chronos.app.project.BasicProject with
> >modifiers "protected"
> > at
>
>net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
> > at
>
>net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
> > at
>
>net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
> > at
>
>net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:566)
> > at
>
>net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:493)
> > at
>
>net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:220)
> > at
>
>net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:368)
> > at
>
>net.sf.cglib.proxy.Enhancer.create(Enhancer.java:280)
> > at
>
>net.sf.cglib.proxy.Enhancer.create(Enhancer.java:597)
> > at
>
>org.exolab.castor.persist.SingleProxy.getProxy(ClassMolder.java:3243)
> > at
>
>org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:776)
> > at
>
>org.exolab.castor.persist.LockEngine.load(LockEngine.java:361)
> > at
>
>org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:698)
> > at
>
>org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
> > at
>
>org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:602)
> > at
>
>org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:585)
> > at
>
>com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:841)
> > at
>
>com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:817)
> > at
>
>com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:809)
> > at
>
>com.apex.chronos.app.authorization.ProjectRoleAssignment.findByPersonIdAndProjectId(ProjectRoleAssignment.java:121)
> > at
>
>com.apex.chronos.app.authorization.AuthorizationGuard.getProjectRoleAssignments(AuthorizationGuard.java:332)
> > at
>
>com.apex.chronos.app.authorization.AuthorizationGuard.getActiveProjectRoleAssignments(AuthorizationGuard.java:347)
> > at
>
>com.apex.chronos.app.authorization.AuthorizationGuard.hasProjectAuthorization(AuthorizationGuard.java:701)
> > at
>
>com.apex.chronos.app.authorization.AuthorizationGuard.isAuthorized(AuthorizationGuard.java:125)
> > at
>
>com.apex.chronos.app.authorization.AuthorizationGuard.isAuthorizedToView(AuthorizationGuard.java:74)
> > at
>
>com.apex.chronos.app.AbstractBusinessObject.internalFindByPrimaryKey(AbstractBusinessObject.java:900)
> > at
>
>com.apex.chronos.app.AbstractBusinessObject.internalFindByPrimaryKey(AbstractBusinessObject.java:880)
> > at
>
>com.apex.chronos.app.project.BasicProject.findByPrimaryKey(BasicProject.java:216)
> > at
>
>com.apex.chronos.ui.integration.ExportTimeSheetAction.constructExportableTimeSheet(ExportTimeSheetAction.java:281)
> > at
>
>com.apex.chronos.ui.integration.ExportTimeSheetAction.exportToQBOE(ExportTimeSheetAction.java:158)
> > at
>
>com.apex.chronos.ui.integration.ExportTimeSheetAction.doPerform(ExportTimeSheetAction.java:78)
> > at
>
com.apex.chronos.ui.AbstractAction.execute(AbstractAction.java:161)
> >
> >
> >
>
>---
> 
> >If you wish to unsubscribe from this mailing, send
> mail to
> >[EMAIL PROTECTED] with a subject of:
> >unsubscribe castor-dev
> >
> 
> 
> 

[castor-dev] Re: Unmarshalling and Validating xsi:nil The Last One

2005-01-16 Thread Jene Jasper

   public void 
testCastorUnmarshallerTopValidationTag_Element_OptionalMultipleNillableDateTag() 
throws Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + ""
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(2, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   
assertNull(topValidationTag.getOptionalMultipleNillableDateTag()[1]);

   try {
   topValidationTag.validate();
   }
   catch (ValidationException ve) {
//fail("OptionalMultipleNillableDateTag IS nillable");
assertTrue((ve.getMessage().indexOf("DateTimeValidator cannot validate a 
null object") > -1)); //  temp alternative for unexpected validation error
assertTrue((ve.getMessage().indexOf("_optionalMultipleNillableDateTagList") 
> -1)); //  temp alternative for unexpected validation error
   }

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + ""
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValid

[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper

   public void 
testCastorUnmarshallerTopValidationTag_Element_RequiredMultipleDateTag() 
throws Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + ""
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(2, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertNull(topValidationTag.getRequiredMultipleDateTag()[1]);
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());

   try {
   topValidationTag.validate();
   fail("RequiredMultipleDateTag IS required");
   }
   catch (ValidationException ve) {
//assertTrue((ve.getMessage().indexOf("a required 
field") > -1));
assertTrue((ve.getMessage().indexOf("DateTimeValidator cannot validate a 
null object") > -1)); // temp alternative for expected validation error 
"a required field"
//
assertTrue((ve.getMessage().indexOf("'RequiredMultipleDateTag'") > -1));
assertTrue((ve.getMessage().indexOf("_requiredMultipleDateTagList") > 
-1)); // temp alternative for expected validation error 
"'RequiredMultipleDateTag'"
   }

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + ""
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topVa

[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper
package nl.abz.bug.xsi.nillable;
import java.io.*;
import junit.framework.*;
import org.exolab.castor.xml.*;
import nl.abz.bug.xsi.nillable.castor.wrapper.*;
public class TestCaseBug1723Unmarshaller extends TestCase {
   public void 
testCastorUnmarshallerTopValidationTag_Element_RequiredDateTag() throws 
Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + ""
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertNull(topValidationTag.getRequiredDateTag());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());

   try {
   topValidationTag.validate();
   fail("RequiredDateTag IS required");
   }
   catch (ValidationException ve) {
   assertTrue((ve.getMessage().indexOf("a required field") 
> -1));
   assertTrue((ve.getMessage().indexOf("'RequiredDateTag'") 
> -1));
   }

   xml = ""
 + ""
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertNull(topValidationTag.getRequiredDateTag());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   

[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper

   public void 
testCastorUnmarshallerTopValidationTag_Element_RequiredMultipleNillableDateTag() 
throws Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + ""
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(2, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   
assertNull(topValidationTag.getRequiredMultipleNillableDateTag()[1]);
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());

   try {
   topValidationTag.validate();
   }
   catch (ValidationException ve) {
//fail("RequiredMultipleNillableDateTag IS nillable");
assertTrue((ve.getMessage().indexOf("DateTimeValidator cannot validate a 
null object") > -1)); // temp alternative for unexpected validation error
assertTrue((ve.getMessage().indexOf("_requiredMultipleNillableDateTagList") 
> -1)); // temp alternative for unexpected validation error
   }

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + ""
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidat

[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper

   public void 
testCastorUnmarshallerTopValidationTag_Element_RequiredNillableDateTag() 
throws Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + ""
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertNull(topValidationTag.getRequiredNillableDateTag());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + ""
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertNull(topValidationTag.getRequiredNillableDateTag());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTr

[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper

   public void 
testCastorUnmarshallerTopValidationTag_Element_OptionalMultipleDateTag() 
throws Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + ""
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(2, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertNull(topValidationTag.getOptionalMultipleDateTag()[1]);
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());

   try {
   topValidationTag.validate();
   fail("OptionalMultipleDateTag IS required when available");
   }
   catch (ValidationException ve) {
//assertTrue((ve.getMessage().indexOf("a required 
field") > -1));
assertTrue((ve.getMessage().indexOf("DateTimeValidator cannot validate a 
null object") > -1)); // temp alternative for expected validation error 
"a required field"
//
assertTrue((ve.getMessage().indexOf("'OptionalMultipleDateTag'") > -1));
assertTrue((ve.getMessage().indexOf("_optionalMultipleDateTagList") > 
-1)); // temp alternative for expected validation error 
"'OptionalMultipleDateTag'"
   }

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + ""
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005

[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper

   public void 
testCastorUnmarshallerTopValidationTag_Element_OptionalDateTag() throws 
Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + ""
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertNull(topValidationTag.getOptionalDateTag());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());

   try {
   topValidationTag.validate();
//fail("OptionalDateTag IS required when available");
   }
   catch (ValidationException ve) {
   assertTrue((ve.getMessage().indexOf("a required field") 
> -1));
   assertTrue((ve.getMessage().indexOf("'OptionalDateTag'") 
> -1));
   }

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + ""
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertNull(topValidationTag.getOptionalDateTag());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   a

[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper

   public void 
testCastorUnmarshallerTopValidationTag_Element_OptionalNillableDateTag() 
throws Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + ""
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertNull(topValidationTag.getOptionalNillableDateTag());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTrue(topValidationTag.isValid());

   xml = ""
 + "2005-01-16"
 + 
"2005-01-16"
 + "2005-01-16"
 + ""
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + 
"2005-01-16"
 + "";
   topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertNull(topValidationTag.getOptionalNillableDateTag());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());
   assertTr

[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper

   public void 
testCastorUnmarshallerTopValidationTag_Element_DirtyXSINilWithValueCombination() 
throws Exception {
   for (int i = 0; i < 2; i++) {
   boolean setRoot = (i == 1);

   String xml = ""
+ "2005-01-16"
+ 
"2005-01-16"
+ "2005-01-16"
+ "2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ 
"2005-01-16"
+ "";
   TopValidationTag topValidationTag = 
(TopValidationTag)deserializeUsingCastor(xml, new TopValidationTag(), 
setRoot, false);
   assertEquals("2005-01-16", 
topValidationTag.getRequiredDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredNillableDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalDateTag().toString());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalNillableDateTag().toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getRequiredMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getRequiredMultipleNillableDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleDateTag()[0].toString());
   assertEquals(1, 
topValidationTag.getOptionalMultipleNillableDateTagCount());
   assertEquals("2005-01-16", 
topValidationTag.getOptionalMultipleNillableDateTag()[0].toString());

   try {
   topValidationTag.validate();
//fail("OptionalNillableDateTag IS NIL but HAS value");
   }
   catch (ValidationException ve) {
   assertTrue((ve.getMessage().indexOf("attribute nil and 
value found") > -1));
   
assertTrue((ve.getMessage().indexOf("'OptionalNillableDateTag'") > -1));
   }
   }
   }
}


--- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
   unsubscribe castor-dev


[castor-dev] Re: Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper







"http://www.w3.org/2001/XMLSchema"
targetNamespace="http://abz.nl/schemas/castor/bug1723"
xmlns="http://abz.nl/schemas/castor/bug1723"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

  

  








  

  

  

  



  

  

  

  
  
  
  
  

  

  

  

  

  

  
  
  
  
  

  

  

  

  

  

  



  

  

  

  

  

  

  

  

  
  

  

  

  



  

  

  

  
  

  

  

  
  

  



--- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev


[castor-dev] Unmarshalling and Validating xsi:nil

2005-01-16 Thread Jene Jasper
Keith,
To get validation working correctly for an UnmarhalHandler, that 
supports xsi:nil, I have created the attached 
TestCaseBug1723Unmarshaller. The used classes are generated based on the 
attached bug1723.xsd. The asserts and fails that don't work as expected 
are commented out. For some ValidationException a wrong reason is 
creating the correct behavior in which case I have added a temporary 
alternative assert. Could you take a look if my validation assumptions 
are correct ?

To get the validation correct for the above asserts and fails the 
Validator needs to have some notion if  the tag was supplied  (for 
example <...Tag/>) or supplied and has attribute xsi:nil set (for 
example <...Tag xsi::nil="true"/>) or if the tag wasn't there. In other 
words handle <...Tag/> and <...Tag xsi::nil="true"/> as field is null 
and fieldNilOption is true (Note: exception is  which has 
field = "" and nilOption is false). When the tag is missing handle it as 
field is null and field nilOption is false. Or should <...Tag/> as if 
<...Tag xsi::nil="false"/> and thus throw required field exception with 
 still the only exception. In the latter case some of my 
validation assumptions aren't correct (and even a hasFieldOption might 
be necessary) !

An example of a generated class that could be used for this purpose is 
the attached TopValidationTag with nilOptions: private boolean 
_nil_requiredNillableDateTag and private java.util.ArrayList 
_nilRequiredMultipleDateTag.

To set those nilOptions I would like to add a new method public void 
setValue( java.lang.Object object, java.lang.Object value, boolean nil) 
to XMLFieldHandler. But the UnmarhalHandler makes use of  the 
FieldHandler. Should I move it to FieldHandler or create a helpermethod 
in UnmarhalHandler for all  handler.setValue calls that checks if the 
handler is an instanceof XMLFieldHandler and then call the new method 
because in the end all handler that are encountered are XMLFieldHandler 
anyway ?

Because e-mail was to large for castor-dev I will try to send smaller 
parts of the above mentioned attachments as replies.

Thanks,
Jene

--- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
   unsubscribe castor-dev


Re: [castor-dev] Castor 0.9.6-RC3 lazy loading net.sf.cglib.core.CodeGenerationException

2005-01-16 Thread Werner Guttmann

Jon,

can you please file a bug report at http://bugzilla.exolab.org, and I'll look 
into this issue tomorrow. Actually, I have not changed lazy loading for 
collections, but only introduced support for lazy loading for 1:1 relations. 
But it looks to me like Castor is getting confused a bug about where to apply 
which method.

Thanks
Werner

On Sat, 15 Jan 2005 18:23:40 -0800 (PST), Jon Wilmoth wrote:

>
>It looks like the lazy loading has changed in 0.9.6
>from 0.9.5.3. I'm getting an reflection based
>exception trying to load a class that has a property
>who in turn has a lazy loaded collection.  The lazy
>loaded property on the Project class has the following
>mapping/java declaration:
>
>//marked transient since the castor persistent
>collection is not serializeable
>protected transient Collection phases = new
>ArrayList();
>
>type="com.apex.chronos.app.project.Phase" lazy="true"
>collection="collection">
>  
>  transient="false"/>
>
>
>What do I need to do to get lazy loading working in
>this release?
>
>Thanks,
>Jon
>
>
>Jan-15-2005 5:56:56:020 PM, PST [ERROR]
>(org.exolab.castor.persist.SingleProxy:?) -- error on
>enhance class com.apex.chronos.app.project.Project
>net.sf.cglib.core.CodeGenerationException:
>java.lang.IllegalAccessException-->Class
>org.exolab.castor.persist.SingleProxy can not access a
>member of class
>com.apex.chronos.app.project.BasicProject with
>modifiers "protected"
>   at
>net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
>   at
>net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
>   at
>net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
>   at
>net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:566)
>   at
>net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:493)
>   at
>net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:220)
>   at
>net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:368)
>   at
>net.sf.cglib.proxy.Enhancer.create(Enhancer.java:280)
>   at
>net.sf.cglib.proxy.Enhancer.create(Enhancer.java:597)
>   at
>org.exolab.castor.persist.SingleProxy.getProxy(ClassMolder.java:3243)
>   at
>org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:776)
>   at
>org.exolab.castor.persist.LockEngine.load(LockEngine.java:361)
>   at
>org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:698)
>   at
>org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
>   at
>org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:602)
>   at
>org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:585)
>   at
>com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:841)
>   at
>com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:817)
>   at
>com.apex.chronos.app.AbstractBusinessObject.executeFind(AbstractBusinessObject.java:809)
>   at
>com.apex.chronos.app.authorization.ProjectRoleAssignment.findByPersonIdAndProjectId(ProjectRoleAssignment.java:121)
>   at
>com.apex.chronos.app.authorization.AuthorizationGuard.getProjectRoleAssignments(AuthorizationGuard.java:332)
>   at
>com.apex.chronos.app.authorization.AuthorizationGuard.getActiveProjectRoleAssignments(AuthorizationGuard.java:347)
>   at
>com.apex.chronos.app.authorization.AuthorizationGuard.hasProjectAuthorization(AuthorizationGuard.java:701)
>   at
>com.apex.chronos.app.authorization.AuthorizationGuard.isAuthorized(AuthorizationGuard.java:125)
>   at
>com.apex.chronos.app.authorization.AuthorizationGuard.isAuthorizedToView(AuthorizationGuard.java:74)
>   at
>com.apex.chronos.app.AbstractBusinessObject.internalFindByPrimaryKey(AbstractBusinessObject.java:900)
>   at
>com.apex.chronos.app.AbstractBusinessObject.internalFindByPrimaryKey(AbstractBusinessObject.java:880)
>   at
>com.apex.chronos.app.project.BasicProject.findByPrimaryKey(BasicProject.java:216)
>   at
>com.apex.chronos.ui.integration.ExportTimeSheetAction.constructExportableTimeSheet(ExportTimeSheetAction.java:281)
>   at
>com.apex.chronos.ui.integration.ExportTimeSheetAction.exportToQBOE(ExportTimeSheetAction.java:158)
>   at
>com.apex.chronos.ui.integration.ExportTimeSheetAction.doPerform(ExportTimeSheetAction.java:78)
>   at com.apex.chronos.ui.AbstractAction.execute(AbstractAction.java:161)
>
>
>
>--- 
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>unsubscribe castor-dev
>



--- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev