"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.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.

CatalogValidationProcess.java  (pdfbox-2.0.23-src):CatalogValidationProcess.java  (pdfbox-2.0.24-src)
skipping to change at line 249 skipping to change at line 249
* @param ctx * @param ctx
* @throws ValidationException * @throws ValidationException
*/ */
public void validateOutputIntent(PreflightContext ctx) throws ValidationExce ption public void validateOutputIntent(PreflightContext ctx) throws ValidationExce ption
{ {
COSDocument cosDocument = ctx.getDocument().getDocument(); COSDocument cosDocument = ctx.getDocument().getDocument();
COSBase cBase = catalog.getCOSObject().getItem(COSName.getPDFName(DOCUME NT_DICTIONARY_KEY_OUTPUT_INTENTS)); COSBase cBase = catalog.getCOSObject().getItem(COSName.getPDFName(DOCUME NT_DICTIONARY_KEY_OUTPUT_INTENTS));
COSArray outputIntents = COSUtils.getAsArray(cBase, cosDocument); COSArray outputIntents = COSUtils.getAsArray(cBase, cosDocument);
Map<COSObjectKey, Boolean> tmpDestOutputProfile = new HashMap<COSObjectK ey, Boolean>(); Map<COSObjectKey, Boolean> tmpDestOutputProfile = new HashMap<COSObjectK ey, Boolean>();
for (int i = 0; outputIntents != null && i < outputIntents.size(); ++i) if (outputIntents == null)
{
return;
}
for (int i = 0; i < outputIntents.size(); ++i)
{ {
COSDictionary outputIntentDict = COSUtils.getAsDictionary(outputInte nts.get(i), cosDocument); COSDictionary outputIntentDict = COSUtils.getAsDictionary(outputInte nts.get(i), cosDocument);
if (outputIntentDict == null) if (outputIntentDict == null)
{ {
addValidationError(ctx, new ValidationError(ERROR_GRAPHIC_OUTPUT _INTENT_INVALID_ENTRY, addValidationError(ctx, new ValidationError(ERROR_GRAPHIC_OUTPUT _INTENT_INVALID_ENTRY,
"OutputIntent object is null or isn't a dictionary")); "OutputIntent object is null or isn't a dictionary"));
} }
else else
{ {
skipping to change at line 329 skipping to change at line 333
* @param destOutputProfile * @param destOutputProfile
* @param mapDestOutputProfile * @param mapDestOutputProfile
* @param ctx the preflight context. * @param ctx the preflight context.
* @throws ValidationException * @throws ValidationException
*/ */
protected void validateICCProfile(COSBase destOutputProfile, Map<COSObjectKe y, Boolean> mapDestOutputProfile, protected void validateICCProfile(COSBase destOutputProfile, Map<COSObjectKe y, Boolean> mapDestOutputProfile,
PreflightContext ctx) throws ValidationException PreflightContext ctx) throws ValidationException
{ {
try try
{ {
if (destOutputProfile == null)
{
return;
}
// destOutputProfile should be an instance of COSObject because of t his is a object reference // destOutputProfile should be an instance of COSObject because of t his is a object reference
if (destOutputProfile instanceof COSObject) if (destOutputProfile instanceof COSObject)
{ {
if (mapDestOutputProfile.containsKey(new COSObjectKey((COSObject ) destOutputProfile))) if (mapDestOutputProfile.containsKey(new COSObjectKey((COSObject ) destOutputProfile)))
{ {
// the profile is already checked. continue // the profile is already checked. continue
return; return;
} }
else if (!mapDestOutputProfile.isEmpty()) else if (!mapDestOutputProfile.isEmpty())
{ {
// A DestOutputProfile exits but it isn't the same, error // A DestOutputProfile exits but it isn't the same, error
addValidationError(ctx, new ValidationError(ERROR_GRAPHIC_OU TPUT_INTENT_ICC_PROFILE_MULTIPLE, addValidationError(ctx, new ValidationError(ERROR_GRAPHIC_OU TPUT_INTENT_ICC_PROFILE_MULTIPLE,
"More than one ICCProfile is defined")); "More than one ICCProfile is defined"));
return; return;
} }
// else the profile will be kept in the tmpDestOutputProfile if it is valid // else the profile will be kept in the tmpDestOutputProfile if it is valid
} }
else
{
addValidationError(ctx, new ValidationError(ERROR_GRAPHIC_OUTPUT
_INTENT_INVALID_ENTRY,
"OutputIntent object should be a reference: " + destOutp
utProfile));
return;
}
// keep reference to avoid multiple profile definition // keep reference to avoid multiple profile definition
mapDestOutputProfile.put(new COSObjectKey((COSObject) destOutputProf ile), true); mapDestOutputProfile.put(new COSObjectKey((COSObject) destOutputProf ile), true);
COSDocument cosDocument = ctx.getDocument().getDocument(); COSDocument cosDocument = ctx.getDocument().getDocument();
COSStream stream = COSUtils.getAsStream(destOutputProfile, cosDocume nt); COSStream stream = COSUtils.getAsStream(destOutputProfile, cosDocume nt);
if (stream == null) if (stream == null)
{ {
addValidationError(ctx, new ValidationError(ERROR_GRAPHIC_OUTPUT _INTENT_INVALID_ENTRY, addValidationError(ctx, new ValidationError(ERROR_GRAPHIC_OUTPUT _INTENT_INVALID_ENTRY,
"OutputIntent object uses a NULL Object")); "OutputIntent object uses a NULL Object"));
return; return;
 End of changes. 3 change blocks. 
6 lines changed or deleted 13 lines changed or added

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