equal
deleted
inserted
replaced
42 import java.util.concurrent.ConcurrentHashMap; |
42 import java.util.concurrent.ConcurrentHashMap; |
43 import java.util.concurrent.ConcurrentMap; |
43 import java.util.concurrent.ConcurrentMap; |
44 |
44 |
45 import static java.io.ObjectStreamClass.processQueue; |
45 import static java.io.ObjectStreamClass.processQueue; |
46 |
46 |
47 import jdk.internal.misc.ObjectStreamClassValidator; |
|
48 import jdk.internal.misc.SharedSecrets; |
47 import jdk.internal.misc.SharedSecrets; |
49 import jdk.internal.misc.Unsafe; |
48 import jdk.internal.misc.Unsafe; |
50 import sun.reflect.misc.ReflectUtil; |
49 import sun.reflect.misc.ReflectUtil; |
51 |
50 |
52 /** |
51 /** |
1765 break; |
1764 break; |
1766 default: |
1765 default: |
1767 throw new StreamCorruptedException( |
1766 throw new StreamCorruptedException( |
1768 String.format("invalid type code: %02X", tc)); |
1767 String.format("invalid type code: %02X", tc)); |
1769 } |
1768 } |
1770 if (descriptor != null) { |
|
1771 validateDescriptor(descriptor); |
|
1772 } |
|
1773 return descriptor; |
1769 return descriptor; |
1774 } |
1770 } |
1775 |
1771 |
1776 private boolean isCustomSubclass() { |
1772 private boolean isCustomSubclass() { |
1777 // Return true if this class is a custom subclass of ObjectInputStream |
1773 // Return true if this class is a custom subclass of ObjectInputStream |
4011 |
4007 |
4012 static { |
4008 static { |
4013 SharedSecrets.setJavaObjectInputStreamAccess(ObjectInputStream::checkArray); |
4009 SharedSecrets.setJavaObjectInputStreamAccess(ObjectInputStream::checkArray); |
4014 } |
4010 } |
4015 |
4011 |
4016 private void validateDescriptor(ObjectStreamClass descriptor) { |
|
4017 ObjectStreamClassValidator validating = validator; |
|
4018 if (validating != null) { |
|
4019 validating.validateDescriptor(descriptor); |
|
4020 } |
|
4021 } |
|
4022 |
|
4023 // controlled access to ObjectStreamClassValidator |
|
4024 private volatile ObjectStreamClassValidator validator; |
|
4025 |
|
4026 private static void setValidator(ObjectInputStream ois, ObjectStreamClassValidator validator) { |
|
4027 ois.validator = validator; |
|
4028 } |
|
4029 static { |
|
4030 SharedSecrets.setJavaObjectInputStreamAccess(ObjectInputStream::setValidator); |
|
4031 } |
|
4032 } |
4012 } |