DS-466 : Fixed bug where METSManifest was wrongly throwing an error if an Item AIP's METS file didn't include a <fileSec>. METS files which describe an Item may not include a <fileSec> if they contain no files (i.e. DSpace allows Items to exist which have no bundles/bitstreams attached -- this is a rare scenario, but AIP ingester needs to be able to support it). This bug was discovered during DuraCloud pilot testing.

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5892 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Tim Donohue
2010-11-22 20:31:32 +00:00
parent 7c0dca7b64
commit 55d4bc0cea

View File

@@ -327,22 +327,21 @@ public class METSManifest
return contentFiles;
}
Element fileSec = mets.getChild("fileSec", metsNS);
if (fileSec == null)
{
throw new MetadataValidationException("Invalid METS Manifest: DSpace requires a fileSec element, but it is missing.");
}
contentFiles = new ArrayList<Element>();
Iterator fgi = fileSec.getChildren("fileGrp", metsNS).iterator();
while (fgi.hasNext())
{
Element fg = (Element)fgi.next();
Iterator fi = fg.getChildren("file", metsNS).iterator();
while (fi.hasNext())
Element fileSec = mets.getChild("fileSec", metsNS);
if (fileSec != null)
{
Iterator fgi = fileSec.getChildren("fileGrp", metsNS).iterator();
while (fgi.hasNext())
{
Element f = (Element)fi.next();
contentFiles.add(f);
Element fg = (Element)fgi.next();
Iterator fi = fg.getChildren("file", metsNS).iterator();
while (fi.hasNext())
{
Element f = (Element)fi.next();
contentFiles.add(f);
}
}
}
return contentFiles;