Geotoolkit

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

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 3.00, 3.01
  • Fix Version/s: 3.02
  • Component/s: Referencing
  • Labels:

Description

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:

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)

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:

FactoryFinder.setVendorOrdering("Geotoolkit.org", "GeoTools");

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.

Activity

Hide
Martin Desruisseaux added a comment - 12/Jul/2009 19:29

Fix tested with a "pseudo-GeoTools DatumFactory implementation", which is part of the test suite for avoiding regression. Not tested with a real GeoTools implementation however...

Show
Martin Desruisseaux added a comment - 12/Jul/2009 19:29 Fix tested with a "pseudo-GeoTools DatumFactory implementation", which is part of the test suite for avoiding regression. Not tested with a real GeoTools implementation however...

People

Vote (0)
Watch (0)

Dates

  • Created:
    22/Jun/2009 17:09
    Updated:
    13/Apr/2011 15:27
    Resolved:
    13/Apr/2011 15:27

Time Tracking

Estimated:
1h
Original Estimate - 1 hour
Remaining:
1h
Remaining Estimate - 1 hour
Logged:
Not Specified
Time Spent - Not Specified