Author: tomekr Date: Wed Oct 7 12:45:09 2015 New Revision: 1707279 URL: http://svn.apache.org/viewvc?rev=1707279&view=rev Log: SLING-5108 Various little performance improvements
Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java?rev=1707279&r1=1707278&r2=1707279&view=diff ============================================================================== --- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java (original) +++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java Wed Oct 7 12:45:09 2015 @@ -180,12 +180,8 @@ public class ResourceWrapper implements */ @Override public String toString() { - final String className; - if (getClass().getSimpleName().length() == 0) { - className = getClass().getName(); - } else { - className = getClass().getSimpleName(); - } + final String simpleName = getClass().getSimpleName(); + final String className = (simpleName.length() > 0) ? simpleName : getClass().getName(); return className + ", type=" + getResourceType() + ", path=" + getPath() + ", resource=[" + getResource() + "]"; } Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java?rev=1707279&r1=1707278&r2=1707279&view=diff ============================================================================== --- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java (original) +++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java Wed Oct 7 12:45:09 2015 @@ -337,8 +337,9 @@ public class JcrPropertyMap return cachedValued; } + final String key; try { - final String key = escapeKeyName(name); + key = escapeKeyName(name); if (node.hasProperty(key)) { final Property prop = node.getProperty(key); return cacheProperty(prop); @@ -351,7 +352,7 @@ public class JcrPropertyMap // for compatibility with older versions we use the (wrong) ISO9075 path // encoding final String oldKey = ISO9075.encodePath(name); - if (node.hasProperty(oldKey)) { + if (!oldKey.equals(key) && node.hasProperty(oldKey)) { final Property prop = node.getProperty(oldKey); return cacheProperty(prop); } Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java?rev=1707279&r1=1707278&r2=1707279&view=diff ============================================================================== --- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java (original) +++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java Wed Oct 7 12:45:09 2015 @@ -145,7 +145,7 @@ public class JcrNodeResourceIterator imp if (parentPath == null) { path = node.getPath(); } else { - path = String.format("%s/%s", "/".equals(parentPath) ? "" : parentPath, node.getName()); + path = "/".equals(parentPath) ? '/' + node.getName() : parentPath + '/' + node.getName(); } return helper.pathMapper.mapJCRPathToResourcePath(path); }