Hi all,

As a background, I'm trying to use GeoTools while excluding jai-core as 
a dependency.  This will likely be the required state of LocationTech 
projects using GeoTools.

I goofed testing Jody's initial solution to the problem after a final 
commit was added which used less reflection.  I definitely appreciate 
the goal of relying on reflection as little as possible, but it may be 
one of the easier solutions to this problem.

Anyhow, as I was testing, if a call to jai.setImagingListener is present 
without jai-core on the class path, then any calls into 
org.geotools.util.logging.Logging will throw an ClassNotFound for 
javax.media.jai.util.ImagingListener.*

As I see it, there are two options:

1.  Use reflection.  I pushed up a PR which does that here: 
https://github.com/geotools/geotools/pull/826.**

2.  Construct a second class (say JAILogging) which will have a static 
method to configure JAI.  In Logging.java, if Class.forName succeeds, 
delegate to a static method in that makes the actual call to 
setImagingListener.  I haven't tried this out, but it may work since the 
ClassLoader will never try to look for ImagingListener. Plus side, less 
reflection.  Downside, we'd have to be careful about calling that class 
from outside of a 'safe' scope.

Anyhow, I apologize for not testing correctly in the first place.

Thoughts?

Jim

* 
https://github.com/geotools/geotools/blob/master/modules/library/metadata/src/main/java/org/geotools/util/logging/Logging.java#L122

NB: I tried adding Class.forName("javax.media.jai.util.ImagingListener") 
and that didn't help.

Original PR: https://github.com/geotools/geotools/pull/731





------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to