Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing multiValue-Properties with empty Array will lead to wrong JcrType #22

Open
mbrahm opened this issue Nov 6, 2024 · 0 comments

Comments

@mbrahm
Copy link

mbrahm commented Nov 6, 2024

Hi,

the problem is more in the Pojo-Binding but I cannot create an issue in that repo.

when you have a properties definition like this in the JSON
"properties" : [ { "name" : "name", "type" : "STRING", "multiple" : true, "values" : [ ] }

and you import this with the exim plugin, the property is created with type DOUBLE. The reason is that DefaultJcrContentNodeBinder is not setting any type in the JcrProperty and one is guessed.

DefaultJcrContentNodeBinder.createJcrValuesFromContentProperty (around line 306)

`for (String stringValue : contentProp.getValues()) {
jcrValue = valueConverter.toJcrValue(contentProp.getType().toString(), stringValue);

            if (jcrValue != null) {
                jcrValues.add(jcrValue);
            }
        }`

The type is only known, when you we have at least one value and when the property is later set at the jcrNode the property is created as a DOUBLE (around line 195)
if (contentProp.isMultiple()) { try { jcrDataNode.setProperty(propName, jcrValues); <- here the resulting type is DOUBLE in case jcrValues is an empty list } catch (ArrayIndexOutOfBoundsException ignore) { // Due to REPO-1428, let's ignore this kind of exception for now... } }

For now we found a workaround by copy/pasting some of the code and setting the propertyTpe explicitly based on the ContentPropertyType. But it would be nice if you can fix this somehow.

Kind regards

Matthias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant