return bRet;
}
private boolean checkExists(String compUri, String targetConfiguration, String version) {
- return loadVersion(compUri+targetConfiguration).contains(version);
+ // TODO
+ ArrayList<String> array = loadVersion(compUri+"/"+targetConfiguration);
+ boolean found = false;
+ for(String existing:array) {
+ found = found | (compareReleases(existing, version)>=0);
+ }
+ return found;
+ }
+ public static int compareReleases(String r1, String r2) {
+ String[] s1 = splitRelease(r1);
+ String[] s2 = splitRelease(r2);
+ int ret = 0;
+ for(int i=0;i<Math.min(s1.length,s2.length);i++) {
+ float a = -1f, b = -1f;
+ try {
+ a = Integer.parseInt(s1[i]);
+ } catch(Throwable t) {
+ if(s1[i].endsWith("+")) {
+ // if there is a "+" in the release number, it is a non-official release,
+ // based on the previous build number. So the "real" number is the previous + 0.5
+ try {
+ a = Integer.parseInt(s1[i].substring(0, s1[i].length()-1));
+ a += 0.5;
+ } catch(Throwable t2) {}
+ }
+ }
+ try {
+ b = Integer.parseInt(s2[i]);
+ } catch(Throwable t) {
+ if(s2[i].endsWith("+")) {
+ // if there is a "+" in the release number, it is a non-official release,
+ // based on the previous build number. So the "real" number is the previous + 0.5
+ try {
+ b = Integer.parseInt(s2[i].substring(0, s2[i].length()-1));
+ b += 0.5;
+ } catch(Throwable t2) {}
+ }
+ }
+ if(a!=-1f && b!=-1f) {
+ if(a<b) ret = -1;
+ else if(a==b) ret = 0;
+ else ret = 1;
+ } else {
+ ret = s1[i].compareTo(s2[i]);
+ }
+ if(ret!=0) {
+ System.out.println("comparing "+r1+" to "+r2+" -> "+ret);
+ return ret;
+ }
+ }
+ if(s1.length>s2.length) ret = 1;
+ else if(s1.length<s2.length) ret = -1;
+ System.out.println("comparing "+r1+" to "+r2+" -> "+ret);
+ return ret;
+ }
+ private static String[] splitRelease(String r) {
+ return r.split("\\.");
}
-
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;