This is a bug. A new release of the Java version is under development.
The plan is for both the Java and C++ versions to output dates in a format
like
abstime("2002-10-31T13:15:09")
In the meantime, if you are using the source distribution of Java classads,
the patch is simple. At line 238 of condor/classad/Constant.java, change
: value.toString(); // TODO: should be surrounded by '' ?
by
: ('\'' + value.toString() + '\'');
Alessandro Maraschini wrote:
> Hi all,
> We are using both java and c++ ClassAd package/library but we get into
> an inconsintence-like problem while managing time values.
> In C++ in fact a time value is represented as a string by single quotes
> (i.e. 'Fri Oct 25 13:37:26 2002 (CEST) 01:00') whilest in the Java
> package it seems to be implemented like a simple string without any
> quotation. This dual approach unfortunately causes to us serious problem
> because we're sending the classad string representation to a server who
> doesn't know which is the used language used. As far as you know is
> there any solution for this? is this going to be fixed or it has been
> done on purpose?
> here follows a simple example:
>
> C++ source:
>
> classad::ClassAd classAd ;
> classAd.Insert( "ATTRIBUTE" , Literal::MakeAbsTime( ) ) ;
> string buffer="";
> PrettyPrint unp;
> unp.Unparse(buffer, &classAd );
> cout << buffer;
>
> And the output is:
>
> [
> ATTRIBUTE = 'Thu Oct 31 14:15:09 2002 (CET) 01:00'
> ]
>
> Java Source:
>
> RecordExpr re = new RecordExpr() ;
> re.insertAttribute( "ATTRIBUTE" , (Expr) Constant.getInstance( new
> Date( ) ) );
> System.out.println( re) ;
>
> And the output is:
>
> [ ATTRIBUTE = Thu Oct 31 14:25:02 CET 2002 ]
>
> --
> =============================================================
> Alessandro Maraschini
> GRID R&D Group
> Defence, Space & Environment Division
> DATAMAT S.p.A.
> Via Laurentina, 760 -I- 00143 Rome - Italy
> http://www.datamat.it
> mailto:alessandro.maraschini@xxxxxxxxxx
> Phone: +39 06 5027 4501 (direct) +39 06 5027 4570 (secretary)
> Fax: +39 06 5027 4500
> =============================================================
>
>
Condor Classads Info:
http://www.cs.wisc.edu/condor/classad/
|