Skip to content

Fix adjustedPath on Windows - #147

Merged
petrberan merged 1 commit into
shrinkwrap:mainfrom
juliaberkhout:main
Aug 16, 2024
Merged

petrberan merged 1 commit into
shrinkwrap:mainfrom
juliaberkhout:main

Conversation

@juliaberkhout

@juliaberkhout juliaberkhout commented Apr 13, 2022 •

Copy link
Copy Markdown
Contributor

Commit 4293b54 removes the code that replaces the File.seperator with a forward slash.
This replacement is necessary on Windows, so this removal makes that resources from a JAR can no longer be found while trying to add them to the archive.

Example: See https://github.com/arquillian/arquillian-core/blob/master/protocols/servlet/src/main/java/org/jboss/arquillian/protocol/servlet/v_3/ProtocolDeploymentAppender.java#L41. The resource "org/jboss/arquillian/protocol/servlet/v_3/web-fragment.xml" is added, which leads to this method https://github.com/shrinkwrap/shrinkwrap/blob/main/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/container/ContainerBase.java#L805. On Windows, adjustedPath = org\jboss\arquillian\protocol\servlet\v_3\web-fragment.xml and the resource cannot be found, which leads to the IllegalArgumentException thrown on L824. Replacing adjustedPath with org/jboss/arquillian/protocol/servlet/v_3/web-fragment.xml solves this problem.

@ALRubinger

Copy link
Copy Markdown
Member

Thank you @juliaberkhout!

Is there a failing test in the ShrinkWrap suite on Windows? If not, can we add one which isolates the problem and shows the failure to this PR?

@juliaberkhout

Copy link
Copy Markdown
Contributor Author

I have in fact multiple test failures on Windows (with and without my fix) so maybe there are more bugs like this one. I'll look into that!

Commit 4293b54 removes the code that replaces the File.seperator with a forward slash. This replacement is necessary on Windows, so this removal makes that resources from a JAR can no longer be found while trying to add them to the archive.
@juliaberkhout

Copy link
Copy Markdown
Contributor Author

@ALRubinger There was one failing test, DynamicContainerTestBase#testAddManifestStringTargetResourceFromJar, which is exactly the situation I fixed with this PR. But in this testcase, indexOfExclamationPoint is actually -1, so that answers my own question about where to put the replace (not in the if-statement). With that change, there are no more test failures. I fixed this with a git commit --amend.

@ALRubinger

Copy link
Copy Markdown
Member

Appreciate that!

I'm prepping a Windows install to review the PR and get this upstream.

@juliaberkhout

Copy link
Copy Markdown
Contributor Author

Hi @ALRubinger, are there any updates on the review of this PR?

bartoszmajsak added a commit that referenced this pull request May 4, 2022
@bartoszmajsak

bartoszmajsak commented May 4, 2022 •

Copy link
Copy Markdown
Contributor

@ALRubinger @juliaberkhout it seems to be working fine. I created #148 to verify that. This very PR should be merged first though, as mine includes this fix - without it we already have a bunch of tests failing.

OR I can revert fix commit, but then we end up with broken build on the main branch.

@juliaberkhout

Copy link
Copy Markdown
Contributor Author

@bartoszmajsak I'm not sure what you mean (and what should be merged first). All is fine by me, in the end I want to use a version of shrinkwrap that includes this fix.

So: do you want me to merge this PR? Or should you guys do something first?

@bartoszmajsak

bartoszmajsak commented May 12, 2022 •

Copy link
Copy Markdown
Contributor

@juliaberkhout What I meant is that my PR (#148) has Windows CI job and your fix cherry-picked. I'm suggesting to merge this PR first to have the fix and proper attribution preserved and only then bring Windows job by squashing commits in my #148 PR.

I leave the merge and review up to @ALRubinger.

@juliaberkhout

Copy link
Copy Markdown
Contributor Author

@ALRubinger Any updates? We would really appreciate the merge of this fix, because we cannot run our Arquillian tests on Windows at this moment.

@robinvandenbogaard

Copy link
Copy Markdown

Any ETA on when this fix can be applied?

@bartoszmajsak

Copy link
Copy Markdown
Contributor

Pinging @ALRubinger

@juliaberkhout

Copy link
Copy Markdown
Contributor Author

Any updates on this?

@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.

Sorry it took so long @juliaberkhout . I'm approving and merging this PR, I've tested this on my fork and the CI on Windows passes with this fix.

I'll release a new beta with the fix soon, we have some trouble syncing our Nexus with Maven central, so I suspect next week

@petrberan
petrberan merged commit 375abd1 into shrinkwrap:main Aug 16, 2024
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.

5 participants