-
Bug
-
Resolution: Fixed
-
P3
-
7, 8, 9
-
b22
-
os_x
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8048429 | 8u25 | Sergey Bylokhov | P3 | Resolved | Fixed | b05 |
JDK-8046840 | 8u20 | Sergey Bylokhov | P3 | Resolved | Fixed | b20 |
JDK-8053686 | emb-8u26 | Sergey Bylokhov | P3 | Resolved | Fixed | b17 |
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
If a Path2D object has none path segments and its capacity is 0, then call its moveTo() method will cause an exception(java.lang.ArrayIndexOutOfBoundsException: 0).
My application includes several Path objects and these objects need to be serialized.If one object before serialization call reset () method, and its capacity will be 0.This object is deserialized will be unavailable because it has lost the ability to increase capacity.
I found Path2D.needRoom(...) cause this issue by check the java source code.
Others will cause an empty Path2D object (except of deserialization):
1.Path2D path = Path2D.Float(int rule, int initialCapacity); while initialCapacity is 0
2.Path2D path = Path2D.Double(int rule, int initialCapacity);
3.Path2D path = Path2D.Float(Shape s); while s is empty Path2D
4.Path2D path = Path2D.Float(Shape s, AffineTransform at);
5.Path2D path = Path2D.Double(Shape s);
6.Path2D path = Path2D.Double(Shape s, AffineTransform at);
Please pardon me for my English.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Path2D myPath1,myPath2;
myPath1 = new Path2D.Double();
......
myPath1.reset();
ObjectOutputStream oos = new ObjectOutputStream(...);
oos.writeObject(myPath);
ObjectInputStream ois = new ObjectInputStream(...);
myPath2 = (Path2D)ois.readObject();
myPath2.moveTo(10,10); // throw java.lang.ArrayIndexOutOfBoundsException:0
---------- END SOURCE ----------
A DESCRIPTION OF THE PROBLEM :
If a Path2D object has none path segments and its capacity is 0, then call its moveTo() method will cause an exception(java.lang.ArrayIndexOutOfBoundsException: 0).
My application includes several Path objects and these objects need to be serialized.If one object before serialization call reset () method, and its capacity will be 0.This object is deserialized will be unavailable because it has lost the ability to increase capacity.
I found Path2D.needRoom(...) cause this issue by check the java source code.
Others will cause an empty Path2D object (except of deserialization):
1.Path2D path = Path2D.Float(int rule, int initialCapacity); while initialCapacity is 0
2.Path2D path = Path2D.Double(int rule, int initialCapacity);
3.Path2D path = Path2D.Float(Shape s); while s is empty Path2D
4.Path2D path = Path2D.Float(Shape s, AffineTransform at);
5.Path2D path = Path2D.Double(Shape s);
6.Path2D path = Path2D.Double(Shape s, AffineTransform at);
Please pardon me for my English.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Path2D myPath1,myPath2;
myPath1 = new Path2D.Double();
......
myPath1.reset();
ObjectOutputStream oos = new ObjectOutputStream(...);
oos.writeObject(myPath);
ObjectInputStream ois = new ObjectInputStream(...);
myPath2 = (Path2D)ois.readObject();
myPath2.moveTo(10,10); // throw java.lang.ArrayIndexOutOfBoundsException:0
---------- END SOURCE ----------
- backported by
-
JDK-8046840 Deserialization of empty java.awt.geom.Path2D will cause an exception
- Resolved
-
JDK-8048429 Deserialization of empty java.awt.geom.Path2D will cause an exception
- Resolved
-
JDK-8053686 Deserialization of empty java.awt.geom.Path2D will cause an exception
- Resolved