[ 
https://issues.apache.org/jira/browse/JCR-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Meschberger updated JCR-1119:
-----------------------------------

    Description: 
The SimpleFieldsHelper.retrieveSimpleField method is used to load JCR 
properties into simple Java object fields according to the mapping descriptor. 
If the node does not have the named property, a WARN message is emited.

If the missing property is defined as optional in the node type definition, it 
is quite normal, that it may be missing. Therefore emitting a WARN message does 
not seem appropriate. It would be better, to do the following (in order):

   If the missing property is declared to be required in the descriptor, throw 
an exception
   else if the descriptor has a default value for the missing property, use 
that value
   else if the property is defined with a default value in the node type 
definition, use that value
   else emit a DEBUG message and leave the field undefined

Not sure, whether it makes absolute sense to define a property as mandatory in 
the descriptor but not in the node type definition. Are there any opinions on 
that ?

  was:
The SimpleFieldsHelper.retrieveSimpleField method is used to load JCR 
properties into simple Java object fields according to the mapping descriptor. 
If the node does not have the named property, a WARN message is emited.

If the missing property is defined as optional in the node type definition, it 
is quite normal, that it may be missing. Therefore emitting a WARN message does 
not seem appropriate. It would be better, to do the following:

   * If the property is declared to be required in the descriptor, yield an 
error


> SimpleFieldsHelper emits a lot warnings
> ---------------------------------------
>
>                 Key: JCR-1119
>                 URL: https://issues.apache.org/jira/browse/JCR-1119
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jcr-mapping
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: 1.4
>
>
> The SimpleFieldsHelper.retrieveSimpleField method is used to load JCR 
> properties into simple Java object fields according to the mapping 
> descriptor. If the node does not have the named property, a WARN message is 
> emited.
> If the missing property is defined as optional in the node type definition, 
> it is quite normal, that it may be missing. Therefore emitting a WARN message 
> does not seem appropriate. It would be better, to do the following (in order):
>    If the missing property is declared to be required in the descriptor, 
> throw an exception
>    else if the descriptor has a default value for the missing property, use 
> that value
>    else if the property is defined with a default value in the node type 
> definition, use that value
>    else emit a DEBUG message and leave the field undefined
> Not sure, whether it makes absolute sense to define a property as mandatory 
> in the descriptor but not in the node type definition. Are there any opinions 
> on that ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to