You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Andreas Delmelle <an...@telenet.be> on 2008/02/16 14:09:27 UTC

Q: What should happen when an image is not found?

Hi all

Reason for this question is I'm trying out a test-suite that was  
shared by Kumar Puppala (see a recent thread on fop-users).

The image formats are the same (PNG), and they are never present.

Mostly, when the images are not available, I simply see an error in  
the log, but the process continues nevertheless, and simply yields a  
result that does not include the image.
Apparently, though, for some images, the formatting process crashes  
with a FileNotFoundException for the very same reason.
(in xmlgraphics.image.loader.cache.ImageCache.needImageInfo(), when  
the cache is accessed through the ImageManager, from  
fop.render.pdf.PDFRenderer.putImage())

AFAICT, this is caused by the width/height and content-width/content- 
height properties being explicitly specified (leads to the FNFE). If  
they revert to their initial values, the renderer is able to continue  
without having to open the file.

So, small question:
Wouldn't it be possible and cleaner to make the behavior more  
consistent? Either crash or continue with an error-message in the  
log, for all absent images, but not depending on whether the user  
specified explicit values for the image dimensions?

Just wondering. Not that I have a strong preference in either  
direction, but I just thought it might confuse our users if they see  
FOP recover from the error in one case, and crash in others...


Cheers

Andreas

Re: Q: What should happen when an image is not found?

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Vincent Hennebert wrote:
> Adrian made the suggestion some time ago of using the fo:declarations
> element to override configuration on a per-document basis:
[snip]
> It’s not as fine-grained as a PI (no
> means to say “from now on, do this”), but I share Jeremias’ feeling
> about PIs.

 From my experience, a mechanism saying “from now on, do this” is
likely to confuse a non-trivial amount of users.

I think there should be the following hierarchy (which is already
complex enough)
- config file
- overridden by command line arguments
- overridden on a per document basis by extension elements in the
   fo:declarations section
- overridden on a per element basis by extension attributes on the
   element
- overridden by specific "force" command line arguments ("force
   all warnings/problems to be fatal" may be the only one of this kind)

J.PIetschmann

Re: Q: What should happen when an image is not found?

Posted by Max Berger <ma...@berger.name>.
Dear Fop devs,


On Mit, 2008-02-20 at 10:24 +0000, Vincent Hennebert wrote:
> >> A PI could mean: From this point on in the whole document.
> >> HOWEVER: If fop currently uses no PIs (I am not sure about this), then
> >> it should be a fox: extension, to make all behavior similar.
> > 
> > Indeed, we don't use PIs at the moment. And I'm not sure we should. I
> > wonder how many people know how to work with them.

Probably very few - and if fop does not use them, it is not consistent
to start using them.

> 
> Adrian made the suggestion some time ago of using the fo:declarations 
> element to override configuration on a per-document basis:
> http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-users/200801.mbox/%3c478CE959.9050504@cumiskey.com%3e

This idea sounds really reasonable and consitent. Please note however,
that XSL fo specified (color-profile)+ as content for fo:declarations at
some point, which would make some documents non-conformant. So +1 for
this one :)

> >> As for the size: 
> >>
> >> - Always use the size given if given.
> >>
> >> Either:
> >> - a 0.0001 x 0.0001 pt empty transparent image OR
> > 
> > Would have to be at least 0.001x0.001pt as this is our minimal
> > resolution. ;-) Feels very HTML-like...
> > 
> >> - A missing image image, about 1x1 cm: should have a border and a red
> >> "x" (as seen in web browsers, etc.)
> > 
> > I think I'd prefer this. It's still a change in FOP's behaviour. But so
> > many people don't read or ignore FOP's log output, visual feedback is
> > probably a good idea.
> 
> +1

ok, sounds good. +1

> Vincent

mfG

Max Berger
e-mail: max@berger.name

-- 
OpenPG ID: E81592BC   Print: F489F8759D4132923EC4 BC7E072AB73AE81592BC
For information about me and my work please see http://max.berger.name


Re: Q: What should happen when an image is not found?

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi,

