]> granicus.if.org Git - docbook-dsssl/commitdiff
Bug #1022519 - graphics.xsl fails with error about no X11 server
authorMichael Smith <xmldoc@users.sourceforge.net>
Sun, 5 Sep 2004 11:32:31 +0000 (11:32 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Sun, 5 Sep 2004 11:32:31 +0000 (11:32 +0000)
Problem
  Current stylesheets fail when trying to generate output under
  the following conditions:

    - Linux/Unix environment
    - no X server running
    - document contains graphics
    - use.extensions enabled

  This makes it impossible to try to do extensions-enabled
  automated transformations (e.g., nightly doc builds) in a server
  environment.

Cause
  Certain methods in the DocBook "ImageIntrisics" extensions class
  rely on the Java AWT library, which by default expects a running
  X server.

Fix
  Both the Saxon and Xalan2 versions of the extensions now set the
  "java.awt.headless" Java 1.4 system property to true. That
  property tells Java to continue processing AWT-based code even
  if no running X server is found.

  The property is set at the beginning of the constructor for the
  ImageIntrinsics class.

Affects
  This change only affects transformations using Saxon or Xalan2
  under the conditions:

    - Linux/Unix environment
    - no X server running
    - document contains graphics
    - use.extensions enabled

xsl/extensions/saxon643/com/nwalsh/saxon/ImageIntrinsics.java
xsl/extensions/xalan2/com/nwalsh/xalan/ImageIntrinsics.java

index 6c32d2f8d97bd0971310b348d3d067ee9987441b..9dd22294f7325dc6a5b19c9b499a4f7fff605d02 100644 (file)
@@ -40,6 +40,7 @@ public class ImageIntrinsics implements ImageObserver {
    * <p>Constructor for ImageIntrinsics</p>
    */
   public ImageIntrinsics(String imageFn) {
+    System.setProperty("java.awt.headless","true");
     image = Toolkit.getDefaultToolkit().getImage (imageFn);
     width = image.getWidth(this);
 
index e4dca7145a22e2e81dd7403e804d008b931fd074..97a13a3a51c9bc05b92bb9ae1b3e5804d9c6b293 100644 (file)
@@ -42,6 +42,7 @@ public class ImageIntrinsics implements ImageObserver {
    * <p>Constructor for ImageIntrinsics</p>
    */
   public ImageIntrinsics(ExpressionContext context, String imageFn) {
+    System.setProperty("java.awt.headless","true");
     image = Toolkit.getDefaultToolkit().getImage (imageFn);
     width = image.getWidth(this);