javagit/src/main/java/edu/nyu/cs/javagit/api/JavaGitConfiguration.java
private static boolean isValidVersionString(String version) {
    /*
     * Git version strings can vary, so let's do a minimal sanity check for two things: 1. The first
     * character in the version is a number. 2. There's at least one period in the version string.
     * 
     * TODO (rs2705): Make this more sophisticated by parsing out a major/minor version number, and
     * ensuring it's >= some minimally-required version.
     */
    try {
      Integer.parseInt(version.substring(0, 1));
    } catch (NumberFormatException e) {
      // First character in the version string was not a valid number!
      return false;
    }

    if (version.indexOf(".") == -1) {
      // The version string doesn't contain a period!
      return false;
    }

    return true;
  }
private static boolean isValidVersionString(String version) {
    /*
     * Git version strings can vary, so let's do a minimal sanity check for two things: 1. The first
     * character in the version is a number. 2. There's at least one period in the version string.
     * 
     * TODO (rs2705): Make this more sophisticated by parsing out a major/minor version number, and
     * ensuring it's >= some minimally-required version.
     */
    try {
      Integer.parseInt(version.substring(0, 1));
    } catch (NumberFormatException e) {
      // First character in the version string was not a valid number!
      return false;
    }

    if (version.indexOf(".") == -1) {
      // The version string doesn't contain a period!
      return false;
    }

    return true;
  }
private static boolean isValidVersionString ( String version ) { /*
     * Git version strings can vary, so let's do a minimal sanity check for two things: 1. The first
     * character in the version is a number. 2. There's at least one period in the version string.
     * 
     * TODO (rs2705): Make this more sophisticated by parsing out a major/minor version number, and
     * ensuring it's >= some minimally-required version.
     */ try { Integer . parseInt ( version . substring ( 0 , 1 ) ) ; } catch ( NumberFormatException e ) { // First character in the version string was not a valid number! return false ; } if ( version . indexOf ( "." ) == - 1 ) { // The version string doesn't contain a period! return false ; } return true ; }
Judge the validity of a given git version string. This can be difficult to do, as there seems
to be no deliberately-defined git version format. So, here we do a minimal sanity check for two
things: 1. The first character in the version is a number. 2. There's at least one period in
the version string.

@param version
@return true if the version passed as argument is valid
Judge the validity of a given git version string . This can be difficult to do as there seems to be no deliberately - defined git version format . So here we do a minimal sanity check for two things : 1 . The first character in the version is a number . 2 . There s at least one period in the version string .