Permalink
Browse files

Fix classpath issues related to SVG rendering

  • Loading branch information...
1 parent 7cac8b6 commit b73a027baf197cbad8f68af3a4a7cef09e03fa6f @VWoeltjen VWoeltjen committed Nov 29, 2012
View
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry excluding="M2_REPO/batik/batik-awt-util/1.6/|M2_REPO/batik/batik-bridge/1.6/|M2_REPO/batik/batik-css/1.6/|M2_REPO/batik/batik-dom/1.6/|M2_REPO/batik/batik-ext/1.6/|M2_REPO/batik/batik-gvt/1.6/|M2_REPO/batik/batik-parser/1.6/|M2_REPO/batik/batik-script/1.6/|M2_REPO/batik/batik-svg-dom/1.6/|M2_REPO/batik/batik-swing/1.6/|M2_REPO/batik/batik-util/1.6/|M2_REPO/batik/batik-xml/1.6/|M2_REPO/xerces/xercesImpl/2.5.0/" including="META-INF/" kind="src" path=""/>
+ <classpathentry excluding="M2_REPO/batik/batik-awt-util/1.6/|M2_REPO/batik/batik-bridge/1.6/|M2_REPO/batik/batik-css/1.6/|M2_REPO/batik/batik-dom/1.6/|M2_REPO/batik/batik-ext/1.6/|M2_REPO/batik/batik-gvt/1.6/|M2_REPO/batik/batik-parser/1.6/|M2_REPO/batik/batik-script/1.6/|M2_REPO/batik/batik-svg-dom/1.6/|M2_REPO/batik/batik-swing/1.6/|M2_REPO/batik/batik-util/1.6/|M2_REPO/batik/batik-xml/1.6/|M2_REPO/xerces/xercesImpl/2.5.0/|M2_REPO/xml-apis/xml-apis/1.3.04/" including="META-INF/" kind="src" path=""/>
+ <classpathentry including="*.jar" kind="src" path="M2_REPO/xml-apis/xml-apis/1.3.04"/>
<classpathentry including="*.jar" kind="src" path="M2_REPO/xerces/xercesImpl/2.5.0"/>
<classpathentry including="*.jar" kind="src" path="M2_REPO/batik/batik-svg-dom/1.6"/>
<classpathentry including="*.jar" kind="src" path="M2_REPO/batik/batik-css/1.6"/>
@@ -7,10 +7,7 @@ Export-Package: org.apache.batik.bridge,
org.apache.batik.gvt,
org.apache.batik.gvt.renderer,
org.apache.batik.swing.gvt,
- org.apache.batik.swing.svg,
- org.apache.xerces.parsers,
- org.xml.sax,
- org.w3c.dom.svg
+ org.apache.batik.swing.svg
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
DynamicImport-Package: *
Bundle-ClassPath: batik-swing-1.6.jar,
@@ -17,7 +17,6 @@ Import-Package: gov.nasa.arc.mct.api.feed;version="1.1.0",
org.apache.batik.gvt.renderer,
org.apache.batik.swing.gvt,
org.apache.batik.swing.svg,
- org.osgi.framework;version="1.4.0",
- org.w3c.dom.svg
+ org.osgi.framework;version="1.4.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Service-Component: OSGI-INF/services.xml
@@ -77,8 +77,12 @@
public SVGRasterizer(String documentURL) {
UserAgent userAgent = new UserAgentAdapter();
SVGDocumentLoader loader = new SVGDocumentLoader(documentURL,
- new DocumentLoader(userAgent));
- loader.addSVGDocumentLoaderListener(new SVGRasterizerListener());
+ new DocumentLoader(userAgent));
+ loader.addSVGDocumentLoaderListener(new SVGRasterizerListener());
+ /* Note that Batik uses the context class loader for loading SAX Parser, etc.
+ * Context class loader is inappropriate under the Felix implementation of OSGi,
+ * so replace it with the regular class loader. */
+ loader.setContextClassLoader(loader.getClass().getClassLoader());
loader.start();
}
@@ -193,7 +197,8 @@ private synchronized void renderIfReady() {
bounds,
size.width, size.height);
- gvtRenderer.addGVTTreeRendererListener(new SVGRasterizerListener());
+ gvtRenderer.addGVTTreeRendererListener(new SVGRasterizerListener());
+ gvtRenderer.setContextClassLoader(gvtRenderer.getClass().getClassLoader());
gvtRenderer.start();
}
@@ -212,7 +217,8 @@ public void documentLoadingCompleted(SVGDocumentLoaderEvent arg0) {
svgDocument = arg0.getSVGDocument();
GVTTreeBuilder gvtBuilder;
gvtBuilder = new GVTTreeBuilder(svgDocument, new BridgeContext(new UserAgentAdapter()));
- gvtBuilder.addGVTTreeBuilderListener(this);
+ gvtBuilder.addGVTTreeBuilderListener(this);
+ gvtBuilder.setContextClassLoader(gvtBuilder.getClass().getClassLoader());
gvtBuilder.start();
}

0 comments on commit b73a027

Please sign in to comment.