Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-8192

DefaultArtifact constructor no longer accepts empty version

    XMLWordPrintableJSON

Details

    Description

      Due to the change introduced in MNG-6705 (https://github.com/apache/maven/commit/53f04f03e3e58c75dcc791d557758357a6ec7983) an empty version being passed to the constructor of DefaultArtifact  leads to an IllegalArgumentException

       

      java.lang.IllegalArgumentException: version can neither be null, empty nor blank
      	at org.apache.commons.lang3.Validate.notBlank(Validate.java:454)
      	at org.apache.maven.artifact.ArtifactUtils.notBlank(ArtifactUtils.java:107)
      	at org.apache.maven.artifact.ArtifactUtils.toSnapshotVersion(ArtifactUtils.java:57)
      	at org.apache.maven.artifact.DefaultArtifact.setBaseVersionInternal(DefaultArtifact.java:389)
      	at org.apache.maven.artifact.DefaultArtifact.selectVersion(DefaultArtifact.java:506)
      	at org.apache.maven.artifact.DefaultArtifact.selectVersionFromNewRangeIfAvailable(DefaultArtifact.java:494)
      	at org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:106)
      	at org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:86)
      

      Prior to Maven 3.6.2 this was throwing no exception at all (only null version values were rejected).
       
      Although throwing an exception for an invalid version is probably fine it should rather be a InvalidArtifactRTException thrown for other mandatory but empty arguments in https://github.com/apache/maven/blob/c0012c08aaad27473770fc39ab7e39026238c7e1/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java#L165-L184

      Attachments

        Issue Links

          Activity

            People

              kwin Konrad Windszus
              kwin Konrad Windszus
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: