"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java" between
pdfbox-2.0.23-src.zip and pdfbox-2.0.24-src.zip

About: Apache PDFBox is a Java PDF library tool that allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents.

PDResources.java  (pdfbox-2.0.23-src):PDResources.java  (pdfbox-2.0.24-src)
skipping to change at line 207 skipping to change at line 207
if (object != null) if (object != null)
{ {
colorSpace = PDColorSpace.create(object, this, wasDefault); colorSpace = PDColorSpace.create(object, this, wasDefault);
} }
else else
{ {
colorSpace = PDColorSpace.create(name, this, wasDefault); colorSpace = PDColorSpace.create(name, this, wasDefault);
} }
// we can't cache PDPattern, because it holds page resources, see PDFBOX -2370 // we can't cache PDPattern, because it holds page resources, see PDFBOX -2370
if (cache != null && !(colorSpace instanceof PDPattern)) if (cache != null && indirect != null && !(colorSpace instanceof PDPatte rn))
{ {
cache.put(indirect, colorSpace); cache.put(indirect, colorSpace);
} }
return colorSpace; return colorSpace;
} }
/** /**
* Returns true if the given color space name exists in these resources. * Returns true if the given color space name exists in these resources.
* *
* @param name Name of the color space resource. * @param name Name of the color space resource.
skipping to change at line 253 skipping to change at line 253
} }
// get the instance // get the instance
PDExtendedGraphicsState extGState = null; PDExtendedGraphicsState extGState = null;
COSBase base = get(COSName.EXT_G_STATE, name); COSBase base = get(COSName.EXT_G_STATE, name);
if (base instanceof COSDictionary) if (base instanceof COSDictionary)
{ {
extGState = new PDExtendedGraphicsState((COSDictionary) base); extGState = new PDExtendedGraphicsState((COSDictionary) base);
} }
if (cache != null) if (cache != null && indirect != null)
{ {
cache.put(indirect, extGState); cache.put(indirect, extGState);
} }
return extGState; return extGState;
} }
/** /**
* Returns the shading resource with the given name, or null if none exists. * Returns the shading resource with the given name, or null if none exists.
* *
* @param name Name of the shading resource. * @param name Name of the shading resource.
skipping to change at line 289 skipping to change at line 289
} }
// get the instance // get the instance
PDShading shading = null; PDShading shading = null;
COSBase base = get(COSName.SHADING, name); COSBase base = get(COSName.SHADING, name);
if (base instanceof COSDictionary) if (base instanceof COSDictionary)
{ {
shading = PDShading.create((COSDictionary) base); shading = PDShading.create((COSDictionary) base);
} }
if (cache != null) if (cache != null && indirect != null)
{ {
cache.put(indirect, shading); cache.put(indirect, shading);
} }
return shading; return shading;
} }
/** /**
* Returns the pattern resource with the given name, or null if none exists. * Returns the pattern resource with the given name, or null if none exists.
* *
* @param name Name of the pattern resource. * @param name Name of the pattern resource.
skipping to change at line 325 skipping to change at line 325
} }
// get the instance // get the instance
PDAbstractPattern pattern = null; PDAbstractPattern pattern = null;
COSBase base = get(COSName.PATTERN, name); COSBase base = get(COSName.PATTERN, name);
if (base instanceof COSDictionary) if (base instanceof COSDictionary)
{ {
pattern = PDAbstractPattern.create((COSDictionary) base, getResource Cache()); pattern = PDAbstractPattern.create((COSDictionary) base, getResource Cache());
} }
if (cache != null) if (cache != null && indirect != null)
{ {
cache.put(indirect, pattern); cache.put(indirect, pattern);
} }
return pattern; return pattern;
} }
/** /**
* Returns the property list resource with the given name, or null if none e xists. * Returns the property list resource with the given name, or null if none e xists.
* *
* @param name Name of the property list resource. * @param name Name of the property list resource.
skipping to change at line 359 skipping to change at line 359
} }
// get the instance // get the instance
PDPropertyList propertyList = null; PDPropertyList propertyList = null;
COSBase base = get(COSName.PROPERTIES, name); COSBase base = get(COSName.PROPERTIES, name);
if (base instanceof COSDictionary) if (base instanceof COSDictionary)
{ {
propertyList = PDPropertyList.create((COSDictionary) base); propertyList = PDPropertyList.create((COSDictionary) base);
} }
if (cache != null) if (cache != null && indirect != null)
{ {
cache.put(indirect, propertyList); cache.put(indirect, propertyList);
} }
return propertyList; return propertyList;
} }
/** /**
* Tells whether the XObject resource with the given name is an image. * Tells whether the XObject resource with the given name is an image.
* *
* @param name Name of the XObject resource. * @param name Name of the XObject resource.
skipping to change at line 428 skipping to change at line 428
xobject = null; xobject = null;
} }
else if (value instanceof COSObject) else if (value instanceof COSObject)
{ {
xobject = PDXObject.createXObject(((COSObject) value).getObject(), t his); xobject = PDXObject.createXObject(((COSObject) value).getObject(), t his);
} }
else else
{ {
xobject = PDXObject.createXObject(value, this); xobject = PDXObject.createXObject(value, this);
} }
if (cache != null && isAllowedCache(xobject)) if (cache != null && indirect != null && isAllowedCache(xobject))
{ {
cache.put(indirect, xobject); cache.put(indirect, xobject);
} }
return xobject; return xobject;
} }
private boolean isAllowedCache(PDXObject xobject) private boolean isAllowedCache(PDXObject xobject)
{ {
if (xobject instanceof PDImageXObject) if (xobject instanceof PDImageXObject)
{ {
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)