mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
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:
@@ -327,22 +327,21 @@ public class METSManifest
|
|||||||
return contentFiles;
|
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>();
|
contentFiles = new ArrayList<Element>();
|
||||||
Iterator fgi = fileSec.getChildren("fileGrp", metsNS).iterator();
|
Element fileSec = mets.getChild("fileSec", metsNS);
|
||||||
while (fgi.hasNext())
|
|
||||||
{
|
if (fileSec != null)
|
||||||
Element fg = (Element)fgi.next();
|
{
|
||||||
Iterator fi = fg.getChildren("file", metsNS).iterator();
|
Iterator fgi = fileSec.getChildren("fileGrp", metsNS).iterator();
|
||||||
while (fi.hasNext())
|
while (fgi.hasNext())
|
||||||
{
|
{
|
||||||
Element f = (Element)fi.next();
|
Element fg = (Element)fgi.next();
|
||||||
contentFiles.add(f);
|
Iterator fi = fg.getChildren("file", metsNS).iterator();
|
||||||
|
while (fi.hasNext())
|
||||||
|
{
|
||||||
|
Element f = (Element)fi.next();
|
||||||
|
contentFiles.add(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return contentFiles;
|
return contentFiles;
|
||||||
|
Reference in New Issue
Block a user