Hi Gill,

I can't see anything out of place when looking over this. To make it easier to track down the problem and see if it's a bug, could you try to isolate it as a minimal test case and send me all the code that's needed to run it?

Thanks,

Geert

On 22 Aug 2006, at 15:43, Gill, Huibert wrote:

Sure:

BEAN Code:
(Please note: the createDate and lastChangeDate are auto generated and work, the Problem is the "buchungsDatum" and "belegDatum" fields)



@SuppressWarnings("unchecked")
public class BuchungsKopf extends MetaData {
        public static final String VAL_GROUP_BUCHUNG_DATUM = "BUCHUNG_DATUM";
        
        public static final String PROP_BUCHUNGS_KREIS = "buchungsKreis";

        public static final String PROP_BUCHUNGS_DATUM = "buchungsDatum";
        private int id = -1;
        private int konfigBukokoid;
        private String creatorName = "anon";
private Timestamp createDate = new Timestamp (System.currentTimeMillis()); private Timestamp lastCangeDate = new Timestamp (System.currentTimeMillis());
        private int buchungsStatus;
        private String belegArt;
        private int buchungsPeriode;
        private int buchungsKreis;
        private int geschaeftsJahr;
        private Date buchungsDatum;
        private Date belegDatum;
        private String waehrung;
        private String text;
        private String referenz;
        private boolean steuerRechnen;
        private String name;
        private String strasse;
        private String portfach;
        private String portfachPlz;
        private String ort;
        private String plz;
        private String land;
        private String blz;
        private String bankLand;
        private String bankKontoNr;
        
        public void activateMetaData() {
addConstraint(new ConstrainedProperty("id").notNull (true).identifier(true).editable(false)); addConstraint(new ConstrainedProperty("konfigBukokoid").notNull (true).manyToOne(BuchungsKopfKonfig.class, "id", null, CreateTable.CASCADE).editable(false)); addConstraint(new ConstrainedProperty("creatorName").maxLength (50).listed(true).editable(false)); addConstraint(new ConstrainedProperty("createDate").editable (false)); addConstraint(new ConstrainedProperty("lastCangeDate").editable (false));
                
                addConstraint(new ConstrainedProperty("belegArt").maxLength(2));
addConstraint(new ConstrainedProperty("buchungsPeriode").inList (Vwk2KonfigIF.BUCHUNGS_PERIODEN)); addConstraint(new ConstrainedProperty (PROP_BUCHUNGS_KREIS).rangeBegin(1));
                addConstraint(new ConstrainedProperty("waehrung").maxLength(5));
                addConstraint(new ConstrainedProperty("text").maxLength(25));
                addConstraint(new 
ConstrainedProperty("referenz").maxLength(16));
                
                addConstraint(new ConstrainedProperty("name").maxLength(35));
                addConstraint(new ConstrainedProperty("strasse").maxLength(35));
                addConstraint(new 
ConstrainedProperty("portfach").maxLength(10));
                addConstraint(new 
ConstrainedProperty("portfachPlz").maxLength(10));
                addConstraint(new ConstrainedProperty("ort").maxLength(35));
                addConstraint(new ConstrainedProperty("plz").maxLength(10));
                addConstraint(new ConstrainedProperty("land").maxLength(3));
                addConstraint(new ConstrainedProperty("blz").maxLength(15));
                addConstraint(new ConstrainedProperty("bankLand").maxLength(3));
                addConstraint(new 
ConstrainedProperty("bankKontoNr").maxLength(18));
                
addConstraint(new ConstrainedProperty("belegDatum").format (Vwk2KonfigIF.INPUT_DATE_FORMAT_DOTS)); addConstraint(new ConstrainedProperty(PROP_BUCHUNGS_DATUM).format (Vwk2KonfigIF.INPUT_DATE_FORMAT_DOTS));

                
        }       
}


The Date Format:

public class Vwk2KonfigIF {
        ....
public static final Format INPUT_DATE_FORMAT_DOTS = new SimpleDateFormat("dd.MM.yyyy");
        ....
}


Sourcecode:: Element:BuchungsKopfEdit:
The form post gets handled by "doAlterBuKo()", which runs into processElement() because the bean is not validated


public class BuchungsKopfEdit extends AbstractVwk2Element {


        private Template htmlTemplate = null;
        private ContentQueryManager<BuchungsKopf> manager = null;
        private BuchungsKopf currentBuchungsKopf = null;

        public void initialize() {
Datasource datasource = getPropertyTyped (Vwk2KonfigIF.DATASOURCE_NAME, Datasource.class); manager = new ContentQueryManager<BuchungsKopf>(datasource, BuchungsKopf.class);
        int bukokoId = getInputInt(Vwk2KonfigIF.PARAM_BUKOKO_ID);
        System.out.println("Booking Konfig id: " + bukokoId);
        BuchungsKopf curBuKoKo = new BuchungsKopf();
        curBuKoKo.setKonfigBukokoid(bukokoId);
        curBuKoKo.setCreatorName(getUserName());
        currentBuchungsKopf = curBuKoKo;
                htmlTemplate  = getHtmlTemplate("buchen.buchungskopf");
Vwk2SelectBoxHelper.addBuchungBuchungsKreisSelect(this, htmlTemplate, currentBuchungsKopf, BuchungsKopf.PROP_BUCHUNGS_KREIS);

        }






        @Override
        public void processElement() throws EngineException {
        int bukokoId = getInputInt(Vwk2KonfigIF.PARAM_BUKOKO_ID);
        setOutput(Vwk2KonfigIF.PARAM_BUKOKO_ID, bukokoId);
String statusMessage = getInput (Vwk2KonfigIF.PARAM_STATUS_MESSAGE);
        if (null != statusMessage) {
htmlTemplate.setValue(Vwk2KonfigIF.PARAM_STATUS_MESSAGE, statusMessage);
                clearOutput(Vwk2KonfigIF.PARAM_STATUS_MESSAGE);
        }
System.out.println("current Buchuingsdate: " + currentBuchungsKopf.getBuchungsDatum());
                generateForm(htmlTemplate, currentBuchungsKopf);
                print(htmlTemplate);
        }

        public void doAlterBuKo(){
                fillSubmissionBean(currentBuchungsKopf);
                if ( ((Validated) currentBuchungsKopf).validate() ) {
currentBuchungsKopf.setLastCangeDate(new Timestamp (System.currentTimeMillis()));
                        if (currentBuchungsKopf.getId() > 0) {
setOutput(Vwk2KonfigIF.PARAM_STATUS_MESSAGE, "Buchungs Kopf wurde erfolgreich geändert");
                        } else {
setOutput(Vwk2KonfigIF.PARAM_STATUS_MESSAGE, "Buchungs Kopf wurde erfolgreich hinzugefügt");
                        }
                        manager.save(currentBuchungsKopf);
                        exit("list");
                } else {
                        System.out.println("Fehler in der Eingabe..");
                        ValidationBuilderXhtml builder = new 
ValidationBuilderXhtml();
builder.generateErrorMarkings(htmlTemplate, ((Validated) currentBuchungsKopf).getValidationErrors(), null, null);
                        ValidationBuilderXhtml marksBuilder = new 
ValidationBuilderXhtml();
marksBuilder.generateErrorMarkings(htmlTemplate, ((Validated) currentBuchungsKopf).getValidationErrors(), null, null);
                        processElement();
                }
        }
        
}




Stack trace:

SCHWERWIEGEND: Error on host localhost:8080//vwk2
com.uwyn.rife.engine.exceptions.EngineException: java.lang.IllegalArgumentException: Cannot format given Object as a Date at com.uwyn.rife.engine.ElementContext.processContext (ElementContext.java:464)
        at com.uwyn.rife.engine.RequestState.service(RequestState.java:350)
        at com.uwyn.rife.engine.Gate.handleRequest(Gate.java:421)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.uwyn.rife.servlet.RifeFilter.doFilter(RifeFilter.java:142)
at org.mortbay.jetty.servlet.WebApplicationHandler $CachedChain.doFilter(WebApplicationHandler.java:821) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch (WebApplicationHandler.java:471) at org.mortbay.jetty.servlet.ServletHandler.handle (ServletHandler.java:568)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.jetty.servlet.WebApplicationContext.handle (WebApplicationContext.java:633)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
        at org.mortbay.http.HttpServer.service(HttpServer.java:909)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java: 982)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
at org.mortbay.http.SocketListener.handleConnection (SocketListener.java:244)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: java.lang.IllegalArgumentException: Cannot format given Object as a Date
        at java.text.DateFormat.format(DateFormat.java:279)
        at java.text.Format.format(Format.java:133)
at com.uwyn.rife.tools.BeanUtils.formatPropertyValue (BeanUtils.java:485) at com.uwyn.rife.tools.ArrayUtils.createStringArray (ArrayUtils.java:115) at com.uwyn.rife.site.FormBuilderXhtml.generateForm (FormBuilderXhtml.java:155) at com.uwyn.rife.site.FormBuilderXhtml.generateForm (FormBuilderXhtml.java:65) at com.uwyn.rife.engine.ElementContext.generateForm (ElementContext.java:3100) at com.uwyn.rife.engine.ElementSupport.generateForm (ElementSupport.java:4827) at com.uwyn.rife.engine.ElementSupport.generateForm (ElementSupport.java:4795) at de.metro.kws.vwk2.elements.user.buchen.BuchungsKopfEdit.processElement (BuchungsKopfEdit.java:53) at de.metro.kws.vwk2.elements.user.buchen.BuchungsKopfEdit.doAlterBuKo (BuchungsKopfEdit.java:74)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
at com.uwyn.rife.engine.ElementContext.processContext (ElementContext.java:450)
        ... 20 more








I hope it helps...


-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Geert Bevin
Gesendet: Dienstag, 22. August 2006 15:09
An: RIFE users list : questions,bug reports and suggestions.
Betreff: Re: [Rife-users] Dateformat and Generate Form

Hi Gill,

can you please include your full stack trace and the source code of
that bean?

Thanks,

Geert

On 22 Aug 2006, at 14:58, Gill, Huibert wrote:

Hello,

I got a problem using Validation with Dateformat and the
generateForm() in my Element.

I have a simple Bean with som text, number and a date fields.

If the submitted Bean is not Valid, I will generate the
errors, and
the Markers in the Template.
Then a generataForm() is called to regenerate the form.

This works pretty well for all Fields, except for Datefields.
If I submit a wrongly formated Date (or a bogus word) the method
call for generateForm() throws an Exception "Cannot format given
Object as a Date"

Funny thing is that if a submit a word in a number field,
the error
markings are generated correctly, and the generateForm() does not
throw an exception.


My problem here is, that if I submit a wrong date, all other form
info (hidden fields, select boxes) are not generated either.

Is there a way to set the "wrong" Date to a NULL value or
something
similar?


Mit freundlichen Grüßen / With kind regards

Huibert Gill
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to