joerghoh commented on code in PR #1:
URL: 
https://github.com/apache/sling-org-apache-sling-bundleresource-impl/pull/1#discussion_r933777448


##########
src/main/java/org/apache/sling/bundleresource/impl/BundleResource.java:
##########
@@ -186,7 +185,7 @@ Resource getChildResource(final String path) {
         return result;
     }
 
-    private static Object getValue(final JsonValue value, final boolean 
topLevel) {
+    private static Object getValue(final JsonValue value) {

Review Comment:
   same here, seems like a cleanup unrelated to the PR



##########
src/main/java/org/apache/sling/bundleresource/impl/BundleResource.java:
##########
@@ -229,7 +228,11 @@ public String getPath() {
 
     @Override
     public String getResourceType() {
-        return this.valueMap.get(ResourceResolver.PROPERTY_RESOURCE_TYPE, 
String.class);
+        String resourceType = 
this.valueMap.get(ResourceResolver.PROPERTY_RESOURCE_TYPE, String.class);
+        if ( resourceType == null ) {
+            resourceType = this.isFolder ? NT_FOLDER : NT_FILE;

Review Comment:
   food for thoughts: Why do we use JCR nodetypes here? Wouldn't it be possible 
to use some sling "default resourcetypes"?



##########
src/main/java/org/apache/sling/bundleresource/impl/BundleResource.java:
##########
@@ -138,17 +135,19 @@ public BundleResource(final ResourceResolver 
resourceResolver,
                 try {
                     final URL url = this.cache.getEntry(propsPath);
                     if (url != null) {
-                        final JsonObject obj = 
Json.createReader(url.openStream()).readObject();
-                        for(final Map.Entry<String, JsonValue> entry : 
obj.entrySet()) {
-                            final Object value = getValue(entry.getValue(), 
true);
-                            if ( value != null ) {
-                                if ( value instanceof Map ) {
-                                    if ( children == null ) {
-                                        children = new HashMap<>();
+                        try (JsonReader reader = 
Json.createReader(url.openStream())) {

Review Comment:
   If this is a general refactoring, please raise a dedicated PR for it. Mixing 
multiple aspects in a single PR makes it harder to review.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to