[dna-issues] [JBoss JIRA] Commented: (DNA-336) JcrValue.asType(int desiredPropertyType) skips a number of valid conversions and has duplicate logic

Randall Hauch (JIRA) jira-events at lists.jboss.org
Tue Mar 24 14:18:23 EDT 2009


    [ https://jira.jboss.org/jira/browse/DNA-336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12458879#action_12458879 ] 

Randall Hauch commented on DNA-336:
-----------------------------------

Changed the JcrValue.asType(int) logic to first ensure the value matches the current required type (in most cases this should just return the actual value if the type is correct), and to then convert to the desired property type.  Corrected a number of conversions to include several combinations that was excluded.

Also added a check to the NameValueFactory to ensure that the relative path (of size 1) has no SNS index.

> JcrValue.asType(int desiredPropertyType) skips a number of valid conversions and has duplicate logic
> ----------------------------------------------------------------------------------------------------
>
>                 Key: DNA-336
>                 URL: https://jira.jboss.org/jira/browse/DNA-336
>             Project: DNA
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: 0.3
>            Reporter: Randall Hauch
>            Assignee: Randall Hauch
>             Fix For: 0.4
>
>
> Currently the JcrValue implementation has a method "asType(int propertyType)" that creates a new JcrValue object with the original values converted to the specified type. There are a couple of cases that are missed:
> 1) The code does not do any conversion to LONG of DOUBLE.  However, according to the JCR 1.0 specification, it is possible to convert these if the current type is a STRING, BINARY, DATE, DOUBLE, or LONG.  
> 2) The code does not do any conversion to REFERENCE.  However, according to the JCR 1.0 specification, it is possible to convert these if the current type is a STRING, NAME, or BINARY.
> 3) The conversion to a number of types exclude going to BINARY
> 4) The conversion to NAME and PATH both have somewhat complex logic to determine if a conversion is possible, even the current value factories do the same checks.  The code should just let the value factories do the checks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the dna-issues mailing list