ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1371129 - /ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RepositoryObjectSerializer.java
Date Thu, 09 Aug 2012 10:00:22 GMT
Author: marrs
Date: Thu Aug  9 10:00:22 2012
New Revision: 1371129

URL: http://svn.apache.org/viewvc?rev=1371129&view=rev
Log:
Added extra null checks.

Modified:
    ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RepositoryObjectSerializer.java

Modified: ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RepositoryObjectSerializer.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RepositoryObjectSerializer.java?rev=1371129&r1=1371128&r2=1371129&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RepositoryObjectSerializer.java
(original)
+++ ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RepositoryObjectSerializer.java
Thu Aug  9 10:00:22 2012
@@ -126,14 +126,20 @@ public class RepositoryObjectSerializer 
         state.addProperty(AUTO_APPROVE, Boolean.toString(targetObject.getAutoApprove()));
 
         JsonArray artifactsFromShop = new JsonArray();
-        for (ArtifactObject a : targetObject.getArtifactsFromShop()) {
-            artifactsFromShop.add(new JsonPrimitive(a.getDefinition()));
+        ArtifactObject[] artifactObjects = targetObject.getArtifactsFromShop();
+        if (artifactObjects != null) {
+            for (ArtifactObject a : artifactObjects) {
+                artifactsFromShop.add(new JsonPrimitive(a.getDefinition()));
+            }
         }
         state.add(ARTIFACTS_FROM_SHOP, artifactsFromShop);
 
         JsonArray artifactsFromDeployment = new JsonArray();
-        for (DeploymentArtifact a : targetObject.getArtifactsFromDeployment()) {
-            artifactsFromDeployment.add(new JsonPrimitive(a.getUrl()));
+        DeploymentArtifact[] deploymentArtifacts = targetObject.getArtifactsFromDeployment();
+        if (deploymentArtifacts != null) {
+            for (DeploymentArtifact a : deploymentArtifacts) {
+                artifactsFromDeployment.add(new JsonPrimitive(a.getUrl()));
+            }
         }
         state.add(ARTIFACTS_FROM_DEPLOYMENT, artifactsFromDeployment);
 



Mime
View raw message