--- a/jdk/src/java.desktop/share/classes/javax/swing/text/StyleContext.java Mon Aug 18 14:03:21 2014 +0100
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StyleContext.java Tue Aug 19 10:32:16 2014 -0700
@@ -714,11 +714,19 @@
throws ClassNotFoundException, IOException
{
fontSearch = new FontKey(null, 0, 0);
- fontTable = new Hashtable<FontKey, Font>();
+ fontTable = new Hashtable<>();
search = new SimpleAttributeSet();
attributesPool = Collections.
- synchronizedMap(new WeakHashMap<SmallAttributeSet, WeakReference<SmallAttributeSet>>());
- s.defaultReadObject();
+ synchronizedMap(new WeakHashMap<SmallAttributeSet,
+ WeakReference<SmallAttributeSet>>());
+
+ ObjectInputStream.GetField f = s.readFields();
+ Style newStyles = (Style) f.get("styles", null);
+ if (newStyles == null) {
+ throw new InvalidObjectException("Null styles");
+ }
+ styles = newStyles;
+ unusedSets = f.get("unusedSets", 0);
}
// --- variables ---------------------------------------------------
@@ -734,7 +742,7 @@
private Style styles;
private transient FontKey fontSearch = new FontKey(null, 0, 0);
- private transient Hashtable<FontKey, Font> fontTable = new Hashtable<FontKey, Font>();
+ private transient Hashtable<FontKey, Font> fontTable = new Hashtable<>();
private transient Map<SmallAttributeSet, WeakReference<SmallAttributeSet>> attributesPool = Collections.
synchronizedMap(new WeakHashMap<SmallAttributeSet, WeakReference<SmallAttributeSet>>());