Jeremias Maerki wrote:
> On 18.02.2008 17:04:52 Max Berger wrote:
>> Dear Fop Devs,
>>
>> i think this was the original intention of a "processing instruction".
> 
> That's another possibility, yes.
> 
>> I
>> really do not see clearly where fox:fail-on-missing-image would go in
>> the fo tree.
> 
> I think an extension property/attribute was meant, not an element.
> 
>> A PI could mean: From this point on in the whole document.
>> HOWEVER: If fop currently uses no PIs (I am not sure about this), then
>> it should be a fox: extension, to make all behavior similar.
> 
> Indeed, we don't use PIs at the moment. And I'm not sure we should. I
> wonder how many people know how to work with them.

Adrian made the suggestion some time ago of using the fo:declarations 
element to override configuration on a per-document basis:
http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-users/200801.mbox/%3c478CE959.9050504@cumiskey.com%3e

If some mechanism were to be implemented inside the FO file, I think 
this approach would be a good one. It’s not as fine-grained as a PI (no 
means to say “from now on, do this”), but I share Jeremias’ feeling 
about PIs.


>> As for the size: 
>>
>> - Always use the size given if given.
>>
>> Either:
>> - a 0.0001 x 0.0001 pt empty transparent image OR
> 
> Would have to be at least 0.001x0.001pt as this is our minimal
> resolution. ;-) Feels very HTML-like...
> 
>> - A missing image image, about 1x1 cm: should have a border and a red
>> "x" (as seen in web browsers, etc.)
> 
> I think I'd prefer this. It's still a change in FOP's behaviour. But so
> many people don't read or ignore FOP's log output, visual feedback is
> probably a good idea.

+1

Vincent


-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Re: Q: What should happen when an image is not found?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 18.02.2008 17:04:52 Max Berger wrote:
> Dear Fop Devs,
> 
> i think this was the original intention of a "processing instruction".

That's another possibility, yes.

> I
> really do not see clearly where fox:fail-on-missing-image would go in
> the fo tree.

I think an extension property/attribute was meant, not an element.

> A PI could mean: From this point on in the whole document.
> HOWEVER: If fop currently uses no PIs (I am not sure about this), then
> it should be a fox: extension, to make all behavior similar.

Indeed, we don't use PIs at the moment. And I'm not sure we should. I
wonder how many people know how to work with them.

> As for the size: 
> 
> - Always use the size given if given.
> 
> Either:
> - a 0.0001 x 0.0001 pt empty transparent image OR

Would have to be at least 0.001x0.001pt as this is our minimal
resolution. ;-) Feels very HTML-like...

> - A missing image image, about 1x1 cm: should have a border and a red
> "x" (as seen in web browsers, etc.)

I think I'd prefer this. It's still a change in FOP's behaviour. But so
many people don't read or ignore FOP's log output, visual feedback is
probably a good idea.

> 
> On Mon, 2008-02-18 at 07:47 -0800, The Web Maestro wrote:
> > That all sounds good. As for the extension vs. Config approach, the
> > config could specify the default behavior & users could override it
> > via individual fox:image-missing-behavior (or
> > fox:fail-on-missing-image or something). If there's no
> > @fox:[image-missing-behavior] specified, it'll do the config setting
> > or log a warning if nothing specified.
> > 
> > Clay
> 
> mfG
> 
> Max Berger
> e-mail: max@berger.name
> 
> -- 
> OpenPG ID: E81592BC   Print: F489F8759D4132923EC4 BC7E072AB73AE81592BC
> For information about me and my work please see http://max.berger.name
> 




Jeremias Maerki


Re: Q: What should happen when an image is not found?

Posted by Max Berger <ma...@berger.name>.
Dear Fop Devs,

i think this was the original intention of a "processing instruction". I
really do not see clearly where fox:fail-on-missing-image would go in
the fo tree. A PI could mean: From this point on in the whole document.
HOWEVER: If fop currently uses no PIs (I am not sure about this), then
it should be a fox: extension, to make all behavior similar.

As for the size: 

- Always use the size given if given.

Either:
- a 0.0001 x 0.0001 pt empty transparent image OR
- A missing image image, about 1x1 cm: should have a border and a red
"x" (as seen in web browsers, etc.)


