BF [ 1674706 ] LoadError when image url gets redirect

https://sourceforge.net/tracker/index.php?func=detail&aid=1674706&group_id=176962&atid=879332
This commit is contained in:
teo_sarca 2007-03-07 08:02:50 +00:00
parent e282edfbcb
commit fed3191700
2 changed files with 9 additions and 3 deletions

View File

@ -224,8 +224,8 @@ public class ImageElement extends PrintElement
if (m_image == null)
return true;
// we have an image
waitForLoad(m_image);
if (m_image != null)
// if the image was not loaded, consider that there is no image - teo_sarca [ 1674706 ]
if (waitForLoad(m_image) && m_image != null)
{
p_width = m_image.getWidth(this);
p_height = m_image.getHeight(this);
@ -253,6 +253,12 @@ public class ImageElement extends PrintElement
p_width = (float) m_scaleFactor * p_width;
p_height = (float) m_scaleFactor * p_height;
}
// If the image is not loaded set it to null.
// This prevents SecurityException when invoking getWidth() or getHeight(). - teo_sarca [ 1674706 ]
else {
m_image = null;
}
return true;
} // calculateSize

View File

@ -1354,7 +1354,7 @@ public class TableElement extends PrintElement
else if (printItems[index] instanceof ImageElement)
{
Image imageToDraw = ((ImageElement)printItems[index]).getImage();
if (imageToDraw.getHeight((ImageElement)printItems[index]) != -1)
if (imageToDraw != null) // teo_sarca [ 1674706 ]
{
// Draw image using the scale factor - teo_sarca, [ 1673548 ] Image is not scaled in a report table cell
double scale = ((ImageElement)printItems[index]).getScaleFactor();