greenstone.org greenstone wiki greenstone trac planet greenstone

Changeset 15964

Show
Ignore:
Timestamp:
2008-06-12 12:36:23 (3 months ago)
Author:
ak19
Message:

Removed use of Patter.quote() which requires Java 1.5 or higher and also checked for the case so that the first occurrence of a higher digit in the running version vs the minimum Java version required will stop the check.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gli/trunk/CheckJavaVersion.java

    r15310 r15964  
    4343                // that the two characters are separate tokens by using |, so  
    4444                // that the regex becomes: ".|_" -> \Q.\E|\Q_\E. 
    45                 String period = Pattern.quote("."); 
    46                 String underscore = Pattern.quote("_"); 
     45                String period = "\\Q.\\E"; 
     46                String underscore = "\\Q_\\E"; 
     47                         // Can't use Pattern.quote() since it is not there in Java 1.4.* 
     48                     //String period = Pattern.quote("."); 
     49                     //String underscore = Pattern.quote("_"); 
    4750                 
    4851                String[] minVersionNums = minimumVersion.split(period+"|"+underscore); 
     
    5659                        int min = Integer.parseInt(minVersionNums[i]); 
    5760                        int run = Integer.parseInt(runningVersionNums[i]); 
    58                         if(run < min) {  
     61                        if(run > min) {  
     62                                // certain success: one of the higher positional numbers  
     63                                // of the running version is greater than the corresponding 
     64                                // number of the minimum version, meaning we've finished. 
     65                                break; 
     66                        } else if(run < min) {  
    5967                                // fail: running version number is lower than corresponding  
    6068                                // minimum version number 
    6169                                acceptable = false; 
    6270                                break; 
    63                         } 
     71                        }  
    6472                } 
    6573