提交 e73f14dc 编写于 作者: S serb

8190289: More refactoring for client deserialization cases

Reviewed-by: prr, azvegint, rhalade, skoivu
上级 cb7ceb93
...@@ -25,13 +25,14 @@ ...@@ -25,13 +25,14 @@
package java.awt.geom; package java.awt.geom;
import java.awt.Shape;
import java.awt.Rectangle; import java.awt.Rectangle;
import sun.awt.geom.Curve; import java.awt.Shape;
import java.io.Serializable; import java.io.Serializable;
import java.io.StreamCorruptedException; import java.io.StreamCorruptedException;
import java.util.Arrays; import java.util.Arrays;
import sun.awt.geom.Curve;
/** /**
* The {@code Path2D} class provides a simple, yet flexible * The {@code Path2D} class provides a simple, yet flexible
* shape which represents an arbitrary geometric path. * shape which represents an arbitrary geometric path.
...@@ -2583,9 +2584,12 @@ public abstract class Path2D implements Shape, Cloneable { ...@@ -2583,9 +2584,12 @@ public abstract class Path2D implements Shape, Cloneable {
throw new java.io.InvalidObjectException(iae.getMessage()); throw new java.io.InvalidObjectException(iae.getMessage());
} }
pointTypes = new byte[(nT < 0) ? INIT_SIZE : nT]; // Accept the size from the stream only if it is less than INIT_SIZE
if (nC < 0) { // otherwise the size will be based on the real data in the stream
nC = INIT_SIZE * 2; pointTypes = new byte[(nT < 0 || nT > INIT_SIZE) ? INIT_SIZE : nT];
final int initX2 = INIT_SIZE * 2;
if (nC < 0 || nC > initX2) {
nC = initX2;
} }
if (storedbl) { if (storedbl) {
((Path2D.Double) this).doubleCoords = new double[nC]; ((Path2D.Double) this).doubleCoords = new double[nC];
......
...@@ -3352,7 +3352,7 @@ public class CSS implements Serializable { ...@@ -3352,7 +3352,7 @@ public class CSS implements Serializable {
s.defaultReadObject(); s.defaultReadObject();
// Reconstruct the hashtable. // Reconstruct the hashtable.
int numValues = s.readInt(); int numValues = s.readInt();
valueConvertor = new Hashtable<Object, Object>(Math.max(1, numValues)); valueConvertor = new Hashtable<Object, Object>();
while (numValues-- > 0) { while (numValues-- > 0) {
Object key = s.readObject(); Object key = s.readObject();
Object value = s.readObject(); Object value = s.readObject();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册