[geotk] [JIRA] Created: (GEOTK-17) Having GeoTools and Geotoolkit together on the classpath cause an infinite loop

Martin Desruisseaux (JIRA) jira at geomatys.com
Mon Jun 22 11:11:53 EDT 2009


Having GeoTools and Geotoolkit together on the classpath cause an infinite loop
-------------------------------------------------------------------------------

                 Key: GEOTK-17
                 URL: http://jira.geotoolkit.org/browse/GEOTK-17
             Project: Geotoolkit
          Issue Type: Bug
          Components: Referencing
    Affects Versions: 3.00, 3.01
            Reporter: Martin Desruisseaux
            Assignee: Martin Desruisseaux
            Priority: Critical
             Fix For: 3.01


Having GeoTools and Geotoolkit.org together on the classpath cause recursive method calls until {{StackTraceOverflow}}. The stack trace shows a mix of {{org.geotools}} and {{org.geotoolkit}} packages, as in the example below:

{noformat}
at org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)
at org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)
at org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)
at org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)
at org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)
{noformat}

This is caused by the {{CRSFactory}} being found dynamically at runtime, rather than being statically referenced at compile-time. More specifically both GeoTools ans Geotk define a {{DatumFactory}} (the one which manage aliases) looking for an other {{DatumFactory}} (the one which know nothing about aliases), both of them having speclal check for avoiding infinite loop with themself, but none of them prepared to live with an other implementation applying the same strategy.

We could make the above-cited "special check" more sophesticated in Geotk, but it would not prevent a similar problem to occur in GeoTools unless the GeoTools code is also patched in the same way. A better approach may be to prevent the implementations to be mixed up at the {{FactoryFinder}} level, which actually is already possible. Both Geotk and GeoTools have a {{FactoryFinder.setVendorOrdering(...)}} method:

http://www.geotoolkit.org/apidocs/org/geotoolkit/factory/FactoryFinder.html#setVendorOrdering(java.lang.String,%20java.lang.String)

So Geotk should call at some point:

{code:java}
FactoryFinder.setVendorOrdering("Geotoolkit.org", "GeoTools");
{code}

while GeoTools may want to do the same method call with the arguments in reverse order. It should be suffisient for preventing random mixes. This JIRA issue is mostly about adding the above-method call in some initialization point and make sure that it works.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.geotoolkit.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


More information about the Geotoolkit mailing list