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

Miguel Moquillon updated OAK-10143:
-----------------------------------
    Description: 
With some old jackrabbit 2 repositories, the 
{code:java}
JCR_HOME/repository/namespaces/ns_reg.properties{code}
file contains as namespace an empty string instead of the predefined name 
_empty.key_ for empty namespace.

See attachments as an example.

In such circumstances, the upgrade of the Jackrabbit 2 JCR to the Oak one fails 
because the preconditions of a non null or a non empty property name isn't 
satisfied (checked by {{{}AbstractNodeState#checkValidName(String){}}}).

A way to avoid this is to check the emptiness of the {{prefixHint}} variable in 
{{RepositoryUpgrade#copyNamespaces(...)}} like this:
{code:java}
if (".empty.key".equals(prefixHint) || prefixHint.isEmpty()) {
    prefix = ""; // the default empty mapping is not stored
} else {
    prefix = addCustomMapping(namespaces, uri, prefixHint);
}{code}
 

> Issue when oak-upgrade fetch all the namespaces from very old jackrabbit 2 
> repository
> -------------------------------------------------------------------------------------
>
>                 Key: OAK-10143
>                 URL: https://issues.apache.org/jira/browse/OAK-10143
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: upgrade
>    Affects Versions: 1.48.0
>            Reporter: Miguel Moquillon
>            Priority: Major
>         Attachments: ns_reg.properties
>
>
> With some old jackrabbit 2 repositories, the 
> {code:java}
> JCR_HOME/repository/namespaces/ns_reg.properties{code}
> file contains as namespace an empty string instead of the predefined name 
> _empty.key_ for empty namespace.
> See attachments as an example.
> In such circumstances, the upgrade of the Jackrabbit 2 JCR to the Oak one 
> fails because the preconditions of a non null or a non empty property name 
> isn't satisfied (checked by {{{}AbstractNodeState#checkValidName(String){}}}).
> A way to avoid this is to check the emptiness of the {{prefixHint}} variable 
> in {{RepositoryUpgrade#copyNamespaces(...)}} like this:
> {code:java}
> if (".empty.key".equals(prefixHint) || prefixHint.isEmpty()) {
>     prefix = ""; // the default empty mapping is not stored
> } else {
>     prefix = addCustomMapping(namespaces, uri, prefixHint);
> }{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to