> >>> I checked in the attached patch to HeadlessGraphicsEnvironment. It now
> >>> tries to get hold of a CairoGraphics2D if available. It falls back to
> >>> the (Java-only) RasterGraphics only when nothing else works. David, can
> >>> you please test if this works?
> >>>
> >>>   
> >>>       
> >> Unfortunately your patch didn't change the outcome...
> >>     
> >
> > Strange. I suppose something goes wrong in the magic reflection code
> > that I added. Could you please add ex.printStackTrace() in the catch
> > block in HeadlessGraphicsEnvironment.createGraphics() to see what
> > exactly goes wrong and post this trace?
> >
> > /Roman
> >   
> Hi Roman,
> 
> The mailing list seems slow, so hopefully this gets through...
> 
> I did that, then fixed the reflection code as attached.  That results in 
> a NullPointerException fetching the name for a font (see below), I think 
> because the HeadlessToolkit is mostly stubs:

Aaarg. Maybe it would be most useful to disable the handling of the
awt.headless property for now and reenable it when the headless toolkit
and stuff is sorted out completely. The challenge is basically, that we
want to use the 'normal' freetype/cairo stuff when available and use the
java only impl only when that's not the case (i.e. somebody compiled a
stripped down classpath without any outside GUIish dependencies). Maybe
the best solution would be to use the GTK toolkit even for awt.headless
== true, when that's available, and throw a HeadlessException in all the
toolkit methods when that property is set.

/Roman

> [EMAIL PROTECTED]:~/mauve-cvs$ ~/jamvm-1.4.4/src/jamvm -Xmx300m -jar 
> ~/statcvs-0.2.3/statcvs.jar -output-dir output/ logfile.log mauve
> StatCVS - CVS statistics generation
> 
> Revision of install-sh does not match expected revision
> Revision of mkinstalldirs does not match expected revision
> java.lang.reflect.InvocationTargetException
>    at java.lang.reflect.Constructor.constructNative(Native Method)
>    at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
>    at 
> gnu.java.awt.peer.headless.HeadlessGraphicsEnvironment.createGraphics(HeadlessGraphicsEnvironment.java:79)
>    at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:397)
>    at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1212)
>    at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1193)
>    at 
> org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:174)
>    at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:329)
>    at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:300)
>    at net.sf.statcvs.renderer.Chart.saveChart(Chart.java:93)
>    at net.sf.statcvs.renderer.LOCChart.<init>(LOCChart.java:78)
>    at net.sf.statcvs.output.HTMLOutput.createLOCChart(HTMLOutput.java:298)
>    at net.sf.statcvs.output.HTMLOutput.createHTMLSuite(HTMLOutput.java:180)
>    at net.sf.statcvs.Main.generateDefaultHTMLSuite(Main.java:193)
>    at net.sf.statcvs.Main.main(Main.java:75)
>    at java.lang.reflect.Method.invokeNative(Native Method)
>    at java.lang.reflect.Method.invoke(Method.java:372)
>    at jamvm.java.lang.JarLauncher.main(JarLauncher.java:49)
> Caused by: java.lang.NullPointerException
>    at java.awt.Font.getName(Font.java:391)
>    at 
> gnu.java.awt.peer.gtk.CairoGraphics2D.setFont(CairoGraphics2D.java:1732)
>    at gnu.java.awt.peer.gtk.CairoGraphics2D.setup(CairoGraphics2D.java:225)
>    at 
> gnu.java.awt.peer.gtk.BufferedImageGraphics.<init>(BufferedImageGraphics.java:160)
>    at java.lang.reflect.Constructor.constructNative(Native Method)
>    ...17 more
> java.lang.reflect.InvocationTargetException
>    at java.lang.reflect.Method.invokeNative(Native Method)
>    at java.lang.reflect.Method.invoke(Method.java:372)
>    at jamvm.java.lang.JarLauncher.main(JarLauncher.java:49)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 307200
>    at java.awt.image.DataBufferInt.getElem(DataBufferInt.java:200)
>    at gnu.java.awt.Buffers.getData(Buffers.java:184)
>    at 
> java.awt.image.SinglePixelPackedSampleModel.getDataElements(SinglePixelPackedSampleModel.java:258)
>    at java.awt.image.Raster.getDataElements(Raster.java:651)
>    at 
> gnu.java.awt.java2d.AlphaCompositeContext.compose(AlphaCompositeContext.java:217)
>    at 
> gnu.java.awt.java2d.AbstractGraphics2D.fillScanlineAA(AbstractGraphics2D.java:2109)
>    at 
> gnu.java.awt.java2d.AbstractGraphics2D.fillShapeAntialias(AbstractGraphics2D.java:2049)
>    at 
> gnu.java.awt.java2d.AbstractGraphics2D.fillShape(AbstractGraphics2D.java:1570)
>    at 
> gnu.java.awt.java2d.AbstractGraphics2D.fill(AbstractGraphics2D.java:545)
>    at org.jfree.chart.JFreeChart.draw(JFreeChart.java:974)
>    at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1213)
>    at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1193)
>    at 
> org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:174)
>    at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:329)
>    at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:300)
>    at net.sf.statcvs.renderer.Chart.saveChart(Chart.java:93)
>    at net.sf.statcvs.renderer.LOCChart.<init>(LOCChart.java:78)
>    at net.sf.statcvs.output.HTMLOutput.createLOCChart(HTMLOutput.java:298)
>    at net.sf.statcvs.output.HTMLOutput.createHTMLSuite(HTMLOutput.java:180)
>    at net.sf.statcvs.Main.generateDefaultHTMLSuite(Main.java:193)
>    at net.sf.statcvs.Main.main(Main.java:75)
>    at java.lang.reflect.Method.invokeNative(Native Method)
>    ...2 more
> 
> 
> Regards,
> 
> Dave
> einfaches Textdokument-Anlage (diff.txt)
> Index: gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java
> ===================================================================
> RCS file: 
> /sources/classpath/classpath/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java,v
> retrieving revision 1.2
> diff -u -r1.2 HeadlessGraphicsEnvironment.java
> --- gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java       23 Nov 
> 2006 08:45:08 -0000      1.2
> +++ gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java       23 Nov 
> 2006 10:55:50 -0000
> @@ -76,11 +76,12 @@
>                Class.forName("gnu.java.awt.peer.gtk.BufferedImageGraphics");
>              Constructor bigC =
>                bigCl.getConstructor(new Class[]{BufferedImage.class });
> -            g2d = (Graphics2D) bigCl.newInstance();
> +            g2d = (Graphics2D) bigC.newInstance(new Object[] {image});
>            }
>        }
>      catch (Exception ex)
>        {
> +       ex.printStackTrace();
>          g2d = new RasterGraphics(image.getRaster(), image.getColorModel());
>        }
>      return g2d;


Reply via email to