Re: SingleByteFont Patch

2014-07-01 Thread Pascal Sancho
Hi,
can you file in entries in Jira, please?
see our HowTo [1] submitting patches.

[1] http://xmlgraphics.apache.org/fop/dev/#patches

2014-07-01 12:36 GMT+02:00 Kai Hofmann :
>
> Dear all,
>
> looks like there is another bug based on the before mentioned problem:
>
> FOPGVTGlyphVector:
>
>private void buildBoundingBoxes() {
> boundingBoxes = new Rectangle2D[glyphs.length];
> for (int i = 0; i < glyphs.length; i++) {
> Rectangle bbox = fontMetrics.getBoundingBox(glyphs[i], fontSize);
> boundingBoxes[i] = new Rectangle2D.Float(bbox.x / 100f, 
> -(bbox.y + bbox.height) / 100f,
> bbox.width / 100f, bbox.height / 100f);
> }
> }
>
>
> Here the result of the patched getBoundingBox seems to be used without a null 
> pointer check. Please keep attention on getBoundingBox which explizitly 
> returns null 
> Looks like it would help to have complete javadocs which describe the 
> possible return values to avoid such mistakes.
>
>
> Gesendet: Dienstag, 01. Juli 2014 um 10:52 Uhr
> Von: "Kai Hofmann" 
> An: [email protected]
> Betreff: SingleByteFont Patch
> Dear all,
>
> I found a small bug in SingleByteFont - please see attached patch - in 
> getBoundingBox:
>
> if (idx >= 0 && idx < boundingBoxes.length)
>
> might result in a null pointer exception, when getBoundingBox is called 
> before setBoudning box.
> So repleace with:
>
> if (boundingBoxes != null && idx >= 0 && idx < boundingBoxes.length)


-- 
pascal

-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Aw: SingleByteFont Patch

2014-07-01 Thread Kai Hofmann

Dear all,
 
looks like there is another bug based on the before mentioned problem:
 
FOPGVTGlyphVector:
 
   private void buildBoundingBoxes() {
    boundingBoxes = new Rectangle2D[glyphs.length];
    for (int i = 0; i < glyphs.length; i++) {
    Rectangle bbox = fontMetrics.getBoundingBox(glyphs[i], fontSize);
    boundingBoxes[i] = new Rectangle2D.Float(bbox.x / 100f, 
-(bbox.y + bbox.height) / 100f,
    bbox.width / 100f, bbox.height / 100f);
    }
    }
 
 
Here the result of the patched getBoundingBox seems to be used without a null 
pointer check. Please keep attention on getBoundingBox which explizitly returns 
null 
Looks like it would help to have complete javadocs which describe the possible 
return values to avoid such mistakes.
 
Greetings
 
  Kai Hofmann
 
-- 
Kai Hofmann   EMail: [email protected]
Bremen/Germany
 
 

Gesendet: Dienstag, 01. Juli 2014 um 10:52 Uhr
Von: "Kai Hofmann" 
An: [email protected]
Betreff: SingleByteFont Patch
Dear all,
 
I found a small bug in SingleByteFont - please see attached patch - in 
getBoundingBox:

if (idx >= 0 && idx < boundingBoxes.length)

might result in a null pointer exception, when getBoundingBox is called before 
setBoudning box.
So repleace with:

if (boundingBoxes != null && idx >= 0 && idx < boundingBoxes.length)


Greetings

Kai Hofmann

 
-- 
Kai Hofmann   EMail: [email protected]
Bremen/Germany
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



SingleByteFont Patch

2014-07-01 Thread Kai Hofmann

Dear all,
 
I found a small bug in SingleByteFont - please see attached patch - in 
getBoundingBox:

if (idx >= 0 && idx < boundingBoxes.length)

might result in a null pointer exception, when getBoundingBox is called before 
setBoudning box.
So repleace with:

if (boundingBoxes != null && idx >= 0 && idx < boundingBoxes.length)


Greetings

  Kai Hofmann

 
-- 
Kai Hofmann   EMail: [email protected]
Bremen/Germany

SingleByteFont.java.patch
Description: Binary data

-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]