On Mon, 2008-02-18 at 07:47 -0800, The Web Maestro wrote:
> That all sounds good. As for the extension vs. Config approach, the
> config could specify the default behavior & users could override it
> via individual fox:image-missing-behavior (or
> fox:fail-on-missing-image or something). If there's no
> @fox:[image-missing-behavior] specified, it'll do the config setting
> or log a warning if nothing specified.
> 
> Clay

mfG

Max Berger
e-mail: max@berger.name

-- 
OpenPG ID: E81592BC   Print: F489F8759D4132923EC4 BC7E072AB73AE81592BC
For information about me and my work please see http://max.berger.name


Re: Q: What should happen when an image is not found?

Posted by The Web Maestro <th...@gmail.com>.
As for size? I'd say we use whatever's specified, or default to small
if it's floating or page width.

Clay



On 2/18/08, The Web Maestro <th...@gmail.com> wrote:
> That all sounds good. As for the extension vs. Config approach, the
> config could specify the default behavior & users could override it
> via individual fox:image-missing-behavior (or
> fox:fail-on-missing-image or something). If there's no
> @fox:[image-missing-behavior] specified, it'll do the config setting
> or log a warning if nothing specified.
>
> Clay
>
>
>
> On 2/17/08, Jeremias Maerki <de...@jeremias-maerki.ch> wrote:
> > Thanks for the hint. I'll look into it.
> >
> > On 16.02.2008 14:09:27 Andreas Delmelle wrote:
> > >
> > > Hi all
> > >
> > > Reason for this question is I'm trying out a test-suite that was
> > > shared by Kumar Puppala (see a recent thread on fop-users).
> > >
> > > The image formats are the same (PNG), and they are never present.
> > >
> > > Mostly, when the images are not available, I simply see an error in
> > > the log, but the process continues nevertheless, and simply yields a
> > > result that does not include the image.
> > > Apparently, though, for some images, the formatting process crashes
> > > with a FileNotFoundException for the very same reason.
> > > (in xmlgraphics.image.loader.cache.ImageCache.needImageInfo(), when
> > > the cache is accessed through the ImageManager, from
> > > fop.render.pdf.PDFRenderer.putImage())
> > >
> > > AFAICT, this is caused by the width/height and content-width/content-
> > > height properties being explicitly specified (leads to the FNFE). If
> > > they revert to their initial values, the renderer is able to continue
> > > without having to open the file.
> > >
> > > So, small question:
> > > Wouldn't it be possible and cleaner to make the behavior more
> > > consistent? Either crash or continue with an error-message in the
> > > log, for all absent images, but not depending on whether the user
> > > specified explicit values for the image dimensions?
> > >
> > > Just wondering. Not that I have a strong preference in either
> > > direction, but I just thought it might confuse our users if they see
> > > FOP recover from the error in one case, and crash in others...
> > >
> > >
> > > Cheers
> > >
> > > Andreas
> >
> >
> >
> >
> > Jeremias Maerki
> >
> >
>
> --
> Sent from Gmail for mobile | mobile.google.com
>
> Regards,
>
> The Web Maestro
> --
> <th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
> My religion is simple. My religion is kindness.
> - HH The 14th Dalai Lama of Tibet
>

-- 
Sent from Gmail for mobile | mobile.google.com

Regards,

The Web Maestro
-- 
<th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet

Re: Q: What should happen when an image is not found?

Posted by The Web Maestro <th...@gmail.com>.
That all sounds good. As for the extension vs. Config approach, the
config could specify the default behavior & users could override it
via individual fox:image-missing-behavior (or
fox:fail-on-missing-image or something). If there's no
@fox:[image-missing-behavior] specified, it'll do the config setting
or log a warning if nothing specified.

Clay



