Skip to content

Commit

Permalink
Update RemoteAssetsNodeSyncImpl.java
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgonzalez authored Jul 10, 2023
1 parent 0b49488 commit bc34812
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ private void setNodeTagsProperty(final ResourceResolver remoteAssetsResolver, fi
*/
private void setNodeSimpleArrayProperty(final JsonArray jsonArray, final String key, final Resource resource) throws RepositoryException {

try {
Object[] values = new Object[0];
try {
Object[] values;

if (jsonArray != null && jsonArray.size() > 0) {
JsonPrimitive firstVal = jsonArray.get(0).getAsJsonPrimitive();
Expand All @@ -376,11 +376,12 @@ private void setNodeSimpleArrayProperty(final JsonArray jsonArray, final String
values[i] = jsonArray.get(i).getAsString();
}
}
}

ValueMap resourceProperties = resource.adaptTo(ModifiableValueMap.class);
resourceProperties.put(key, values);
LOG.trace("Array property '{}' added for resource '{}'", key, resource.getPath());
// Only create a property if the array exists. We avoid creating an empty property since we don't know what type it is expected to be
ValueMap resourceProperties = resource.adaptTo(ModifiableValueMap.class);
resourceProperties.put(key, values);
LOG.trace("Array property '{}' added for resource '{}'", key, resource.getPath());
}
} catch (Exception e) {
LOG.error("Unable to assign property '{}' to resource '{}'", key, resource.getPath(), e);
}
Expand Down

0 comments on commit bc34812

Please sign in to comment.