Skip to content

JCRVLT-830 check if a subfolder can be removed#416

Open
joerghoh wants to merge 35 commits into
masterfrom
JCRVLT-830-2
Open

JCRVLT-830 check if a subfolder can be removed#416
joerghoh wants to merge 35 commits into
masterfrom
JCRVLT-830-2

Conversation

@joerghoh

Copy link
Copy Markdown
Contributor

Implemented some additional checks to prevent the removal of unexpected files.

@joerghoh joerghoh requested a review from kwin February 26, 2026 13:52
Comment thread vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/WorkspaceFilter.java Outdated
@joerghoh

Copy link
Copy Markdown
Contributor Author

I made this feature configurable via OSGI. That should be only a temporary measure until we are sure that there are no side-effects. But it required a series of changes to otherwise unrelated classes to pass on that flag.

I added the OSGI property to both the FSPackageRegistry and the JcrPackageRegistry. Default is to have this feature enabled.

@joerghoh joerghoh requested review from kwin and reschke April 13, 2026 10:00
@joerghoh

Copy link
Copy Markdown
Contributor Author

The initial focus for the review should be to make sure that the existing behavior (which can delete content unintentionally) can be preserved with the correct configuration.

I understand that that adding this configuration increases the size of the change quite a bit, so I wonder if a system property (or env variable) would be a better solution to keep the change smaller.

@joerghoh joerghoh marked this pull request as ready for review June 15, 2026 13:53
@reschke

reschke commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The initial focus for the review should be to make sure that the existing behavior (which can delete content unintentionally) can be preserved with the correct configuration.

I understand that that adding this configuration increases the size of the change quite a bit, so I wonder if a system property (or env variable) would be a better solution to keep the change smaller.

...would it avoid changes in APIs thus package versions?

}
PropertyIterator props = node.getProperties();
while (props.hasNext()) {
Property prop = props.nextProperty();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to check all properties here?

I'll assume this is correct, so maybe add a short comment here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand; the code iterates over all properties here.

return isSubtreeFullyOverwrittenRecursive(subTree);
}

private boolean isSubtreeFullyOverwrittenRecursive(javax.jcr.Node node) throws RepositoryException {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this one is something the first one descends into, should't the method names be consistent?

}
NodeIterator children = node.getNodes();
while (children.hasNext()) {
if (!isSubtreeFullyOverwrittenRecursive(children.nextNode())) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. What about large collections?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that there is no way to avoid iterating all children. But that's a good point, I need to re-evaluate again under which circumstances this code is executed at all.

@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

4 participants