On 2/17/08, Jeremias Maerki <de...@jeremias-maerki.ch> wrote:
> Thanks for the hint. I'll look into it.
>
> On 16.02.2008 14:09:27 Andreas Delmelle wrote:
> >
> > Hi all
> >
> > Reason for this question is I'm trying out a test-suite that was
> > shared by Kumar Puppala (see a recent thread on fop-users).
> >
> > The image formats are the same (PNG), and they are never present.
> >
> > Mostly, when the images are not available, I simply see an error in
> > the log, but the process continues nevertheless, and simply yields a
> > result that does not include the image.
> > Apparently, though, for some images, the formatting process crashes
> > with a FileNotFoundException for the very same reason.
> > (in xmlgraphics.image.loader.cache.ImageCache.needImageInfo(), when
> > the cache is accessed through the ImageManager, from
> > fop.render.pdf.PDFRenderer.putImage())
> >
> > AFAICT, this is caused by the width/height and content-width/content-
> > height properties being explicitly specified (leads to the FNFE). If
> > they revert to their initial values, the renderer is able to continue
> > without having to open the file.
> >
> > So, small question:
> > Wouldn't it be possible and cleaner to make the behavior more
> > consistent? Either crash or continue with an error-message in the
> > log, for all absent images, but not depending on whether the user
> > specified explicit values for the image dimensions?
> >
> > Just wondering. Not that I have a strong preference in either
> > direction, but I just thought it might confuse our users if they see
> > FOP recover from the error in one case, and crash in others...
> >
> >
> > Cheers
> >
> > Andreas
>
>
>
>
> Jeremias Maerki
>
>

-- 
Sent from Gmail for mobile | mobile.google.com

Regards,

The Web Maestro
-- 
<th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet

Re: Q: What should happen when an image is not found?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Thanks for the hint. I'll look into it.

On 16.02.2008 14:09:27 Andreas Delmelle wrote:
> 
> Hi all
> 
> Reason for this question is I'm trying out a test-suite that was  
> shared by Kumar Puppala (see a recent thread on fop-users).
> 
> The image formats are the same (PNG), and they are never present.
> 
> Mostly, when the images are not available, I simply see an error in  
> the log, but the process continues nevertheless, and simply yields a  
> result that does not include the image.
> Apparently, though, for some images, the formatting process crashes  
> with a FileNotFoundException for the very same reason.
> (in xmlgraphics.image.loader.cache.ImageCache.needImageInfo(), when  
> the cache is accessed through the ImageManager, from  
> fop.render.pdf.PDFRenderer.putImage())
> 
> AFAICT, this is caused by the width/height and content-width/content- 
> height properties being explicitly specified (leads to the FNFE). If  
> they revert to their initial values, the renderer is able to continue  
> without having to open the file.
> 
> So, small question:
> Wouldn't it be possible and cleaner to make the behavior more  
> consistent? Either crash or continue with an error-message in the  
> log, for all absent images, but not depending on whether the user  
> specified explicit values for the image dimensions?
> 
> Just wondering. Not that I have a strong preference in either  
> direction, but I just thought it might confuse our users if they see  
> FOP recover from the error in one case, and crash in others...
> 
> 
> Cheers
> 
> Andreas




Jeremias Maerki


Re: Q: What should happen when an image is not found?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 18.02.2008 02:57:51 The Web Maestro wrote:
> On Feb 17, 2008 10:56 AM, Max Berger <ma...@berger.name> wrote:
> > Dear FOP Devs,
> >
> > Am 16.02.2008 um 16:54 schrieb The Web Maestro:
> > > I would think the default should be to continue (warning in
> > > LOG/stdout) create an empty (blank/transparent) container the size and
> > > placement of the image.
> >
> > +1

Just to compare with Batik: Batik uses a "broken image" (painted using
Java2D) if an image cannot be found:
https://svn.apache.org/repos/asf/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java

What should be the intrinsic size of a missing image? 1x1cm? 2x2in?

> > > It would be nifty if it could be a flag in the config or CLI args
> > > giving the user the choiice to fail on missing images.
> >
> > I think this would be a good "test case" for the new feedback
> > mechanism. IMO there should be a warning by default, but the user
> > should be able to configure it to fail if needed.

I haven't considered providing configuration settings to override
default severity levels, yet. I initially thought that would be left to
the integrator. But wiring something like that into FOP should be easy.
You could simply provide a list of event IDs and the overriding severity
level.

