+1 for Mel's words of caution Also have to be careful that this doesn't prevent parsing PDFs. It'd be a shame to not be able to view a PDF because of a single value somewhere which is invalid. Not to say the setter couldn't throw an exception and the parser could catch and log it, but just something to keep in mind.
--Adam From: "Martinez, Mel - 1004 - MITLL" <[email protected]> To: "[email protected]" <[email protected]> Date: 02/24/2010 09:00 Subject: RE: Check for allowed values in setters? I would offer a caution here. Validation of data needs to consider the whole system. No validation is an obvious problem. Bad data --> bad results. But redundant validation is also a problem for a few reasons. Redundant validation happens when data flows through a system and gets validated for correctness at multiple points. Not only is this vulnerable to inconsistent validation rules but also a potential performance drain. Suppose a piece of data gets inserted into the system, applied to a setter and validated before entry into a dictionary. Then later gets copied from that same dictionary with a getter and then applied to another setter, perhaps on another object - do we validate it again? The general rule of thumb is to validate as close to the source of input as possible so that the corrective responses are most appropriate / contextual with the way the data is input. So this is not a disagreement, but rather a caution. We just spent a phase a couple of months ago completely refactoring our data validation model to address these very sorts of problems, so it is an issue that is fresh on my mind. -----Original Message----- From: Daniel Wilson [mailto:[email protected]] Sent: Wednesday, February 24, 2010 10:29 AM To: [email protected] Subject: Re: Check for allowed values in setters? IMO, checking for legal values is absolutely the right idea. Daniel On Wed, Feb 24, 2010 at 3:56 AM, Johannes Koch < [email protected]> wrote: > Hi, > > when adding features to the current PDFBox code, I sometimes wonder whether > it would be a good thing to check for correct values in setters. E.g. the DL > in a stream dictionary must be a non-negative integer according to PDF > 32000-1:2008. In some dictionaries some entries only allow values from a > list of defined values. > > pro: PDFBox will create proper PDF > > contra: this may be restricted to one PDF version and needs to be updated > if the value definition changes from spec to spec > > -- > Johannes Koch > Fraunhofer Institute for Applied Information Technology FIT > Web Compliance Center > Schloss Birlinghoven, D-53757 Sankt Augustin, Germany > Phone: +49-2241-142628 Fax: +49-2241-142065 > ? Click here to submit conditions This email and any content within or attached hereto from Sun West Mortgage Company, Inc. is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this email. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this email information is strictly prohibited, and that the documents should be returned to this office immediately by email. Receipt by anyone other than the intended recipient is not a waiver of any privilege. Please do not include your social security number, account number, or any other personal or financial information in the content of the email. Should you have any questions, please call (800) 453 7884.
