Thanks. Regards Felix
Am 16.09.2010 22:32, schrieb Justin Edelson: > OK. I reverted and added a comment. > > Justin > > On 9/16/10 4:20 PM, Felix Meschberger wrote: >> Hi Justin, >> >> These have been done like this by intent: The constant is set during >> object creation as a special value to indicate that the super type has >> not be calculated yet. As such it is kind of a special "null" value. >> >> The reason for not using "null" in this case is, that "null" is in fact >> a valid value for a calculated super type as is any string happening to >> be "equal" to UNSET_RESOURCE_SUPER_TYPE. >> >> The only supertype value impossible to set is the exact object reference >> of UNSET_RESOURCE_SUPER_TYPE (unless the value is interned, but then ...) >> >> Regards >> Felix >> >> Am 16.09.2010 22:06, schrieb jus...@apache.org: >>> Author: justin >>> Date: Thu Sep 16 20:06:20 2010 >>> New Revision: 997904 >>> >>> URL: http://svn.apache.org/viewvc?rev=997904&view=rev >>> Log: >>> SLING-1781 - fixing String equality check >>> >>> Modified: >>> >>> sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java >>> >>> sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java >>> >>> Modified: >>> sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java >>> URL: >>> http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java?rev=997904&r1=997903&r2=997904&view=diff >>> ============================================================================== >>> --- >>> sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java >>> (original) >>> +++ >>> sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java >>> Thu Sep 16 20:06:20 2010 >>> @@ -93,7 +93,7 @@ class JcrNodeResource extends JcrItemRes >>> } >>> >>> public String getResourceSuperType() { >>> - if ( resourceSuperType == UNSET_RESOURCE_SUPER_TYPE ) { >>> + if ( UNSET_RESOURCE_SUPER_TYPE.equals(resourceSuperType) ) { >>> try { >>> if >>> (node.hasProperty(JcrResourceConstants.SLING_RESOURCE_SUPER_TYPE_PROPERTY)) >>> { >>> resourceSuperType = >>> node.getProperty(JcrResourceConstants.SLING_RESOURCE_SUPER_TYPE_PROPERTY).getValue().getString(); >>> @@ -101,7 +101,7 @@ class JcrNodeResource extends JcrItemRes >>> } catch (RepositoryException re) { >>> // we ignore this >>> } >>> - if ( resourceSuperType == UNSET_RESOURCE_SUPER_TYPE ) { >>> + if ( UNSET_RESOURCE_SUPER_TYPE.equals(resourceSuperType) ) { >>> resourceSuperType = null; >>> } >>> } >>> >>> Modified: >>> sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java >>> URL: >>> http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java?rev=997904&r1=997903&r2=997904&view=diff >>> ============================================================================== >>> --- >>> sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java >>> (original) >>> +++ >>> sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java >>> Thu Sep 16 20:06:20 2010 >>> @@ -69,7 +69,7 @@ public class StarResource extends Synthe >>> * to dynamically resolve the resource super type of this star >>> resource. >>> */ >>> public String getResourceSuperType() { >>> - if (resourceSuperType == UNSET_RESOURCE_SUPER_TYPE) { >>> + if (UNSET_RESOURCE_SUPER_TYPE.equals(resourceSuperType)) { >>> resourceSuperType = >>> ResourceUtil.getResourceSuperType(this.getResourceResolver(), >>> this.getResourceType()); >>> } >>> >>> >>> > >