> > > Clay
> >
> > Max Berger
> 
> Even better... In addition to a config setting, another option would
> be to place it in the xsl-fo file itself (I guess in the fox:
> namespace since it's probably not in the XSL-FO spec...).

That's also a possibility but if it's better.... The config approach
lets you specify the behaviour in one place. The extension attribute
approach makes it necessary to provide a setting for every single image
even though the expected behaviour is probably always the same within a
system. And this mechanism only works for missing images. The config
approach lets you specify the behaviour for all events.



Jeremias Maerki


Re: Q: What should happen when an image is not found?

Posted by The Web Maestro <th...@gmail.com>.
On Feb 17, 2008 10:56 AM, Max Berger <ma...@berger.name> wrote:
> Dear FOP Devs,
>
> Am 16.02.2008 um 16:54 schrieb The Web Maestro:
> > I would think the default should be to continue (warning in
> > LOG/stdout) create an empty (blank/transparent) container the size and
> > placement of the image.
>
> +1
>
> > It would be nifty if it could be a flag in the config or CLI args
> > giving the user the choiice to fail on missing images.
>
> I think this would be a good "test case" for the new feedback
> mechanism. IMO there should be a warning by default, but the user
> should be able to configure it to fail if needed.
>
> > Clay
>
> Max Berger

Even better... In addition to a config setting, another option would
be to place it in the xsl-fo file itself (I guess in the fox:
namespace since it's probably not in the XSL-FO spec...).

Regards,

The Web Maestro
-- 
<th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet

Re: Q: What should happen when an image is not found?

Posted by Max Berger <ma...@berger.name>.
Dear FOP Devs,

Am 16.02.2008 um 16:54 schrieb The Web Maestro:
> I would think the default should be to continue (warning in
> LOG/stdout) create an empty (blank/transparent) container the size and
> placement of the image.

+1

> It would be nifty if it could be a flag in the config or CLI args
> giving the user the choiice to fail on missing images.

I think this would be a good "test case" for the new feedback  
mechanism. IMO there should be a warning by default, but the user  
should be able to configure it to fail if needed.

> Clay



Max Berger
e-mail: max@berger.name

--
PGP/GnuPG ID: E81592BC   Print: F489F8759D4132923EC4  
BC7E072AB73AE81592BC
For information about me or my projects please see http://max.berger.name


Re: Q: What should happen when an image is not found?

Posted by Jay Bryant <ja...@bryantcs.com>.
>I would think the default should be to continue (warning in
> LOG/stdout) create an empty (blank/transparent) container the size and
> placement of the image.
> 
> It would be nifty if it could be a flag in the config or CLI args
> giving the user the choiice to fail on missing images.
> 
> Clay

I concur with Clay on this one.

Jay Bryant
Bryant Communication Services
http://www.bryantcs.com/

Re: Q: What should happen when an image is not found?

Posted by The Web Maestro <th...@gmail.com>.
I would think the default should be to continue (warning in
LOG/stdout) create an empty (blank/transparent) container the size and
placement of the image.

It would be nifty if it could be a flag in the config or CLI args
giving the user the choiice to fail on missing images.

Clay



On 2/16/08, Andreas Delmelle <an...@telenet.be> wrote:
>
> Hi all
>
> Reason for this question is I'm trying out a test-suite that was
> shared by Kumar Puppala (see a recent thread on fop-users).
>
> The image formats are the same (PNG), and they are never present.
>
> Mostly, when the images are not available, I simply see an error in
> the log, but the process continues nevertheless, and simply yields a
> result that does not include the image.
> Apparently, though, for some images, the formatting process crashes
> with a FileNotFoundException for the very same reason.
> (in xmlgraphics.image.loader.cache.ImageCache.needImageInfo(), when
> the cache is accessed through the ImageManager, from
> fop.render.pdf.PDFRenderer.putImage())
>
> AFAICT, this is caused by the width/height and content-width/content-
> height properties being explicitly specified (leads to the FNFE). If
> they revert to their initial values, the renderer is able to continue
> without having to open the file.
>
> So, small question:
> Wouldn't it be possible and cleaner to make the behavior more
> consistent? Either crash or continue with an error-message in the
> log, for all absent images, but not depending on whether the user
> specified explicit values for the image dimensions?
>
> Just wondering. Not that I have a strong preference in either
> direction, but I just thought it might confuse our users if they see
> FOP recover from the error in one case, and crash in others...
>
>
> Cheers
>
> Andreas
>

-- 
Sent from Gmail for mobile | mobile.google.com

Regards,

The Web Maestro
-- 
<th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet