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

Cannot invoke "String.length()" because "str" is null #925

Closed
simasch opened this issue Feb 28, 2023 · 6 comments · Fixed by #926
Closed

Cannot invoke "String.length()" because "str" is null #925

simasch opened this issue Feb 28, 2023 · 6 comments · Fixed by #926
Labels
Milestone

Comments

@simasch
Copy link

simasch commented Feb 28, 2023

I sucessfully used use-dep-version but now I get this error and cannot find out what the problem is:

c:\Users\simon\Workspace\Dynasoft\tosca-ui>mvn versions:use-dep-version -Dincludes=ch.tosca:tosca-jooq -DdepVersion=22.2.680 -DforceVersion=true -Dincludes=ch.tosca:tosca-jooq -DdepVersion=22.2.680 -DforceVersion=true
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] tosca-ui                                                           [pom]
[INFO] tosca-standard                                                     [jar]
[INFO] tosca-develop                                                      [jar]
[INFO]
[INFO] -------------------------< ch.tosca:tosca-ui >--------------------------
[INFO] Building tosca-ui 23.1.19-SNAPSHOT                                 [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.15.0:use-dep-version (default-cli) @ tosca-ui ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for tosca-ui 23.1.19-SNAPSHOT:
[INFO]
[INFO] tosca-ui ........................................... FAILURE [  0.658 s]
[INFO] tosca-standard ..................................... SKIPPED
[INFO] tosca-develop ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.056 s
[INFO] Finished at: 2023-02-28T08:21:25+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.15.0:use-dep-version (default-cli) on project tosca-ui: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.15.0:use-dep-version failed: Cannot invoke "String.length()" because "str" is null -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

The pom.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>ch.tosca</groupId>
        <artifactId>tosca-parent</artifactId>
        <version>23.1.2</version>
        <relativePath/> <!-- lookup parent from  repository -->
    </parent>

    <artifactId>tosca-ui</artifactId>
    <version>23.1.19-SNAPSHOT</version>
    <packaging>pom</packaging>

    <modules>
        <module>tosca-standard</module>
        <module>tosca-develop</module>
    </modules>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.release>17</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>ch.tosca</groupId>
                <artifactId>tosca-jooq</artifactId>
                <version>22.2.679</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.7.0.1746</version>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.8</version>
                <executions>
                    <execution>
                        <id>jacoco-initialize</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-site</id>
                        <phase>package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Any help is appreciated.

@andrzejj0
Copy link
Contributor

You're requested to provide the output of your maven command with -X.

So,

mvn versions:use-dep-version -Dincludes=ch.tosca:tosca-jooq -DdepVersion=22.2.680 -DforceVersion=true -Dincludes=ch.tosca:tosca-jooq -DdepVersion=22.2.680 -DforceVersion=true -X

@simasch
Copy link
Author

simasch commented Feb 28, 2023

Please find the output attached

output.txt

@andrzejj0
Copy link
Contributor

andrzejj0 commented Feb 28, 2023

Thanks, that's really helpful. Looks like the original version is null for one or more dependencies and that's what's causing the NPE. I'll look into it this afternoon.

@andrzejj0
Copy link
Contributor

@simasch

Could you try, as a workaround, adding -DprocessDependencies=false and see if this resolves the issue?

andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Feb 28, 2023
… defined in dependencyManagement and dependency processing is enabled
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Feb 28, 2023
… defined in dependencyManagement and dependency processing is enabled
@simasch
Copy link
Author

simasch commented Feb 28, 2023

The workaround works for me. Thanks!

@andrzejj0
Copy link
Contributor

The workaround works for me. Thanks!

Good. Then the PR should fix the issue.

@slawekjaranowski slawekjaranowski added this to the next-release milestone Mar 10, 2023
slawekjaranowski pushed a commit that referenced this issue Mar 10, 2023
… in dependencyManagement and dependency processing is enabled
dongjoon-hyun pushed a commit to apache/spark that referenced this issue Jun 18, 2023
### What changes were proposed in this pull request?
The pr aims to update some maven plugins to newest version. include:
- versions-maven-plugin from 2.15.0 to 2.16.0
- maven-source-plugin from 3.2.1 to 3.3.0
- maven-surefire-plugin from 3.1.0 to 3.1.2
- maven-dependency-plugin from 3.5.0 to 3.6.0

### Why are the changes needed?
- versions-maven-plugin
1.Release Notes: https://github.com/mojohaus/versions/releases/tag/2.16.0
2.Bug Fix:
Resolves: display-dependency-updates only shows updates from the most major allowed segment (mojohaus/versions#966) ajarmoniuk
Resolves mojohaus/versions#931: Fixing problems with encoding in UseDepVersion and PomHelper (mojohaus/versions#932) ajarmoniuk
Resolves mojohaus/versions#916: Partially reverted mojohaus/versions#799. (mojohaus/versions#924) ajarmoniuk
Resolves mojohaus/versions#954: Excluded plexus-container-default (mojohaus/versions#955) ajarmoniuk
Resolves mojohaus/versions#951: DefaultArtifactVersion::getVersion can be null (mojohaus/versions#952) ajarmoniuk
BoundArtifactVersion.toString() to work with NumericVersionComparator (mojohaus/versions#930) ajarmoniuk
Issue mojohaus/versions#925: Protect against an NPE if a dependency version is defined in dependencyManagement (mojohaus/versions#926) ajarmoniuk

- maven-source-plugin
v3.2.1 VS v3.3.0: apache/maven-source-plugin@maven-source-plugin-3.2.1...maven-source-plugin-3.3.0

- maven-surefire-plugin
Release Notes: https://github.com/apache/maven-surefire/releases/tag/surefire-3.1.2

- maven-dependency-plugin
v3.5.0 VS v3.6.0: apache/maven-dependency-plugin@maven-dependency-plugin-3.5.0...maven-dependency-plugin-3.6.0

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

Closes #41641 from panbingkun/SPARK-44085.

Authored-by: panbingkun <pbk1982@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
czxm pushed a commit to czxm/spark that referenced this issue Jun 19, 2023
### What changes were proposed in this pull request?
The pr aims to update some maven plugins to newest version. include:
- versions-maven-plugin from 2.15.0 to 2.16.0
- maven-source-plugin from 3.2.1 to 3.3.0
- maven-surefire-plugin from 3.1.0 to 3.1.2
- maven-dependency-plugin from 3.5.0 to 3.6.0

### Why are the changes needed?
- versions-maven-plugin
1.Release Notes: https://github.com/mojohaus/versions/releases/tag/2.16.0
2.Bug Fix:
Resolves: display-dependency-updates only shows updates from the most major allowed segment (mojohaus/versions#966) ajarmoniuk
Resolves mojohaus/versions#931: Fixing problems with encoding in UseDepVersion and PomHelper (mojohaus/versions#932) ajarmoniuk
Resolves mojohaus/versions#916: Partially reverted mojohaus/versions#799. (mojohaus/versions#924) ajarmoniuk
Resolves mojohaus/versions#954: Excluded plexus-container-default (mojohaus/versions#955) ajarmoniuk
Resolves mojohaus/versions#951: DefaultArtifactVersion::getVersion can be null (mojohaus/versions#952) ajarmoniuk
BoundArtifactVersion.toString() to work with NumericVersionComparator (mojohaus/versions#930) ajarmoniuk
Issue mojohaus/versions#925: Protect against an NPE if a dependency version is defined in dependencyManagement (mojohaus/versions#926) ajarmoniuk

- maven-source-plugin
v3.2.1 VS v3.3.0: apache/maven-source-plugin@maven-source-plugin-3.2.1...maven-source-plugin-3.3.0

- maven-surefire-plugin
Release Notes: https://github.com/apache/maven-surefire/releases/tag/surefire-3.1.2

- maven-dependency-plugin
v3.5.0 VS v3.6.0: apache/maven-dependency-plugin@maven-dependency-plugin-3.5.0...maven-dependency-plugin-3.6.0

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

Closes apache#41641 from panbingkun/SPARK-44085.

Authored-by: panbingkun <pbk1982@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants