-
Notifications
You must be signed in to change notification settings - Fork 169
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
Conversation
…Timestamp is empty
From JIRA issue: Due to a combination of plugins, it is possible for the project.build.outputTimestamp property to have an empty string as a value. This causes an IndexOutOfBoundsException on line 1242 when it tries to access the first character in the string. This can be fixed by doing an isEmpty check before doing the charAt check. I will create an PR for this. While this bug is caused by another plugin, I think this should be fixed in the compiler because the error returned (IndexOutOfBoundsException), is vague and hard to debug. The workaround for this issue is setting the project.build.outputTimestamp property with an arbitrary value. |
@@ -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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
…Timestamp is empty
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MCOMPILER-XXX] - Fixes bug in ApproximateQuantiles
,where you replace
MCOMPILER-XXX
with the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean verify
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
mvn -Prun-its clean verify
).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.