You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/08/23 07:19:00 UTC

[jira] [Commented] (MCOMPILER-592) IndexOutOfBoundsException when project.build.outputTimestamp is empty

    [ https://issues.apache.org/jira/browse/MCOMPILER-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17876191#comment-17876191 ] 

ASF GitHub Bot commented on MCOMPILER-592:
------------------------------------------

thijsrijpert commented on code in PR #244:
URL: https://github.com/apache/maven-compiler-plugin/pull/244#discussion_r1728494504


##########
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java:
##########
@@ -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()

Review Comment:
   Hi,
   
   On July 2th this MR has been approved by gnodet. Are we waiting for someone elses approval?
   
   Regards,
   
   Thijs Rijpert





> IndexOutOfBoundsException when project.build.outputTimestamp is empty
> ---------------------------------------------------------------------
>
>                 Key: MCOMPILER-592
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-592
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.12.0, 3.12.1, 3.13.0
>            Reporter: Thijs Rijpert
>            Priority: Minor
>
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)