You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Brendan Miller <bm...@dotster.com> on 2007/11/26 17:49:41 UTC

BigDecimal(Double.doubleValue()) patch for Village

I don't know about anyone else, but the Village trunk does not compile
here.  You cannot instantiate a BigDecimal from a Double directly.

A small contribution, I know, but I am trying to resolve the Village/Oracle DATE 
issues I brought up last week on torque-user myself.

Here is the patch:

Index: src/java/com/workingdogs/village/Value.java
===================================================================
--- src/java/com/workingdogs/village/Value.java (revision 598338)
+++ src/java/com/workingdogs/village/Value.java (working copy)
@@ -383,7 +383,7 @@
                 return (BigDecimal) valueObject;
             }
             else if ( isDouble() ) {
-                return new BigDecimal((Double) valueObject );
+                return new BigDecimal(((Double) valueObject).doubleValue());
             }
             else if ( isFloat() ) 
             {
@@ -428,7 +428,7 @@
             }
             else if ( isDouble() )
             {
-                return new BigDecimal((Double) valueObject ).setScale(scale);
+                return new BigDecimal(((Double) valueObject).doubleValue()).setScale(scale);
             } 
             else if ( isFloat() ) 
             {


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


RE: BigDecimal(Double.doubleValue()) patch for Village

Posted by Greg Monroe <Gr...@DukeCE.com>.
D'oh... 
<Smacks forehead for not doing build outside Eclipse prior to 
check-in> 

Good catch... the BigDecimal(Double) constructor is a JVM >= 1.5 
enhancement.. and it was such a simple little patch and compiled 
fine in Eclipse (which I forgot was using 1.5 JVM rules)...So, I 
didn't do my normal external build test... <sigh>

Mea Culpa.. source will be fixed in a few.

> -----Original Message-----
> From: Brendan Miller [mailto:bmiller@dotster.com] 
> Sent: Monday, November 26, 2007 11:50 AM
> To: torque-dev@db.apache.org
> Subject: BigDecimal(Double.doubleValue()) patch for Village
> 
> 
> I don't know about anyone else, but the Village trunk does 
> not compile here.  You cannot instantiate a BigDecimal from a 
> Double directly.
> 
> A small contribution, I know, but I am trying to resolve the 
> Village/Oracle DATE issues I brought up last week on 
> torque-user myself.
> 
> Here is the patch:
> 
> Index: src/java/com/workingdogs/village/Value.java
> ===================================================================
> --- src/java/com/workingdogs/village/Value.java (revision 598338)
> +++ src/java/com/workingdogs/village/Value.java (working copy)
> @@ -383,7 +383,7 @@
>                  return (BigDecimal) valueObject;
>              }
>              else if ( isDouble() ) {
> -                return new BigDecimal((Double) valueObject );
> +                return new BigDecimal(((Double) 
> + valueObject).doubleValue());
>              }
>              else if ( isFloat() ) 
>              {
> @@ -428,7 +428,7 @@
>              }
>              else if ( isDouble() )
>              {
> -                return new BigDecimal((Double) valueObject 
> ).setScale(scale);
> +                return new BigDecimal(((Double) 
> + valueObject).doubleValue()).setScale(scale);
>              } 
>              else if ( isFloat() ) 
>              {
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org