From dc65b62db211be11f874bd05808c3fdf86edc22f Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <andreas.romeyke@slub-dresden.de> Date: Mon, 24 Feb 2014 14:15:18 +0000 Subject: [PATCH] - add Exception handling if no iesec exists --- .../plugin/storage/nfs/SLUBStoragePlugin.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java b/java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java index 3cc8a67..bde3a27 100644 --- a/java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java +++ b/java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java @@ -75,8 +75,14 @@ public class SLUBStoragePlugin extends NFSStoragePlugin { log.info("SLUBStoragePlugin AAB"); String relativeDirectoryPath = File.separator; // get IE PID by calling IE-DNX record and search for ""internalIdentifierType" == "PID" + DnxDocument iedoc = storedEntityMetaData.getIeDnx(); + String entitytype = storedEntityMetaData.getEntityType().name(); DnxSection iesec = iedoc.getSectionById("internalIdentifier"); + if (null == iesec) { + log.error ("SLUBStoragePlugin.getStreamRelativePath no section in entity of type "+entitytype +" with 'internalIdentfier' in associated iedoc found, do you use plugin for others than permanent data? You should not!"); + throw new Exception("error, no section in entity of type "+entitytype +" with 'internalIdentfier' in associated iedoc found, do you use plugin for others than permanent data? You should not!"); + } String iepid = null; log.info ("SLUBStoragePlugin.getStreamRelativePath iesec="+iesec.toString() ); List<DnxSectionRecord> records = iesec.getRecordList(); @@ -90,9 +96,9 @@ public class SLUBStoragePlugin extends NFSStoragePlugin { // raise Exception if iepid is null if (null == iepid) { log.error ("SLUBStoragePlugin.getStreamRelativePath iesec="+iesec.toString() ); - throw new Exception("error, could not get IEPID for storedEntityMetaData:"+storedEntityMetaData.toString()); + throw new Exception("error, could not get IEPID for storedEntityMetaData:"+storedEntityMetaData.toString() +" of type " + entitytype); } - log.info("SLUBStoragePlugin.getStreamRelativePath iepid=" + iepid); + log.info("SLUBStoragePlugin.getStreamRelativePath iepid=" + iepid + " (entitytype="+ entitytype +")"); // get creationDate of "objectCharacteristics" String datestring = iedoc.getSectionKeyValue("objectCharacteristics", "creationDate"); Calendar date = Calendar.getInstance(); -- GitLab