ICU-4874 fix noDataCheck failures

X-SVN-Rev: 18743
This commit is contained in:
Ram Viswanadha 2005-11-01 18:32:55 +00:00
parent 21e2e63740
commit 298377ea5b
3 changed files with 25 additions and 7 deletions

View file

@ -12,8 +12,6 @@ package com.ibm.icu.impl;
import com.ibm.icu.util.TimeZone;
import com.ibm.icu.util.SimpleTimeZone;
import java.util.Date;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.io.IOException;
/**
@ -99,7 +97,8 @@ public class JDKTimeZone extends TimeZone {
return zone.getOffset(era, year, month, day,
dayOfWeek, milliseconds);
}
throw new IllegalStateException();
//should never occur except while serializing JDKTimeZone object
return 0;
}
@ -119,7 +118,6 @@ public class JDKTimeZone extends TimeZone {
if(zone!=null){
zone.setRawOffset(offsetMillis);
}
throw new IllegalStateException();
}
/**
@ -129,7 +127,8 @@ public class JDKTimeZone extends TimeZone {
if(zone!=null){
return zone.getRawOffset();
}
throw new IllegalStateException();
// should never happen except when serializing the JDKTimeZone object
return 0;
}
/**
@ -139,7 +138,8 @@ public class JDKTimeZone extends TimeZone {
if(zone!=null){
return zone.useDaylightTime();
}
throw new IllegalStateException();
// should never happen except when serializing the JDKTimeZone object
return false;
}
/**
@ -149,7 +149,8 @@ public class JDKTimeZone extends TimeZone {
if(zone!=null){
return zone.inDaylightTime(date);
}
throw new IllegalStateException();
//should never happen except when serializing the JDKTimeZone object
return false;
}
/**

View file

@ -323,6 +323,11 @@ public class OlsonTimeZone extends TimeZone {
getOffset(date.getTime(), false, temp);
return temp[1] != 0;
}
/**
* Construct a GMT+0 zone with no transitions. This is done when a
* constructor fails so the resultant object is well-behaved.
*/
private void constructEmpty(){
transitionCount = 0;
typeCount = 1;
@ -431,6 +436,17 @@ public class OlsonTimeZone extends TimeZone {
}
}
}
public OlsonTimeZone(){
/*
*
finalYear = Integer.MAX_VALUE;
finalMillis = Double.MAX_VALUE;
finalZone = null;
*/
constructEmpty();
}
public OlsonTimeZone(String id){
ICUResourceBundle top = (ICUResourceBundle)ICUResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "zoneinfo", ICUResourceBundle.ICU_DATA_CLASS_LOADER);
ICUResourceBundle res = ZoneMeta.openOlsonResource(id);

View file

@ -46,6 +46,7 @@ public class SimpleTimeZone extends JDKTimeZone {
*/
public SimpleTimeZone(int rawOffset, String ID) {
//this(new java.util.SimpleTimeZone(rawOffset, ID), ID);
//super(ID);
construct(rawOffset, 0, 0, 0,
0, WALL_TIME,
0, 0, 0,