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

Skip relativePaths containing colon as that fails on Windows #3169

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

timtebeek
Copy link
Contributor

Fixes #3167

artemis-pom-2.28.0.pom contains a weird relative path: https://repo1.maven.org/maven2/org/apache/activemq/artemis-pom/2.28.0/artemis-pom-2.28.0.pom

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apache.activemq</groupId>
    <artifactId>artemis-pom</artifactId>
    <packaging>pom</packaging>
    <version>2.28.0</version>
    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>27</version>
        <relativePath>org.apache:apache</relativePath>
    </parent>

This worked okay-ish on Linux/Mac, as passing the relativePath into Paths.get(relativePath, "pom.xml") will just result in a null maybeLocalPom. On Windows however, a colon is not valid to pass into Paths.get(..), and it fails with the reported exception.

Since we were effectively ignoring the relative path on Mac/Linux before, we might as well skip it entirely for Windows as well.

Fixes #3167

artemis-pom-2.28.0.pom contains a weird relative path:
https://repo1.maven.org/maven2/org/apache/activemq/artemis-pom/2.28.0/artemis-pom-2.28.0.pom

```xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apache.activemq</groupId>
    <artifactId>artemis-pom</artifactId>
    <packaging>pom</packaging>
    <version>2.28.0</version>
    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>27</version>
        <relativePath>org.apache:apache</relativePath>
    </parent>
```

This worked okay-ish on Linux/Mac, as passing the relativePath into `Paths.get(relativePath, "pom.xml")` will just result in a null `maybeLocalPom`. On Windows however, a colon is not valid to pass into Paths.get(..), and it fails with the reported exception.

Since we were effectively ignoring the relative path on Mac/Linux before, we might as well skip it entirely for Windows as well.
@timtebeek timtebeek self-assigned this Apr 26, 2023
@timtebeek
Copy link
Contributor Author

Writing a test that fails was surprisingly hard, especially as I don't have access to a Windows machine. Hence a code only change, as we also don't run on Windows in CI either.

@timtebeek timtebeek requested a review from knutwannheden April 26, 2023 12:48
Copy link
Contributor

@knutwannheden knutwannheden left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@timtebeek timtebeek merged commit 6286623 into main Apr 26, 2023
@timtebeek timtebeek deleted the skip_relativePath_containing_colon branch April 26, 2023 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants