[ 
https://issues.apache.org/jira/browse/OAK-10143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17699708#comment-17699708
 ] 

Miguel Moquillon edited comment on OAK-10143 at 3/13/23 3:40 PM:
-----------------------------------------------------------------

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}
 


was (Author: mmoquillon):
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
>            Reporter: Miguel Moquillon
>            Priority: Major
>         Attachments: ns_reg.properties
>
>




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

Reply via email to