Module module = info.getModule (); _writer.println (margin + "RepresentationInformation: " + info.getUri ()); if (module != null) { _writer.println (margin + " ReportingModule: " + module.getName() + Date date = info.getCreated (); if (date != null) { _writer.println (margin + " Created: " + dateTime.format (date)); date = info.getLastModified (); if (date != null) { _writer.println (margin + " LastModified: " + dateTime.format (date)); long size = info.getSize (); if (size > -1) { _writer.println (margin + " Size: " + size); String s = info.getFormat (); if (s != null) { _writer.println (margin + " Format: " + s); s = info.getVersion (); if (s != null) { _writer.println (margin + " Version: " + s); switch (info.getWellFormed ()) { case RepInfo.TRUE:
/** * Check signature. Bytestreams have no signatures, but since any * byte stream is considered a valid Bytestream, return immediately * doing nothing. The RepInfo._consistent flag will remain true. */ @Override public void checkSignatures (File file, InputStream stream, RepInfo info) { info.setFormat (this._format[0]); info.setMimeType (this._mimeType[0]); info.setModule (this); info.setSigMatch(this._name); } }
info.setModule (this); info.setFormat (this._format[0]); info.setMimeType (this._mimeType[0]); info.setSize (this._nByte); if (this._nByte == 0) { info.setMessage (new InfoMessage (CoreMessageConstants.INF_FILE_EMPTY));
/** 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); } } }
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; }
info.setFormat (_format[0]); info.setMimeType (_mimeType[0]); info.setModule (this); _aesMetadata.setPrimaryIdentifier(info.getUri()); if (info.getURLFlag ()) { _aesMetadata.setOtherPrimaryIdentifierType("URI"); info.getChecksum().isEmpty()) { _ckSummer = new Checksummer (); _cstream = new ChecksumInputStream (stream, _ckSummer); int ch = readUnsignedByte(_dstream, this); if (ch != sigByte[i]) { info.setMessage(new ErrorMessage(MessageConstants.ERR_NOT_AIFF_CHU, 0)); info.setWellFormed (RepInfo.FALSE); return 0; info.setSigMatch(_name); info.setWellFormed (RepInfo.FALSE); info.setMessage (new ErrorMessage (MessageConstants.ERR_EOF_UNEXPECTED, _nByte)); return 0; info.setWellFormed (RepInfo.FALSE); info.setMessage (new ErrorMessage (MessageConstants.ERR_COMMON_CHUNK_MISS)); info.setWellFormed (RepInfo.FALSE);
throws IOException { initParse(); info.setFormat(_format[0]); info.setMimeType(_mimeType[0]); info.setModule(this); && info.getChecksum().isEmpty()) { _ckSummer = new Checksummer(); _cstream = new ChecksumInputStream(stream, _ckSummer); dbyt = readUnsignedByte(_dstream, this); if (dbyt != 0XFF) { info.setMessage(new ErrorMessage( MessageConstants.ERR_MARKER_MISSING + dbyt, _nByte)); info.setWellFormed(false); return 0; if (!_seenJFIF && !_seenSPIFF && !_seenExif && !_seenJPEGL && _numSegments >= 2 && !_reportedJFIF) { info.setMessage(new ErrorMessage( MessageConstants.ERR_START_SEGMENT_MISSING, _nByte)); info.setValid(false); _reportedJFIF = true; info.setMessage(msg); info.setValid(false); break loop1;
info.setFormat (_format[0]); info.setMimeType (_mimeType[0]); info.setModule (this); if (_textMD == null || parseIndex == 0) { _textMD = new TextMDMetadata(); info.getChecksum ().isEmpty()) { _ckSummer = new Checksummer (); info.setMessage (new InfoMessage(MessageConstants.INF_LEX_HND_UNSPPRTD)); info.setMessage (new InfoMessage (MessageConstants.INF_DEC_HND_UNSPPRTD)); info.setMessage(new ErrorMessage (f.getMessage())); info.setWellFormed (false); // actually not the file's fault return 0; info.setMessage (new InfoMessage (MessageConstants.INF_SAX_VALID_UNSPPRTD)); info.setMessage (new InfoMessage (MessageConstants.INF_SAX_NMSPC_UNSPPRTD)); info.setMessage (new InfoMessage (MessageConstants.INF_XML_SCHMID_UNSPPRTD)); info.setMessage (new ErrorMessage (MessageConstants.ERR_FILE_NOT_FOUND,
: 0); _dstream = new DataInputStream(_rafStream); info.setFormat(_format[0]); info.setMimeType(_mimeType[0]); info.setModule(this); info.setMessage(new ErrorMessage(MessageConstants.ERR_JP2_SIGNATURE_INVALID, i)); info.setWellFormed(false); return; info.setSigMatch(_name); if (info.getWellFormed() == RepInfo.FALSE) { return; info.setProperty(metadata); if (info.getChecksum().isEmpty()) { Checksummer ckSummer = new Checksummer(); calcRAChecksum(ckSummer, raf); if (!rreqSeen || info.getValid() != RepInfo.TRUE) { jpxCompliant = false; || info.getValid() != RepInfo.TRUE) { jp2Compliant = false; info.setProfile("JP2");
info.setFormat(_format[0]); info.setMimeType(_mimeType[0]); info.setModule(this); initialBytes = new int[4]; info.setNote("Additional representation information includes " + "the line endings: CR, LF, or CRLF"); _nByte = 0; && info.getChecksum().isEmpty()) { ckSummer = new Checksummer(); _cstream = new ChecksumInputStream(stream, ckSummer); if (_nByte < 4) { isMark = checkMark(b[0], info); if (info.getWellFormed() == RepInfo.FALSE) { return 0; "Value = " + ((char) b[0]) + " (0x" + Integer.toHexString(b[0]) + ")", _nByte); info.setMessage(error); info.setWellFormed(false); return 0; if (info.getWellFormed() == RepInfo.FALSE) { return 0; info.setMessage(error); info.setWellFormed(false);
RepInfo info = new RepInfo(dirFileOrUri); if (uri != null && uri.isAbsolute()) { URL url = null; info.setMessage(new ErrorMessage(CoreMessageConstants.ERR_FILE_NOT_FOUND)); info.setWellFormed(RepInfo.UNDETERMINED); info.show(handler); } else if (!file.isFile() || !file.canRead()) { _logger.info("File cannot be read"); info.setMessage(new ErrorMessage(CoreMessageConstants.ERR_FILE_READ)); info.setWellFormed(RepInfo.UNDETERMINED); info.show(handler); } else if (handler.okToProcess(dirFileOrUri)) { info.setSize(file.length()); if (lastModified < 0) { lastModified = file.lastModified(); info.setLastModified(new Date(lastModified)); info.setMessage(new ErrorMessage(CoreMessageConstants.EXC_UNEXPECTED)); info.setWellFormed(RepInfo.UNDETERMINED); _logger.log(Level.SEVERE, CoreMessageConstants.EXC_UNEXPECTED, e); RepInfo infc = (RepInfo) info.clone(); if (infc.getWellFormed() == RepInfo.TRUE) { info.copy(infc); break;
_logger.info("TiffModule parsing file"); initParse(); info.setModule(this); info.setMimeType(_mimeType[0]); info.setFormat(_format[0]); info.setSigMatch(_name); info.setVersion(Integer.toString(_version) + ".0"); info.setValid(false); ListIterator<String> eter = errors.listIterator(); while (eter.hasNext()) { info.setMessage(new ErrorMessage(eter.next())); if (!prof.isAlreadyOK()) { if (prof.satisfiesProfile(ifd)) { info.setProfile(prof.getText()); info.setProfile(_exifMainProfile.getText()); info.setProfile(_dngMainProfile.getText()); info.setProperty(new Property("TIFFMetadata", PropertyType.PROPERTY, PropertyArity.ARRAY, tiffMetadata)); } catch (TiffException e) { info.setMessage(new ErrorMessage(e.getMessage(), e.getOffset())); info.setWellFormed(false); return;
info.setModule (this); info.setFormat (_format[0]); info.setMimeType (_mimeType[0]); info.getChecksum().isEmpty()) { _ckSummer = new Checksummer (); _cstream = new ChecksumInputStream (stream, _ckSummer); info.setSigMatch(_name); while (moreToCome) { moreToCome = readBlock (info); if (info.getWellFormed () == RepInfo.FALSE) { return 0; info.setSize (_cstream.getNBytes ()); info.setChecksum (new Checksum (_ckSummer.getCRC32 (), ChecksumType.CRC32)); String value = _ckSummer.getMD5 (); if (value != null) { info.setChecksum (new Checksum (value, ChecksumType.MD5)); info.setChecksum (new Checksum (value, ChecksumType.SHA1)); metaArray[2] = _xmpProp; info.setProperty (_metadata); return 0;
@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; }
info.setFormat(_format[0]); info.setMimeType(_mimeType[0]); info.setModule(this); _objects = new HashMap(); _raf = raf; info.setMessage(new ErrorMessage(MessageConstants.ERR_XREF_TABLES_BROKEN, // PDF-HUL-134 _parser.getOffset())); info.setWellFormed(false); return; info.getChecksum().isEmpty()) { ckSummer = new Checksummer(); calcRAChecksum(ckSummer, raf); info.setVersion(_version); metadataList.add(new Property(PROP_NAME_OBJECTS, PropertyType.INTEGER, try { addFontsProperty(metadataList); } catch (NullPointerException e) { info.setMessage(new ErrorMessage(MessageConstants.ERR_FONT_PROP_PARSING, e.toString())); // PDF-HUL-135 info.setMessage(new InfoMessage(MessageConstants.INF_FONT_REPORT_LIMIT, // PDF-HUL-136 MessageConstants.INF_FONT_REPORT_LIMIT_SUB + _nFonts)); info.setProperty(_metadata); if (info.getWellFormed() == RepInfo.TRUE) {
info = new RepInfo(file.getAbsolutePath()); info.setSize(file.length()); if (module != null) { if (!jb.processFile(jhoveApp, module, false, file, info)) { } else { if (DEBUG) { logger.fine("mime type (module specified above)="+info.getMimeType()); while (iter.hasNext()) { Module mod = iter.next(); RepInfo infc = (RepInfo) info.clone(); continue; if (infc.getWellFormed() == RepInfo.TRUE) { info.copy(infc); break; } else { info.setSigMatch(infc.getSigMatch());
info.setFormat (_format[0]); info.setMimeType (_mimeType[0]); info.setModule (this); info.getChecksum ().size () == 0) { _ckSummer = new Checksummer (); _cstream = new ChecksumInputStream (stream, _ckSummer); if (byt != _sigBytes[i]) { msg = new ErrorMessage("File header does not match PNG signature"); info.setMessage(msg); info.setWellFormed(false); return 0; info.setMessage (msg); info.setWellFormed (false); return 0; if (storedCRC != calculatedCRC) { msg = new ErrorMessage("Incorrect CRC in chunk " + chunk.chunkTypeString()); info.setMessage(msg); info.setWellFormed(false); return 0; msg = new ErrorMessage ("Unexpected end of file", _nByte); info.setMessage (msg); info.setWellFormed (false); return 0;
String mime = info.getMimeType (); if (mime != null) { if (info.getWellFormed () == RepInfo.TRUE) { if (info.getValid () == RepInfo.TRUE) { status = "valid"; for (Checksum checksum : info.getChecksum()) { if (checksum.getType ().equals (ChecksumType.MD5)) { md5 = checksum.getValue (); String uri = info.getUri ();
if (diagnostics.hasErrors()) { for (Diagnosis d : diagnostics.getErrors()) { repInfo.setMessage(new ErrorMessage(extractDiagnosisType(d), extractDiagnosisMessage(d))); repInfo.setConsistent(false); repInfo.setMessage(new InfoMessage(extractDiagnosisType(d), extractDiagnosisMessage(d))); if(e.getValue() > maxCount) { maxCount = e.getValue(); repInfo.setVersion(e.getKey()); repInfo.setProperty(new Property("Records", PropertyType.PROPERTY, PropertyArity.LIST, recordProperties)); repInfo.setSize(reader.getConsumed());
info.setSigMatch(_name); _reportedSigMatch = true; info.setMessage(new ErrorMessage( MessageConstants.ERR_SPIF_MARKER_MISSING, _nByte)); info.setValid(false); info.setVersion(vsn); readUnsignedByte(_dstream, this); readUnsignedByte(_dstream, this);