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

mvn test (without clean) gives 'io.github.blackrock:protoc-maven-plugin:2.0.0:run failed: Cannot read the array length because "<local6>" is null' #25

Closed
cmardini opened this issue May 8, 2024 · 3 comments · Fixed by #26
Assignees
Labels
bug Something isn't working

Comments

@cmardini
Copy link

cmardini commented May 8, 2024

Describe the bug
In my project, when the protos aren't generated into sources but I try to run tests with 'mvn test', I get:

Execution default of goal io.github.blackrock:protoc-maven-plugin:2.0.0:run failed: Cannot read the array length because "<local6>" is null

But adding clean to the cmd line, I don't get this issue.

My plugin section looks like:

            <plugin>
                <groupId>io.github.blackrock</groupId>
                <artifactId>protoc-maven-plugin</artifactId>
                <version>2.0.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <optimizeCodegen>true</optimizeCodegen>
                            <includeMavenTypes>direct</includeMavenTypes>
                            <includeStdTypes>true</includeStdTypes>
                            <includeDirectories>
                                <include>src/main/protobuf/include</include>
                                <include>src/main/protobuf/a-proto</include>
                            </includeDirectories>
                            <inputDirectories>
                                <include>src/main/protobuf/c-proto</include>
                                <include>src/main/protobuf/b-proto</include>
                                <include>src/main/protobuf/a-proto</include>
                            </inputDirectories>
                            <outputTargets>
                                <outputTarget>
                                    <type>java</type>
                                </outputTarget>
                                <outputTarget>
                                    <type>grpc-java</type>
                                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}</pluginArtifact>
                                </outputTarget>
                            </outputTargets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Environment (please complete the following information):

  • CentOS 7
  • Maven 3.9.1

Additional context
Using 2.0.0

@cmardini cmardini changed the title mvn test (without clean) gives mvn test (without clean) gives 'io.github.blackrock:protoc-maven-plugin:2.0.0:run failed: Cannot read the array length because "<local6>" is null' May 8, 2024
@spensonshih spensonshih self-assigned this May 13, 2024
@spensonshih
Copy link
Contributor

spensonshih commented May 13, 2024

Thanks @cmardini for reporting. I have identified the bug, and will issue a fix. The bug is due to an uninitialized variable when skipping code generation (because mvn clean is not specified), and the includeStdTypes flag is set.

@spensonshih spensonshih added the bug Something isn't working label May 13, 2024
@cmardini
Copy link
Author

Thanks. I've removed includeStdTypes in my project in the meantime. Seems like I no longer needed it.

@spensonshih
Copy link
Contributor

This has been resolved in patch release 2.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants