String checkVersion ( String pluginName , String dependency , String requestedVersion , String availableVersion ) { if ( null == availableVersion ) { return "Dependency " + dependency + " not found for " + pluginName + ", version " + requestedVersion + " or higher needed.\n" ; } if ( requestedVersion . startsWith ( EXPR_START ) || availableVersion . startsWith ( EXPR_START ) ) { return "" ; } Version requested = new Version ( requestedVersion ) ; Version available = new Version ( availableVersion ) ; if ( requested . getMajor ( ) != available . getMajor ( ) ) { return "Dependency " + dependency + " is provided in a incompatible API version for plug-in " + pluginName + ", which requests version " + requestedVersion + ", but version " + availableVersion + " supplied.\n" ; } if ( requested . after ( available ) ) { return "Dependency " + dependency + " too old for " + pluginName + ", version " + requestedVersion + " or higher needed, but version " + availableVersion + " supplied.\n" ; } return "" ; }
Check the version to assure it is allowed .