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

MODE-2637 : NullPointerException in IndexChangeAdapter #1606

Merged
merged 1 commit into from Nov 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -834,9 +834,13 @@ protected void modifyProperties( NodeKey key,
newValues.addAll(Arrays.asList(newProperty.getValuesAsArray()));
}
} else if (mixinsTypeChange instanceof PropertyAdded) {
newValues.addAll(Arrays.asList(mixinsTypeChange.getProperty().getValuesAsArray()));
if (!mixinsTypeChange.getProperty().isEmpty()) {
newValues.addAll(Arrays.asList(mixinsTypeChange.getProperty().getValuesAsArray()));
}
} else if (mixinsTypeChange instanceof PropertyRemoved) {
oldValues.addAll(Arrays.asList(mixinsTypeChange.getProperty().getValuesAsArray()));
if (!mixinsTypeChange.getProperty().isEmpty()) {
oldValues.addAll(Arrays.asList(mixinsTypeChange.getProperty().getValuesAsArray()));
}
}

if (primaryTypeChange == null && mixinsTypeChange == null) {
Expand Down
Expand Up @@ -804,6 +804,24 @@ public void shouldCorrectlyCloneWorkspacesWithCorrespondingContent() throws Exce

}


@Test
@FixFor("MODE-2637")
public void copyNodeWithEmptyMultiValueProperty() throws Exception {
// start a repository with some indexes
startRepositoryWithConfigurationFrom("config/repo-config-local-provider-and-nodetype-index.json");
session.getRootNode().addNode("a");
Node node = session.getNode("/a");
node.addMixin("mix:referenceable");
session.save();
node.removeMixin("mix:referenceable");
session.save();
assertTrue(node.hasProperty("jcr:mixinTypes"));
assertThat(node.getProperty("jcr:mixinTypes").getValues().length, is(0));
session.getWorkspace().copy(session.getNode("/a").getPath(), "/a2");
session.save();
}

protected void checkCorrespondingPaths( String workspace,
final String... otherWorkspaces ) throws Exception {
final Session session = repository.login(workspace);
Expand Down
@@ -0,0 +1,18 @@
{
"name": "QueryableRepo",
"indexProviders": {
"local": {
"classname": "org.modeshape.jcr.index.local.LocalIndexProvider",
"directory": "target/local_index_test_repository"
},
},
"indexes": {
"nodeTypes": {
"kind": "nodeType",
"provider": "local",
"synchronous": true,
"nodeType": "nt:base",
"columns": "jcr:primaryType(STRING)"
}
}
}