Hmm I can answer my own question, java.sql.Date is a subclass of
java.util.Date ... sorry to all ....
Alberto A.Smulders
HostDat Lda. - Portugal
----- Original Message -----
From: "Alberto Smulders" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 19, 2006 8:27 PM
Subject: Re: Re: [ULC-developer] Exception calling static methodreturning
date
> Hmm I don't understand well... i'm importing from java.util.Date - so my
> Date returned by my static method is a java.util.Date, or am I wrong ???
>
> Before I had a (static) class to get the actual date from the machine
date,
> something like
>
> import java.util.Date;
> .....
> public static Date getToday() {
> Date d = new Date();
> // Code to strip time information from d ...
> return d;
> }
>
> and this code worked without problems....
>
> So where is really the difference?? Both methods supposedly return a
> java.util.Date value ....
>
> If someone can get me out of my doubts I will be happy....
>
> Kind regards,
>
> Alberto A. Smulders
> HostDat Lda. - Portugal
>
> ----- Original Message -----
> From: "Christoph Bucher" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, June 19, 2006 4:11 PM
> Subject: Re: Re: [ULC-developer] Exception calling static methodreturning
> date
>
>
> Hi Albert,
>
> it's not a bug of ULC 6.1, as explained in the two attachements I sent
> earlier to you and that are included here once more
> for the community. But probably Canoo might change the behaviour
concerning
> java.sql.Date, java.sql.Time and
> java.sql.Timestamp so that code like
>
> if (value != null) {
> if (value instanceof java.sql.Date | value instanceof java.sql.Time |
value
> instanceof java.sql.Timestamp) {
> value = new java.util.Date( ( (java.util.Date)value ).getTime() );
> }
> }
> fDate.setValue(value );
>
> is not required any more as was the case before ULC 6.1.
>
> Kind Regards
> Christoph
>
> >>> "Albert Smulders" <[EMAIL PROTECTED]> 19.06.2006 16:53 >>>
> Hi Christoph,
>
> Thank u very much, the following code resolved the problem:
>
> Date now = new java.util.Date(DataSistema.getDate().getTime());
> fDate.setValue(now);
>
> But I really start feeling uncomfortable about Canoo... a bit like VB 3
> where u had to spend many months finding out workarounds for rather a lot
of
> dirty bugs in the product (typically MS, their whole product line is
buggy,
> but we have nothing better for the moment as they have the whole public
> sector in their hands so we have no choice but program on their buggy
> platform if we want to earn a living), my productivity is very very much
> down..., not only learning how to use the product but also working my way
> through the known-bugs-list and finding out how to resolve many other
> problems... Like the datetype bug on textfields in VE, I asked for an
> interim version of VE but more than a week later nothing in sight, I think
> it must be small effort from Canoo to bring out a patch version without
this
> kind of bugs that break completely existing code... hmm same same here in
> hospital if I tell the doctors wait 6 months until next release of my
> software before you can see x-ray images again on your browser, i think I
> would be watching the street before ending June :)))
>
> So it's my opinion (I would like to trade for a better one), Canoo should
> launch more interim bug-solving versions, the product is expensive enough
to
> expect something better. I'm not an experienced Java programmer still, but
> with over 25 years programming experience (starting with Algol 60 at
> Eindhoven Technical University ending 80's), I think I can express this
> concerns....
>
> Kind regards,
>
> Alberto A.Smulders
> HostDat Lda. - Portugal
>
>
>
> -------- Original-Nachricht --------
> Datum: Mon, 19 Jun 2006 14:28:59 +0200
> Von: Christoph Bucher <[EMAIL PROTECTED]>
> An: [EMAIL PROTECTED]
> Betreff: Re: [ULC-developer] Exception calling static method returning
date
>
> > Hi Albert,
> >
> > I posed the same question a few weeks ago, cf. the attached answers from
> > Canoo. In my code I had to do
> > the following modification:
> >
> > if (value != null) {
> > if (value instanceof java.sql.Date) value = new
java.util.Date(
> > ( (java.sql.Date)value ) .getTime() );
> > else if (value instanceof java.sql.Time) value = new
java.util.Date(
> > ( (java.sql.Time)value ) .getTime() );
> > else if (value instanceof java.sql.Timestamp) value = new
java.util.Date(
> > ( (java.sql.Timestamp)value ).getTime() );
> > }
> > ((ULCTextField)getGuiComponent() ).setValue(value);
> >
> > Kind regards
> > Christoph
> >
> > >>> "Albert Smulders" <[EMAIL PROTECTED]> 19.06.2006 14:02 >>>
> > Hi,
> >
> > I have the following static method in a class to read out the actual
date
> > (= database sysdate, not the date configured in the client machine or on
> > the server):
> >
> > package pt.hostdat.hcc.uci.database.sonho;
> >
> > import static pt.hostdat.hcc.uci.database.sonho.IConstants.JNDI;
> > import static pt.hostdat.hcc.uci.database.sonho.IConstants.PROP;
> >
> > import java.io.Serializable;
> > import java.sql.Connection;
> > import java.sql.ResultSet;
> > import java.sql.SQLException;
> > import java.sql.Statement;
> > import java.util.Date;
> >
> > import pt.hostdat.hcc.common.database.DAOException;
> > import pt.hostdat.hcc.common.database.DatabaseConnectionProvider;
> > import pt.hostdat.hcc.common.util.Util;
> >
> > /**
> > * Utility class to read out SYSDATE.
> > *
> > * @author Alberto Smulders
> > */
> > public class DataSistema implements Serializable {
> > public static Date getDate() {
> > Date sysdate = null;
> > Connection conn = null;
> >
> > try {
> > String sql = " select trunc(SYSDATE) TODAY from DUAL";
> > DatabaseConnectionProvider connProvider =
> > new DatabaseConnectionProvider(JNDI, PROP);
> > conn = connProvider.getConnection();
> > conn.setAutoCommit(false);
> > Statement statement = conn.createStatement();
> > ResultSet resultSet = statement.executeQuery(sql);
> > if (resultSet.next()) {
> > sysdate = resultSet.getDate("TODAY");
> > System.out.println(sysdate);
> > }
> > resultSet.close();
> > statement.close();
> > conn.close();
> > }
> > catch (DAOException e) {
> > Util.showFatalErrorMsg("Erro fatal: " + e.getMessage());
> > }
> > catch (SQLException e) {
> > Util.showFatalErrorMsg("Erro fatal: " + e.getMessage());
> > }
> > finally {
> > if (conn != null) {
> > try {
> > conn.close();
> > }
> > catch (SQLException ex) {
> > }
> > }
> > }
> >
> > return sysdate;
> > }
> > }
> >
> >
> >
> > I use the class in a form:
> >
> > public void initialize() {
> > // ... other code ...
> > fDate.setValue(DataSistema.getDate());
> > }
> >
> >
> > And I get the following result:
> >
> > 2006-06-19
> > 1 19.06.2006 12:50:23.843 1.000 SEVERE Thread[ULC Communication
> > Controller Thread,6,main] com.ulcjava.base.client.UISession$k_ run
> exception
> > occured [com.ulcjava.base.client.ConnectorException: error while sending
> requests
> > at
> >
>
com.ulcjava.base.development.DevelopmentConnector.sendRequests(DevelopmentCo
> nnector.java:33)
> > at com.ulcjava.base.client.UISession$k_.run(UISession$k_.java:19)
> > at java.lang.Thread.run(Unknown Source)
> > Caused by: com.ulcjava.base.shared.internal.IllegalArgumentException: No
> > coder registered for class java.sql.Date
> > at
> >
>
com.ulcjava.base.shared.internal.UlcObjectOutputStream.a(UlcObjectOutputStre
> am.java:131)
> > at
> >
>
com.ulcjava.base.shared.internal.UlcObjectOutputStream.writeObject(UlcObject
> OutputStream.java:104)
> > at
> >
>
com.ulcjava.base.shared.internal.UlcObjectOutputStream.writeObject(UlcObject
> OutputStream.java:39)
> > at
> >
>
com.ulcjava.base.shared.internal.UlcObjectOutputStream.writeObject(UlcObject
> OutputStream.java:39)
> > at
> >
>
com.ulcjava.base.shared.streamcoder.CollectionCoder.writeObject(CollectionCo
> der.java:5)
> > at
> >
>
com.ulcjava.base.shared.internal.UlcObjectOutputStream.writeObject(UlcObject
> OutputStream.java:31)
> > at
> >
com.ulcjava.base.shared.streamcoder.MapCoder.writeObject(MapCoder.java:18)
> > at
> >
>
com.ulcjava.base.shared.internal.UlcObjectOutputStream.writeObject(UlcObject
> OutputStream.java:31)
> > at
> >
>
com.ulcjava.base.shared.streamcoder.AnythingCoder.writeObject(AnythingCoder.
> java:5)
> > at
> >
>
com.ulcjava.base.shared.internal.UlcObjectOutputStream.writeObject(UlcObject
> OutputStream.java:31)
> > at
> >
com.ulcjava.base.shared.streamcoder.MapCoder.writeObject(MapCoder.java:18)
> > at
> >
>
com.ulcjava.base.shared.internal.UlcObjectOutputStream.writeObject(UlcObject
> OutputStream.java:31)
> > at
com.ulcjava.base.shared.internal.Request.writeRequests(Request.java:2)
> > at
> >
>
com.ulcjava.base.development.DevelopmentConnector.a(DevelopmentConnector.jav
> a:36)
> > at
> >
>
com.ulcjava.base.development.DevelopmentConnector.sendRequests(DevelopmentCo
> nnector.java:32)
> > at com.ulcjava.base.client.UISession$k_.run(UISession$k_.java:19)
> > at java.lang.Thread.run(Unknown Source)
> > ]
> >
> >
> > As you can see, the sysdate value is correctly retrieved from the
(Oracle)
> > database...
> >
> > Some hints what might be wrong?
> >
> > Kind regards,
> >
> > Alberto A.Smulders
> > HostDat Lda. - Portugal
> > --
> >
> >
> > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> > _______________________________________________
> > ULC-developer mailing list
> > [email protected]
> > http://lists.canoo.com/mailman/listinfo/ulc-developer
>
> --
>
>
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> _______________________________________________
> ULC-developer mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/ulc-developer
>
> _______________________________________________
> ULC-developer mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/ulc-developer
>
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer