jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: Curious method definition
Date Wed, 12 Oct 2011 19:12:35 GMT

The else branch should probably be

defs.add(new QPropertyDefinitionImpl(pd));

I created JCR-3110 [1] for this.

Michael

[1] https://issues.apache.org/jira/browse/JCR-3110


On 12.10.11 6:34, Dave Brosius wrote:
> The following method in class /
> /
>
>     /org.apache.jackrabbit.spi.commons.QNodeTypeDefinitionImpl /
>
> would appear to return a set of serializable property definitions.
>
> However, it would appear that it just returns a set-version of the
> passed in parameter, irrespective of whether the property defs are
> serializable or not.
>
> A naive view would say the else block shouldn't be there.
>
> If all property defs should be returned, there are much simpler ways to
> write this code.
>
>
>
> /**
> * Returns a set of serializable property definitions for
> * <code>propDefs</code>.
> *
> * @param propDefs the SPI property definitions.
> * @return a set of serializable property definitions.
> */
> private static Set<QPropertyDefinition> getSerializablePropertyDefs(
> QPropertyDefinition[] propDefs) {
> Set<QPropertyDefinition> defs = new HashSet<QPropertyDefinition>();
> for (QPropertyDefinition pd : propDefs) {
> if (pd instanceof Serializable) {
> defs.add(pd);
> } else {
> *defs.add(pd);*
> }
> }
> return defs;
> }

Mime
View raw message