ICU-1845 fix calendar regression problems on solaris 2.6 with jdk1.4

X-SVN-Rev: 8433
This commit is contained in:
Doug Felt 2002-04-10 22:15:12 +00:00
parent 373b6c39b5
commit c6f54b1742
3 changed files with 77 additions and 56 deletions

View File

@ -191,7 +191,12 @@ public class CalendarRegression extends com.ibm.icu.dev.test.TestFmwk {
*/
public void Test4059654() {
GregorianCalendar gc = new GregorianCalendar();
// work around bug for jdk1.4 on solaris 2.6, which uses funky timezone names
// jdk1.4.1 will drop support for 2.6 so we should be ok when it comes out
java.util.TimeZone javazone = java.util.TimeZone.getTimeZone("GMT");
TimeZone icuzone = TimeZone.getTimeZone("GMT");
GregorianCalendar gc = new GregorianCalendar(icuzone);
gc.set(1997, 3, 1, 15, 16, 17); // April 1, 1997
@ -202,7 +207,7 @@ public class CalendarRegression extends com.ibm.icu.dev.test.TestFmwk {
gc.set(Calendar.MILLISECOND, 0);
Date cd = gc.getTime();
java.util.Calendar cal = java.util.Calendar.getInstance();
java.util.Calendar cal = java.util.Calendar.getInstance(javazone);
cal.clear();
cal.set(1997, 3, 1, 0, 0, 0);
Date exp = cal.getTime();
@ -291,8 +296,13 @@ public class CalendarRegression extends com.ibm.icu.dev.test.TestFmwk {
}
public void Test4071385() {
Calendar cal = Calendar.getInstance();
java.util.Calendar tempcal = java.util.Calendar.getInstance();
// work around bug for jdk1.4 on solaris 2.6, which uses funky timezone names
// jdk1.4.1 will drop support for 2.6 so we should be ok when it comes out
java.util.TimeZone javazone = java.util.TimeZone.getTimeZone("GMT");
TimeZone icuzone = TimeZone.getTimeZone("GMT");
Calendar cal = Calendar.getInstance(icuzone);
java.util.Calendar tempcal = java.util.Calendar.getInstance(javazone);
tempcal.clear();
tempcal.set(1998, Calendar.JUNE, 24);
cal.setTime(tempcal.getTime());

View File

@ -5,59 +5,70 @@ import com.ibm.icu.util.VersionInfo;
import java.util.ResourceBundle;
public final class ICUDebug {
// {dlf} need to protect this call, put in utility class and call with token.
private static String params = System.getProperty("ICUDebug");
private static boolean debug = params != null;
private static boolean help = true || debug && (params.equals("") || params.indexOf("help") != -1);
private static String params;
static {
try {
params = System.getProperty("ICUDebug");
}
catch (SecurityException e) {
}
}
private static boolean debug = params != null;
private static boolean help = debug && (params.equals("") || params.indexOf("help") != -1);
static {
if (debug) {
System.out.println("\nICUDebug=" + params);
static {
if (debug) {
System.out.println("\nICUDebug=" + params);
}
}
public static final String javaVersionString = System.getProperty("java.version");
public static final VersionInfo javaVersion;
static {
String vs = javaVersionString;
int index = vs.indexOf('-');
if (index != -1) {
vs = vs.substring(0, index);
}
index = vs.indexOf('b'); // 'beta'
if (index != -1) {
vs = vs.substring(0, index);
}
vs = vs.replace('_', '.');
javaVersion = VersionInfo.getInstance(vs);
}
public static boolean enabled() {
return debug;
}
public static boolean enabled(String arg) {
if (debug) {
boolean result = params.indexOf(arg) != -1;
if (help) System.out.println("\nICUDebug.enabled(" + arg + ") = " + result);
return result;
}
return false;
}
public static String value(String arg) {
String result = "false";
if (debug) {
int index = params.indexOf(arg);
if (index != -1) {
index += arg.length();
if (params.length() > index && params.charAt(index) == '=') {
index += 1;
int limit = params.indexOf(",", index);
result = params.substring(index, limit == -1 ? params.length() : limit);
}
result = "true";
}
if (help) System.out.println("\nICUDebug.value(" + arg + ") = " + result);
}
public static final String javaVersionString = System.getProperty("java.version");
public static final VersionInfo javaVersion;
static {
String vs = javaVersionString;
int index = vs.indexOf('-');
if (index != -1) {
vs = vs.substring(0, index);
}
vs = vs.replace('_', '.');
javaVersion = VersionInfo.getInstance(vs);
}
public static boolean enabled() {
return debug;
}
public static boolean enabled(String arg) {
if (debug) {
boolean result = params.indexOf(arg) != -1;
if (help) System.out.println("\nICUDebug.enabled(" + arg + ") = " + result);
return result;
}
return false;
}
public static String value(String arg) {
String result = "false";
if (debug) {
int index = params.indexOf(arg);
if (index != -1) {
index += arg.length();
if (params.length() > index && params.charAt(index) == '=') {
index += 1;
int limit = params.indexOf(",", index);
result = params.substring(index, limit == -1 ? params.length() : limit);
}
result = "true";
}
if (help) System.out.println("\nICUDebug.value(" + arg + ") = " + result);
}
return result;
}
return result;
}
}