Skip to content

Fix inconsistent behavior of Archive.add when path already exists - #191

Merged
petrberan merged 1 commit into
shrinkwrap:mainfrom
xjusko:issue#179
Mar 2, 2026
Merged

petrberan merged 1 commit into
shrinkwrap:mainfrom
xjusko:issue#179

Conversation

@xjusko

@xjusko xjusko commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

fixes #179

@xjusko xjusko assigned petrberan and unassigned petrberan Nov 27, 2025
@xjusko
xjusko requested a review from petrberan November 27, 2025 15:16
final NodeImpl parentNode = obtainParent(path.getParent());
if (parentNode != null) {
parentNode.removeChild(newNode);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Delete this extra line pls

@Test
public void testOverwriteUpdatesTreeStructure() {
ArchivePath path = new BasicPath("test.txt");
Asset asset1 = new org.jboss.shrinkwrap.api.asset.StringAsset("version1");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we make it into StringAsset without the whole path?

// Overwrite asset
archive.add(asset2, path);

// 3. Verify consistency

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Delete the "3." for consistency with the rest of the comments

@petrberan petrberan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@petrberan
petrberan merged commit 10973cc into shrinkwrap:main Mar 2, 2026
6 checks passed
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.

MemoryMapArchiveBase: inconsistent behavior of Archive.add(Asset, String) if a path already exists

2 participants