Class MetadataInputValidator

java.lang.Object
org.apache.maven.impl.resolver.MetadataInputValidator

public final class MetadataInputValidator extends Object
Validates metadata content parsed from remote maven-metadata.xml files before the values are used to compose filesystem paths or artifact coordinates.

Repository metadata is not covered by the model validator (it is not a POM), so version tokens, snapshot timestamps, and relocation coordinates must be checked at the point of use. Values that would map onto filesystem path-traversal segments (..), separators (/, \), drive-letter delimiters (:), or ISO control characters are rejected.

Since:
4.0.0
  • Method Details

    • isInvalidCoordinateComponent

      public static boolean isInvalidCoordinateComponent(String value)
      Returns true if the value is unsafe for use as a coordinate component in a filesystem path: it is "..", contains a separator (/, \, :), or contains an ISO control character.
    • validateVersioning

      public static void validateVersioning(Versioning versioning) throws IOException
      Validates all version-related tokens inside a parsed Versioning element.
      Throws:
      IOException - if any token is invalid
    • validateVersionToken

      public static void validateVersionToken(String value, String description) throws IOException
      Validates a single version token from repository metadata.
      Throws:
      IOException - if the token contains path-traversal sequences, separators, or control characters