mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8262410: Enhanced rules for zones
Reviewed-by: rriggs, rhalade
This commit is contained in:
parent
7b6410f213
commit
175b65c0a1
1 changed files with 13 additions and 1 deletions
|
@ -430,7 +430,10 @@ public final class ZoneRules implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the state from the stream.
|
* Reads the state from the stream. The 1,024 limit to the lengths
|
||||||
|
* of stdTrans and savSize is intended to be the size well enough
|
||||||
|
* to accommodate the max number of transitions in current tzdb data
|
||||||
|
* (203 for Asia/Tehran).
|
||||||
*
|
*
|
||||||
* @param in the input stream, not null
|
* @param in the input stream, not null
|
||||||
* @return the created object, not null
|
* @return the created object, not null
|
||||||
|
@ -438,6 +441,9 @@ public final class ZoneRules implements Serializable {
|
||||||
*/
|
*/
|
||||||
static ZoneRules readExternal(DataInput in) throws IOException, ClassNotFoundException {
|
static ZoneRules readExternal(DataInput in) throws IOException, ClassNotFoundException {
|
||||||
int stdSize = in.readInt();
|
int stdSize = in.readInt();
|
||||||
|
if (stdSize > 1024) {
|
||||||
|
throw new InvalidObjectException("Too many transitions");
|
||||||
|
}
|
||||||
long[] stdTrans = (stdSize == 0) ? EMPTY_LONG_ARRAY
|
long[] stdTrans = (stdSize == 0) ? EMPTY_LONG_ARRAY
|
||||||
: new long[stdSize];
|
: new long[stdSize];
|
||||||
for (int i = 0; i < stdSize; i++) {
|
for (int i = 0; i < stdSize; i++) {
|
||||||
|
@ -448,6 +454,9 @@ public final class ZoneRules implements Serializable {
|
||||||
stdOffsets[i] = Ser.readOffset(in);
|
stdOffsets[i] = Ser.readOffset(in);
|
||||||
}
|
}
|
||||||
int savSize = in.readInt();
|
int savSize = in.readInt();
|
||||||
|
if (savSize > 1024) {
|
||||||
|
throw new InvalidObjectException("Too many saving offsets");
|
||||||
|
}
|
||||||
long[] savTrans = (savSize == 0) ? EMPTY_LONG_ARRAY
|
long[] savTrans = (savSize == 0) ? EMPTY_LONG_ARRAY
|
||||||
: new long[savSize];
|
: new long[savSize];
|
||||||
for (int i = 0; i < savSize; i++) {
|
for (int i = 0; i < savSize; i++) {
|
||||||
|
@ -458,6 +467,9 @@ public final class ZoneRules implements Serializable {
|
||||||
savOffsets[i] = Ser.readOffset(in);
|
savOffsets[i] = Ser.readOffset(in);
|
||||||
}
|
}
|
||||||
int ruleSize = in.readByte();
|
int ruleSize = in.readByte();
|
||||||
|
if (ruleSize > 16) {
|
||||||
|
throw new InvalidObjectException("Too many transition rules");
|
||||||
|
}
|
||||||
ZoneOffsetTransitionRule[] rules = (ruleSize == 0) ?
|
ZoneOffsetTransitionRule[] rules = (ruleSize == 0) ?
|
||||||
EMPTY_LASTRULES : new ZoneOffsetTransitionRule[ruleSize];
|
EMPTY_LASTRULES : new ZoneOffsetTransitionRule[ruleSize];
|
||||||
for (int i = 0; i < ruleSize; i++) {
|
for (int i = 0; i < ruleSize; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue