if (cb == null) {
// missing Metadata Key in catalog
ValidationError error = new ValidationError(
ValidationConstants.ERROR_METADATA_FORMAT,
"Missing Metadata Key in catalog");
throw new XpacketParsingException("Failed while retrieving xpacket",
error);
}
// no filter key
COSDictionary metadataDictionnary = COSUtils.getAsDictionary(cb, cdocument);
if (metadataDictionnary.getItem(COSName.FILTER) != null) {
// should not be defined
ValidationError error = new ValidationError(
ValidationConstants.ERROR_SYNTAX_STREAM_INVALID_FILTER,
"Filter specified in metadata dictionnary");
throw new XpacketParsingException("Failed while retrieving xpacket",
error);
}
PDStream stream = PDStream.createFromCOS(metadataDictionnary);
ByteArrayOutputStream bos = new ByteArrayOutputStream();