• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem re-executing adaptor operations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem re-executing adaptor operations


  • Subject: Re: Problem re-executing adaptor operations
  • From: Jean-Francois Veillette <email@hidden>
  • Date: Fri, 19 Feb 2010 13:22:02 -0500

To fix it I had to overwrite the validator "validatePourcentageEstime(Object o)" and set the scale of the BigDecimal received.
I tought that my formatter was doing enough, defined like so:
DecimalFormat formatPourcent = formatPourcent = new DecimalFormat("0.0");
formatPourcent.setMinimumFractionDigits(2);
formatPourcent.setMultiplier(100);
formatPourcent.setMaximumFractionDigits(4);


I'm sure I miss something and doesn't need to overwrite validatePourcentageEstime, how do you do ?

Ah ha! That formatter is NOT doing what you think it is:

From the JavaDocs:
Currently, the only classes that parse returns are Long and Double, but callers should not rely on this.

It is returning a Double and KVC (or EOF?) is creating from that. You either need to to set the scale in the validate method, or create a BigDecimalFormat that does the right thing. So that explains why you were getting the SQL error.


Is it changed in java 1.6 ? because in 1.5:
http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html#parse(java.lang.String, java.text.ParsePosition)
in the parse definition we have:
• If isParseBigDecimal() is true, values are returned as BigDecimal objects. The values are the ones constructed by BigDecimal.BigDecimal(String) for corresponding strings in locale- independent format. The special cases negative and positive infinity and NaN are returned as Double instances holding the values of the corresponding Double constants.


I'll first try to add:
	formatPourcent.setParseBigDecimal(true);
and if it doesn't work, I'll keep the validate method.

Thanks again for the pointer !

- jfv


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Problem re-executing adaptor operations
      • From: Chuck Hill <email@hidden>
References: 
 >Probleme re-executing adaptor operations (From: Jean-Francois Veillette <email@hidden>)
 >Re: Probleme re-executing adaptor operations (From: Chuck Hill <email@hidden>)
 >Re: Probleme re-executing adaptor operations (From: Jean-Francois Veillette <email@hidden>)
 >Re: Problem re-executing adaptor operations (From: Chuck Hill <email@hidden>)
 >Re: Problem re-executing adaptor operations (From: Jean-Francois Veillette <email@hidden>)
 >Re: Problem re-executing adaptor operations (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Problem re-executing adaptor operations
  • Next by Date: Re: Problem re-executing adaptor operations
  • Previous by thread: Re: Problem re-executing adaptor operations
  • Next by thread: Re: Problem re-executing adaptor operations
  • Index(es):
    • Date
    • Thread