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

[MCOMPILER-592] - IndexOutOfBoundsException when project.build.output… #244

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,9 @@ public void execute() throws MojoExecutionException, CompilationFailureException
}
}

if (outputTimestamp != null && (outputTimestamp.length() > 1 || Character.isDigit(outputTimestamp.charAt(0)))) {
if (outputTimestamp != null
&& !outputTimestamp.isEmpty()
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to understand how the value can be empty: <foo/>? This basically can happen in any plugin using this value, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think it would be set by another plugin. The project I was working on has a lot of plugins, so I would not know which plugin exactly sets this value. When I encountered this issue, the value was not set in the projects pom, but it was a non-null empty string when this line was run, indicating it was set somewhere in the compilation process.

Copy link
Member

Choose a reason for hiding this comment

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

While I consider your fix as reasonable, I'd prefer to see the actual cause to be addressed as well...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will look into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi I looked a bit further into this.

In the (internal) project I was working on was using the jgitver maven extension. This extension has a field named COMMIT_ISO_TIMESTAMP which contains the timestamp of the commit. If the repository does not have any commits, this timestamp is empty. The project I was working on was mapping this timestamp to the project.build.outputTimestamp to this maven commit timestamp in the parent pom, which I missed before.

This caused the above mentioned compiler error.

Copy link
Member

Choose a reason for hiding this comment

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

Have you raised an upstream issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi I created an upstream issue with jgitver. jgitver/jgitver-maven-plugin#184

Would you consider merging this pull request?

Copy link
Member

Choose a reason for hiding this comment

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

I'll give the maintainers some time to respond.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi,

On July 2th this MR has been approved by gnodet. Are we waiting for someone elses approval?

Regards,

Thijs Rijpert

&& (outputTimestamp.length() > 1 || Character.isDigit(outputTimestamp.charAt(0)))) {
// if Reproducible Builds mode, apply workaround
patchJdkModuleVersion(compilerResult, sources);
}
Expand Down