/** * Performs the appropriate disparagement act on a RepInfo * object. For a PdfInvalidException, this is to call * <code>setValid (false)</code>. */ @Override public void disparage (RepInfo info) { info.setValid (false); } }
/** Report an instance of invalidity. */ protected void reportInvalid(String s, RepInfo info) { info.setMessage(new ErrorMessage(s)); info.setValid(false); }
/** Reports a duplicate chunk. */ protected void dupChunkError(RepInfo info, String chunkName) { info.setMessage(new ErrorMessage(MessageConstants.ERR_CHUNK_DUP + chunkName, _nByte)); info.setValid(false); }
protected void dupChunkError (RepInfo info, String chunkName) { info.setMessage (new ErrorMessage (MessageConstants.ERR_MULTI_CHUNK_NOT_PERM + chunkName + MessageConstants.ERR_MULTI_CHUNK_NOT_PERM_2, _nByte)); info.setValid (false); } }
/** * Go through all the IFD's, calling checkIFDValidity on each one that is a * standard IFD. (Private IFD's have different requirements, and for the * moment aren't checked here.) If any of them are invalid, set info's valid * field to false. Validity problems are non-fatal, and more information is * better, so we keep going with all IFDs even if we find problems. */ protected void checkValidity(List<IFD> ifds, RepInfo info) { _logger.info("TiffModule checking validity of IFDs"); ListIterator<IFD> iter = ifds.listIterator(); while (iter.hasNext()) { try { IFD ifd = iter.next(); if (ifd instanceof TiffIFD) { checkValidity((TiffIFD) ifd, info); } } catch (TiffException e) { info.setMessage(new ErrorMessage(e.getMessage(), e.getOffset())); info.setValid(false); } } }
(MessageConstants.ERR_DATA_ENTRY_URL_BOX_VERSION_FLAG_INVALID, _module.getFilePos ())); _repInfo.setValid (false); break;
info.setMessage(new ErrorMessage(msg, // PDF-HUL-122 _parser.getOffset())); info.setValid(false);
public void processChunk(RepInfo info) throws Exception { processChunkCommon(info); _module.setIendSeen(true); // This chunk is supposed to have a length of 0. // If it's bigger, eat the extra bytes and declare the // file invalid but not ill-formed. if (length > 0) { ErrorMessage msg = new ErrorMessage("IEND chunk is not empty"); info.setMessage (msg); info.setValid (false); for (int i = 0; i < length; i++) { readUnsignedByte(); } } }
/** Puts the item's error message into the RepInfo * object, and affects the wellFormed and valid * flags as required. Once it's determined that * a document is not well-formed, error elements indicating * only invalidity will be ignored. However, additional * messages that indicate the current level of badness * (not well-formed or invalid) will continue to be reported.*/ public void reportError (RepInfo info) { // If we're already not well-formed and the error element // is for invalidity, don't bother with it. if (info.getWellFormed() == RepInfo.FALSE && !_illFormed) { return; } info.setMessage (new ErrorMessage (_message, _image)); if (_illFormed) { info.setWellFormed (false); } else { info.setValid(false); } } }
info.setValid(false); return null;
info.setMessage(new ErrorMessage(MessageConstants.ERR_XMP_INVALID, // PDF-HUL-101 _parser.getOffset())); info.setValid(false); return false;
ErrorMessage msg = new ErrorMessage ("Invalid date in tIME chunk"); info.setMessage(msg); info.setValid(false); // just call this invalid, not ill-formed return;
protected void readDTT(RepInfo info) throws IOException { readUnsignedShort(_dstream); if (_tiling == null) { info.setMessage(new ErrorMessage( MessageConstants.ERR_DTT_SEG_MISSING_PREV_DTI, _nByte)); info.setValid(false); return; } long vertScale = readUnsignedInt(_dstream); long horScale = readUnsignedInt(_dstream); long vertOffset = readUnsignedInt(_dstream); long horOffset = readUnsignedInt(_dstream); _tiling.addTile(vertScale, horScale, vertOffset, horOffset); _seenJPEGL = false; // Not permitted under JPEG-L }
private void doCloseTag (JHCloseTag tag, RepInfo info) { String name = tag.getName (); // Dig down into the stack till we find an element which // matches this. If there's none, report the document // as not well formed. Also allow for the special case // of an empty body. (An empty head is illegal.) int idx = elementStack.search (name); if (idx == -1) { info.setMessage (new ErrorMessage (MessageConstants.ERR_HTML_CLOSED_TAG_NO_OPEN, "Name = " + name + ", Line = " + tag.getLine () + ", Column = " + tag.getColumn ())); info.setValid (false); } else { // Pop the stack down to the level of the matching tag. elementStack.popTo (idx); } }
info.setMessage(new ErrorMessage (MessageConstants.ERR_HEAD_ELE_MISS)); info.setValid (false);
@Override public int parse(InputStream stream, RepInfo info, int parseIndex) throws IOException { GzipReader reader = new GzipReader(new InputStreamNoSkip(stream), 8192); try { info.setFormat(_format[0]); info.setVersion("4.3"); // Is it really version 4.3? info.setMimeType(_mimeType[0]); info.setModule(this); parseRecords(reader); info.setValid(reader.isCompliant()); info.setWellFormed(reader.isCompliant()); reportResults(reader, info); if (reader.isCompliant()) { info.setSigMatch(_name); } } catch (Exception e) { info.setMessage(new ErrorMessage(e.getMessage())); info.setValid(false); info.setWellFormed(false); } finally { if(reader != null) { reader.close(); reader = null; } } return 0; }
protected boolean parseHeader(RepInfo info) throws IOException { PdfHeader header = PdfHeader.parseHeader(_parser); if (header == null) { info.setWellFormed(false); info.setMessage(new ErrorMessage(MessageConstants.ERR_PDF_HEADER_MISSING, 0L)); // PDF-HUL-137 return false; } if (!header.isVersionValid()) { info.setValid(false); info.setMessage(new ErrorMessage(MessageConstants.ERR_PDF_MINOR_INVALID, 0L)); // PDF-HUL-148 } _version = header.getVersionString(); _pdfACompliant = header.isPdfACompliant(); info.setSigMatch(_name); return true; }
(MessageConstants.ERR_OPACITY_BOX_OTYP_INVALID, _module.getFilePos ())); _repInfo.setValid (false); return false;
@Override public int parse(InputStream stream, RepInfo info, int parseIndex) throws IOException { WarcReader reader = WarcReaderFactory.getReader(new InputStreamNoSkip(stream), 8192); try { info.setFormat(_format[0]); info.setMimeType(_mimeType[0]); info.setModule(this); setReaderOptions(reader); parseRecords(reader); info.setValid(reader.isCompliant()); info.setWellFormed(reader.isCompliant()); reportResults(reader, info); if (reader.isCompliant()) { info.setSigMatch(_name); } } catch (JhoveException e) { info.setMessage(new ErrorMessage(e.getMessage())); info.setValid(false); info.setWellFormed(false); } finally { if(reader != null) { reader.close(); reader = null; } } return 0; }