ICU-6438 warn one time each

X-SVN-Rev: 24397
This commit is contained in:
Steven R. Loomis 2008-07-21 19:11:22 +00:00
parent 3d4773a197
commit d00dd059cb
2 changed files with 15 additions and 3 deletions

View File

@ -3,7 +3,8 @@
#update these values to current version and directories
## Version #'s are detected.
##oldver=ICU 3.8.1
olddir=/xsrl/E/icu4c381/source/doc/xml/
#olddir=/xsrl/E/icu4c381/source/doc/xml/
olddir=/xsrl/E/icu4c40/source/doc/xml/
## Version #'s are detected.
##newver=ICU 4.0
#newdir=/xsrl/E/icu/source/doc/xml/

View File

@ -134,6 +134,17 @@ public class StableAPI {
rightVer = trimICU(setVer(rightVer, "new", rightDir));
}
private static Set warnSet = new HashSet(); // No Generics because we built with JDK 1.4 for now
private static void warn(String what) {
if(!warnSet.contains(what)) {
System.out.println("Warning: "+what);
if(warnSet.isEmpty()) {
System.out.println(" (These warnings are only printed one time each.)");
}
warnSet.add(what);
}
}
private static String trimICU(String ver) {
final String ICU_ = "ICU ";
final String ICU = "ICU";
@ -144,13 +155,13 @@ public class StableAPI {
if(icuidx>=0) {
ver = ver.substring(icuidx+ICU_.length()).trim();
} else if(icuidx1>=0) {
System.err.println("Warning: SuperTrimming: '" + ver + "'");
warn("trimming: '" + ver + "'");
ver = ver.substring(icuidx1+ICU.length()).trim();
} else {
int n;
for(n=ver.length()-1;n>0 && ((ver.charAt(n)=='.') || Character.isDigit(ver.charAt(n))) ;n--)
;
System.err.println("Warning: SuperDuperTrimming: '" + ver + "'");
warn("super-trimming: '" + ver + "'");
if(n>0) {
ver = ver.substring(n+1).trim();
}