]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6610: Provide better error response if import payload can't be parsed due...
authorAron Roberts <aron@socrates.berkeley.edu>
Sat, 2 May 2015 00:29:54 +0000 (17:29 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Sat, 2 May 2015 00:29:54 +0000 (17:29 -0700)
services/imports/service/src/main/java/org/collectionspace/services/imports/nuxeo/ImportCommand.java

index 1d758ee829f74d346b591ab485a2223627a9f5c5..20bf0a45d36cf7d356ae8e9052ffa9317be5447b 100644 (file)
@@ -76,9 +76,12 @@ public class ImportCommand {
             pipe.setReader(reader);
             pipe.setWriter(writer);
             DocumentTranslationMap dtm = pipe.run();
-            Map<DocumentRef, DocumentRef> documentRefs = dtm.getDocRefMap(); // FIXME: Should be checking for null here!
+            if (dtm == null) {
+                throw new Exception("Could not process import payload. Check XML markup for not-well-formed errors, elements not matching import schema, etc.");
+            }
+            Map<DocumentRef, DocumentRef> documentRefs = dtm.getDocRefMap();
             if (documentRefs != null && documentRefs.isEmpty()) {
-                throw new Exception("No valid records found in import payload. Check XML markup for not-well-formed errors, elements not matching import or document-specific schema, etc.");
+                throw new Exception("No valid records found in import payload. Check XML markup for elements not matching import or document-specific schema, etc.");
             }
             dump.append("<importedRecords>");
             for (Map.Entry<DocumentRef, DocumentRef> entry : documentRefs.entrySet()) {