Re: Problem with example code, but just in Eclipse ?

Christian Convey <[email protected]>
Newsgroups gmane.text.xml.batik.devel,gmane.text.xml.batik.user
Message-ID <CAPfS4ZzpPFbkRF3vgxywvUFjrp4riy=i9Zn=qbMi08MotsYOjw@mail.gmail.com>
Okay, I solved this.  I was actually being kind of dense on this one...

Batik actually does throw exceptions even when everything is okay.
The JVM keeps a file (fontconfig?) that maps abstract font names to
*potentially* available physical font names, and also the file system
path where they *might* be found.

When Batik searches through the entries in the file, it there's an
exception each time it's dealing with a font which doesn't exist on
the filesystem at the expected path.  But this is not a fatal error.

Anyway, when I ran my Batik-using code in Ecplipse, the debugger did a
breakpoint every time an exception was thrown, even these innoccuous
exceotions.  It never dawned on my that it might be okay for this to
happen.  I wasn't seeing this when I ran my program manually from the
command line, because I wasn't trapping the throwing of exceptions.

On Sun, Aug 14, 2011 at 1:53 PM, Christian Convey
<[email protected]> wrote:
> Anyone seen this before?
>
> I'm using Batik 1.7 (built from website's sources), Ubuntu 11.04, and
> openjdk 6b22-1.10.2-0ubuntu1~11.04.1.
>
> I'm using the  the "TestSVGGen" example code (
> http://xmlgraphics.apache.org/batik/using/svg-generator.html )
>
> When I just past that code into a .java file, and built and run it
> from the command line, it works great.
>
> But when I put that same class into my Eclipse project, I get the
> following stack dump.  Anyone know what I might be doing wrong?
>
>
> TestSVGGen [Java Application]
>        sisal.ifx.plot.intermediate_graphics.TestSVGGen at localhost:32788
>                Thread [main] (Suspended (exception NullPointerException))
>                        TrueTypeFont.open() line: 290
>                        TrueTypeFont.verify() line: 476
>                        TrueTypeFont.<init>(String, Object, int, boolean) line: 179
>                        FontManager.registerFontFile(String, String[], int, boolean, int) line: 999
>                        FontManager.initialiseDeferredFont(String) line: 946
>                        FontManager.findOtherDeferredFont(String, int) line: 898
>                        FontManager.findDeferredFont(String, int) line: 915
>                        FontManager.findFont2D(String, int, int) line: 1903
>                        FontManager.findFont2D(String, int, int) line: 1864
>                        Font.getFont2D() line: 477
>                        Font.getFamily(Locale) line: 1166
>                        Font.getFamily_NoClientCode() line: 1140
>                        Font.getFamily() line: 1132
>                        SVGFont.familyToSVG(Font) line: 412
>                        SVGFont.toSVG(Font, FontRenderContext) line: 241
>                        SVGFont.toSVG(GraphicContext) line: 221
>                        SVGGraphicContextConverter.toSVG(GraphicContext) line: 101
>                        DOMTreeManager.<init>(GraphicContext, SVGGeneratorContext, int) line: 145
>                        SVGGraphics2D.setGeneratorContext(SVGGeneratorContext) line: 364
>                        SVGGraphics2D.<init>(SVGGeneratorContext, boolean) line: 325
>                        SVGGraphics2D.<init>(Document) line: 263
>                        TestSVGGen.main(String[]) line: 33
>                Daemon Thread [Batik CleanerThread] (Running)
>        /usr/lib/jvm/java-6-openjdk/bin/java (Aug 14, 2011 1:46:01 PM)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.