Search in sources :

Example 1 with MavenVersion

use of org.opentripplanner.common.MavenVersion in project OpenTripPlanner by opentripplanner.

the class Graph method graphVersionMismatch.

/**
 * Compares the OTP version number stored in the graph with that of the currently running instance. Logs warnings explaining that mismatched
 * versions can cause problems.
 *
 * @return false if Maven versions match (even if commit ids do not match), true if Maven version of graph does not match this version of OTP or
 *         graphs are otherwise obviously incompatible.
 */
private boolean graphVersionMismatch() {
    MavenVersion v = MavenVersion.VERSION;
    MavenVersion gv = this.mavenVersion;
    LOG.info("Graph version: {}", gv);
    LOG.info("OTP version:   {}", v);
    if (!v.equals(gv)) {
        LOG.error("This graph was built with a different version of OTP. Please rebuild it.");
        // do not allow graph use
        return true;
    } else if (!v.commit.equals(gv.commit)) {
        if (v.qualifier.equals("SNAPSHOT")) {
            LOG.warn("This graph was built with the same SNAPSHOT version of OTP, but a " + "different commit. Please rebuild the graph if you experience incorrect " + "behavior. ");
            // graph might still work
            return false;
        } else {
            LOG.error("Commit mismatch in non-SNAPSHOT version. This implies a problem with " + "the build or release process.");
            // major problem
            return true;
        }
    } else {
        // no version mismatch, no commit mismatch
        LOG.info("This graph was built with the currently running version and commit of OTP.");
        return false;
    }
}
Also used : MavenVersion(org.opentripplanner.common.MavenVersion)

Aggregations

MavenVersion (org.opentripplanner.common.MavenVersion)1