DateString and the format rule are new to 2.2

> -----Original Message-----
> From: Xavier Ottolini [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, January 17, 2003 7:08 AM
> To: Turbine Users List
> Subject: Re: group.setProperties throws an exception, how to 
> get the original e.getMessage ?
> 
> 
> Is format rule compilant with Turbine 2.1 ?
> 
> I wrote in the inkake.xml this group :
>     <group name="AgendaGroup" key="agenda" mapToObject="om.Agenda">
>         <field name="AgendaId" key="agendaid" type="NumberKey" 
> mapToProperty="AgendaId">
>             <rule name="mask" value="^$|[0-9]+">Veuillez 
> s�lectionner un 
> agenda.</rule>
>         </field>
>         <field name="JourD" key="jourd" type="String" 
> mapToProperty="JourD">
>             <rule name="required" value="true">Jour ne doit pas �tre 
> vide.</rule>
>             <rule name="format" value="dd/MM/yyyy">Jour doit 
> respecter 
> le format : ("jj/mm/aaaa").</rule>             
>         </field>
>     </group>
> 
> When I submit the form, the fields are checked with the method call :
> intake.isAllValid() . This returns true even if the date is false.
> 
> An exception is thrown if  I use the type "DateString" for the field 
> "JourD". It happens when I display a page.
> 
> [Fri Jan 17 13:57:15 CET 2003] -- INFO -- Finish Initializing service 
> (late): UploadService
> [Fri Jan 17 13:57:16 CET 2003] -- ERROR --
>     Exception:  org.apache.turbine.util.TurbineException
>     Stack Trace follows:
>     java.lang.NullPointerException
>     at 
> org.apache.turbine.services.intake.model.FieldFactory.getInsta
> nce(FieldFactory.java:154)
>     at 
> org.apache.turbine.services.intake.model.Group.<init>(Group.java:154)
>     at 
> org.apache.turbine.services.intake.TurbineIntakeService.getGro
> up(TurbineIntakeService.java:368)
> rethrown as org.apache.turbine.util.TurbineException
>     at 
> org.apache.turbine.services.intake.TurbineIntakeService.getGro
> up(TurbineIntakeService.java:372)
>     at 
> org.apache.turbine.services.intake.TurbineIntake.getGroup(Turb
> ineIntake.java:85)
>     at 
> org.apache.turbine.services.intake.IntakeTool.init(IntakeTool.
> java:131)
>     at 
> org.apache.turbine.services.pull.TurbinePullService.populateWi
> thRequestTools(TurbinePullService.java:479)
>     at 
> org.apache.turbine.services.pull.TurbinePullService.populateCo
> ntext(TurbinePullService.java:415)
>     at 
> org.apache.turbine.services.pull.TurbinePull.populateContext(T
> urbinePull.java:145)
>     at 
> org.apache.turbine.services.velocity.TurbineVelocityService.ge
> tContext(TurbineVelocityService.java:218)
>     at 
> org.apache.turbine.services.velocity.TurbineVelocity.getContex
> t(TurbineVelocity.java:140)
>     at 
> org.apache.turbine.modules.pages.VelocityPage.doBuildBeforeAct
> ion(VelocityPage.java:84)
>     at 
> org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPa
> ge.java:137)
> ....
> 
> More over when I submit the form, an exception is also thrown 
> : [Fri Jan 17 13:59:42 CET 2003] -- ERROR --
>     Exception:  java.lang.reflect.InvocationTargetException
>     Stack Trace follows:
>     java.lang.reflect.InvocationTargetException
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:324)
>     at 
> org.apache.turbine.util.velocity.VelocityActionEvent.executeEv
> ents(VelocityActionEvent.java:166)
>     at 
> org.apache.turbine.util.velocity.VelocityActionEvent.perform(V
> elocityActionEvent.java:114)
>     at 
> org.apache.turbine.modules.actions.VelocityAction.perform(Velo
> cityAction.java:114)
>     at 
> org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:122)
>     at 
> org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPa
> ge.java:143)
>    ...
>     at java.lang.Thread.run(Thread.java:536)
> Caused by: org.apache.turbine.util.TurbineException
>     at 
> org.apache.turbine.services.intake.TurbineIntakeService.getGro
> up(TurbineIntakeService.java:372)
>     at 
> org.apache.turbine.services.intake.TurbineIntake.getGroup(Turb
> ineIntake.java:85)
>     at 
> org.apache.turbine.services.intake.IntakeTool$PullHelper.setKe
> y(IntakeTool.java:258)
>     at 
> org.apache.turbine.services.intake.IntakeTool$PullHelper.setKe
> y(IntakeTool.java:243)
>     at 
> org.apache.turbine.services.intake.IntakeTool.get(IntakeTool.java:318)
>     at 
> fr.qualipse.qualiback.modules.actions.actu.AgendaAction.doCtrl
> (AgendaAction.java:133)
>     at 
> fr.qualipse.qualiback.modules.actions.actu.AgendaAction.doInse
> rt(AgendaAction.java:42)
> 
> Has anybody any idea ?
> 
> Are there any documentation about date format ?
> 
> Quinton McCombs wrote:
> 
> >Use the format rule instead of mask.  The format rule is 
> only for date 
> >fields.  It actually does validate the date.
> >
> >  
> >
> >>-----Original Message-----
> >>From: Xavier Ottolini [mailto:[EMAIL PROTECTED]]
> >>Sent: Thursday, January 16, 2003 8:00 AM
> >>To: turbine Users List
> >>Subject: group.setProperties throws an exception, how to get 
> >>the original e.getMessage ?
> >>
> >>
> >>Hi,
> >>
> >>I  use Intake to test the validity of my forms. Unfortunately, the
> >>regular expression is not enough efficient for testing dates. For 
> >>instance, the date "11/31/2003" (november, the 31th 2003) 
> >>does not exist.
> >>
> >>In the business object, a exception can be thrown is the date
> >>is false.
> >>     public void setJourD(String s ) throws TurbineException
> >>     {
> >>         try
> >>         {
> >>             super.setJour(DateFormater.stringToDate(s));
> >>         } catch (Exception e) {
> >>             throw new TurbineException("Jour doit respecter 
> >>le format : 
> >>(\"jj/mm/aaaa\") et donner un jour valide.",e);
> >>        }
> >>     }
> >>
> >>In the action class, the group is mapped to the bean. In 
> the followin
> >>code, entry is the bean and agendaGroup is the group.
> >>        try
> >>         {
> >>                    agendaGroup.setProperties(entry);
> >>        } catch (org.apache.turbine.util.TurbineException tex) {
> >>               
> >>        context.put("errorTemplate", tex.getMessage());
> >>                context.put("mode", mode);
> >>                data.getParameters().add("mode", mode);
> >>                setTemplate(data, "/actu/AgendaForm.vm");
> >>            return false;
> >>    }
> >>
> >>The problem is that the message tex.getMessage() of this turbine
> >>exception is not the same as the message os the business 
> >>object. Le message is "An exception prevented the mapping to 
> >>fr.qualipse.qualiback.om.Agenda@345b43".
> >>
> >>How can I avoid this and display the original message ?
> >>
> >>I would appreciate some help.
> >>
> >>
> >>--
> >>To unsubscribe, e-mail:   
> >><mailto:turbine-user-> [EMAIL PROTECTED]>
> >>For
> >>additional commands, 
> >>e-mail: <mailto:[EMAIL PROTECTED]>
> >>
> >>
> >>    
> >>
> >
> >--
> >To unsubscribe, e-mail:   
> <mailto:turbine-user-> [EMAIL PROTECTED]>
> >For 
> additional commands, 
> e-mail: 
> ><mailto:[EMAIL PROTECTED]>
> >
> >  
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:turbine-user-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to