subDocName = mnfe.fullPath;
}
RepInfo subDoc = new RepInfo(subDocName);
subDoc.setModule(this);
subDoc.setFormat("ODF");
subDoc.setProfile((String)mimeTypeMap.get(mnfe.mediaType));
subDoc.setMimeType(mnfe.mediaType);
subDoc.setValid(true);
subDoc.setWellFormed(true);
subDoc.setConsistent(true);
repInfo.putEmbeddedRepInfo(subDocName, subDoc);
}
else if ( mnfe.mediaType.equals("") ||
mnfe.mediaType.equals(SKIP_TYPE) ||
mnfe.mediaType.startsWith(SKIP_APP)) {
}
else {
ZipEntry part = zipf.getEntry(mnfe.fullPath);
if (part==null) {
// Manifest holds information of "virtual"
// file entries, like Configurations2 (a directory)
break;
}
// good for processing
if (! part.isDirectory() &&
part.getSize() > 0) {
String partFileName = dumpPart(part, zipf);
if (mnfe.mediaType.equals(XRNG_TYPE)) {
if (! jd.doValidation(getResource(SCHEMA_OPENDOCUMENT),
partFileName,
errorStream)) {
NullHandler nullHandler = new NullHandler();
try {
jhoveBase.dispatch(_app,
null,
null,
nullHandler,
null,
new String[] {partFileName});
String partDocName;
int idxofp = mnfe.fullPath.indexOf("/");
if (idxofp<1) {
partDocName = mnfe.fullPath;
}
else {
partDocName= mnfe.fullPath.substring(0, idxofp-1);
}
RepInfo current = repInfo.getEmbeddedRepInfo(partDocName);
if (current==null) {
current=repInfo;
}
for (Iterator iter2 = nullHandler.getRepInfos(); iter2.hasNext();) {
if ( ((RepInfo)iter2.next()).getWellFormed() != RepInfo.TRUE) {
repInfo.setValid(false);
}
}
if (repInfo.getValid() == RepInfo.TRUE && ! alreadyNonPreservable) {
alreadyNonPreservable=true;
repInfo.setProfile((String)mimeTypeMap.get(repInfo.getMimeType()));
}
else {
StringBuffer buf = new StringBuffer("Invalid ODF Package, component ");
buf.append(mnfe.fullPath);
buf.append(" failed both Relaxed NG and normal XML validation therefore" );
buf.append(" is not well formed.");
repInfo.setValid(false);
repInfo.setMessage(new ErrorMessage(buf.toString()));
}
} catch (Exception excptn) {
StringBuffer buf = new StringBuffer("Invalid ODF Package, component ");
buf.append(mnfe.fullPath);
buf.append(" failed both Relaxed NG and normal XML validation " );
buf.append(" due this error: ");
buf.append(excptn.getMessage());
repInfo.setValid(false);
repInfo.setMessage(new ErrorMessage(buf.toString()));
}
}
if (mnfe.fullPath.equals(META_FILE)) {
MetaHandler metaHandler = new MetaHandler(repInfo);
parser.setContentHandler (metaHandler);
try {
parser.parse (partFileName);
} catch (SAXException excptn) {
repInfo.setValid(false);
repInfo.setMessage(new ErrorMessage("malformed meta.xml: " +
excptn.getMessage()));
}
}
}
else if (mnfe.mediaType.startsWith(IMG_TYPE)) {
// For the files in the Picture directory
NullHandler nullHandler = new NullHandler();
try {
jhoveBase.dispatch(_app,
null,
null,
nullHandler,
null,
new String[] {partFileName});
} catch (Exception excptn) {
StringBuffer xxx = new StringBuffer("File ");
xxx.append(mnfe.fullPath);
xxx.append("analysis failed. Cause: ");
xxx.append(excptn.getMessage());
repInfo.setMessage(new ErrorMessage(xxx.toString()));
}
String partDocName;
int idxofp = mnfe.fullPath.indexOf("/");
if (idxofp<10) {
partDocName = mnfe.fullPath;
}
else {
partDocName= mnfe.fullPath.substring(0, idxofp-1);
}
RepInfo current = repInfo.getEmbeddedRepInfo(partDocName);
if (current==null) {
current=repInfo;
}
for (Iterator iter2 = nullHandler.getRepInfos(); iter2.hasNext();) {
current.addContainedRepInfo((RepInfo)iter2.next());
}
}