Morning, > Hi, > > I'm getting trapped by validation. Thing being that AttributeImpl constructor > calls Types.validate(this, getValue()), which fails to validate, for example, > a double value. > Well you getting trapped is an improvement; it used to be that any restriction was fatal. > Example: > I've inserted a double attribute in sde with the value 0.7 > The attribute has a length "restriction" (aka, Filter) of 15. > Now, when I fetch the attribute from the database, it's 0.700000000000001, > hence the validation fails. > I seem to recall that .7 is an irrational number in binary and as such rounding is always a bit mad.
GeoServer sets a maximum number of digest flag somewhere; worst case you are going to have to provide that as a global hint and use it in the property converter when we go from double to string in order to check length. > Question is: > - does anybody got trapped in the same way? how to solve it? > Nope this is new code we are throwing around; so you are one of the first people to try it. > - should I check the attribute content is valid before creating the Attribute? > No. We have turned on validation early and often right now - when you create something it will often be validated twice already by the framework. That won't help you right now with .7 but at the very least it should help you not call validation code yourself. Here is where we have a difference of library direction: - During the transition we have the factory and the builder validating! The idea is we wanted exactly the same behavior as before and as much catching of errors as we could. - When 2.5.0 goes out I want to turn off the validation during creation; and let applications (please!) work with invalid data. Client code can check validation on their own; but we are going to treat our features as nice stupid data objects as often as we can. Because if we cannot represent invalid data how the heck are we ever going to fix it? > - should that kind of validation not occur at all when fetching data, but > just > when inserting/modifying? > Correct; so I call the validation code when the user is typing something. > hrmmm... > If you need to see how to hack around validation check out the WFS module where I make a factory that does not validate and then avoid the use of the builder. At the end of the day I want to have a range of options for people to program with (so they can configure themselves for STRICT behavior if needed). Enjoy; Jody ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
