]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-4030 - preclude gratuitous NPE errors when processing payloads with extra...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Tue, 15 Nov 2011 00:24:32 +0000 (00:24 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Tue, 15 Nov 2011 00:24:32 +0000 (00:24 +0000)
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java

index 5e6f05251c3a8caf2387e2a1e13243a86d4cae7f..5c365d0566f57b98026e8fbcc74c9d9962783b71 100644 (file)
@@ -111,12 +111,16 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
                    String partLabel = part.getLabel();
                 try{
                     ObjectPartType partMeta = partsMetaMap.get(partLabel);
-        //            extractPart(docModel, partLabel, partMeta);
-                    Map<String, Object> unQObjectProperties = extractPart(docModel, partLabel, partMeta);
-                    addOutputPart(unQObjectProperties, partLabel, partMeta);
+                    // CSPACE-4030 - generates NPE if the part is missing.
+                    if(partMeta!=null) {
+                           Map<String, Object> unQObjectProperties = extractPart(docModel, partLabel, partMeta);
+                           if(unQObjectProperties!=null) {
+                               addOutputPart(unQObjectProperties, partLabel, partMeta);
+                           }
+                    }
                 } catch (Throwable t){
 
-                    System.out.println("===============================\r\nUnable to addOutputPart: "+partLabel
+                    logger.error("Unable to addOutputPart: "+partLabel
                                                +" in serviceContextPath: "+this.getServiceContextPath()
                                                +" with URI: "+this.getServiceContext().getUriInfo().getPath()
                                                +" error: "+t);