[OpenJDK 2D-Dev] [9] RFR JDK-6278300: sun.print.Win32MediaSize deserialization error
Prasanta Sadhukhan
prasanta.sadhukhan at oracle.com
Fri Jul 15 09:36:49 UTC 2016
Hi All,
Bug: https://bugs.openjdk.java.net/browse/JDK-6278300
Please review a fix for an issue where it is seen that
Deserialization of a javax.print.attribute.standard.MediaPrintableArea
printer attribute fails when the serialization happened in a prior
invocation of the program
only for a *non-standard* page size say 4"x6"
It is because EnumSyntax.readResolve() tries to get the EnumSyntax[]
table from Win32MediaSize when the objects are read
and if the EnumSyntax table is not initialized or 0 in length, then
readResolve() will find the object value being read is not in the
EnumSyntax table and will throw this InvalidObjectException
java.io.InvalidObjectException: Integer value = 9 not in valid range
0..-1for class class sun.print.Win32MediaSize
at
javax.print.attribute.EnumSyntax.readResolve(java.desktop at 9-internal/EnumSyntax.java:204)
at
jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base at 9-internal/Native
Method)
at
jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base at 9-internal/NativeMethodAccessorImpl.java:62)
at
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base at 9-internal/DelegatingMethodAccessorImpl.java:43)
at
java.lang.reflect.Method.invoke(java.base at 9-internal/Method.java:533)
at
java.io.ObjectStreamClass.invokeReadResolve(java.base at 9-internal/ObjectStreamClass.java:1150)
at
java.io.ObjectInputStream.readOrdinaryObject(java.base at 9-internal/ObjectInputStream.java:1835)
at
java.io.ObjectInputStream.readObject0(java.base at 9-internal/ObjectInputStream.java:1371)
at
java.io.ObjectInputStream.readObject(java.base at 9-internal/ObjectInputStream.java:371)
When the printDialog() is invoked, then EnumSyntax table will be
initialised to the current paper ids. But, if printDIalog() is invoked
AFTER objects are deserialised, we run into this problem of enumTable
being 0 in length.
Proposed fix is, to check if the enumtable is not initialised, then
fallback to the supported media size enum table.
webrev: http://cr.openjdk.java.net/~psadhukhan/6278300/webrev.00/
I made it noreg-hard as it needs a custom paper size to be added to
printer media list before invoking the serialization testcase present in
JBS bug entry.
Regards
Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160715/e479a786/attachment.html>
More information about the 2d-dev
mailing list