Martin Desruisseaux wrote: > Jody Garnett a écrit : >> In every case we were either directly returning the object provided >> by the no argument constructor, or we were producing a >> FactoryNotFoundException - at which point the later code would not >> work either (as it needs the no argument constructor to work so it >> gets an object back in order to get a Class to perform reflection on). > This is true - a no-argument constructor must exists and the factory > must be registered in the META-INF/services/ directory in order to > work. The no-argument constructor should provides default hints for > the most common (or most "strict") cases. > > It will not prevent the GeometryFactory(Hints) constructor to be > invoked later, because FactoryRegistry should detect that the > GeometryFactory created with the no-arg constructor don't have > 'Factory.getImplementationHints()' matching user's request. So that is what is supposed to throw the FactoryNotFoundException exception? I hate seeing exceptions used for flow of control? Seriously is that what is expected to happen? Or am I reading the code wrong? > > and we have begun adding the Hints constructors to > PrimitiveFactoryImpl in the unsupported gometry module. > > I see a problem in PrimitiveFactoryImpl. The no-argument constructor > do not put anything in the hintsWeUsed map. Consequently, > ReferencingFactory believes that PrimitiveFactoryImpl do not care > about any hints, so the PrimitiveFactoryImpl instance is always > suitable no matter what are user hints. > > Suggested fix: > > * Rename "hintsWeUsed" by "hintsWeCareAbout" or something like that; > this is not the same thing. I see, so we need to indicate what assumptions were made by default; so the FactoryRegistry can detect that we ignored the user provided hints? > The important point is that the PrimitiveFactoryImpl() constructor > must put, directly or indirectly, some Hints.CRS and Hints.WHATEVER > keys in the "hintsWeCareAbout" map, no matter if the value are null or > anything else. So I am still missing the step where this inconsistency is discovered? Can you confirm that we *must* expect a FactoryNotFoundException to be thrown at the start of FactoryCreator.getServiceProvider (where it calls super?).
Jody ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
