jdk/src/share/classes/java/io/ObjectInputStream.java
changeset 51 6fe31bc95bbc
parent 2 90ce3da70b43
child 715 f16baef3a20e
equal deleted inserted replaced
50:a437b3f9d7f4 51:6fe31bc95bbc
   210 
   210 
   211     /** marker for unshared objects in internal handle table */
   211     /** marker for unshared objects in internal handle table */
   212     private static final Object unsharedMarker = new Object();
   212     private static final Object unsharedMarker = new Object();
   213 
   213 
   214     /** table mapping primitive type names to corresponding class objects */
   214     /** table mapping primitive type names to corresponding class objects */
   215     private static final HashMap primClasses = new HashMap(8, 1.0F);
   215     private static final HashMap<String, Class<?>> primClasses
       
   216         = new HashMap<String, Class<?>>(8, 1.0F);
   216     static {
   217     static {
   217         primClasses.put("boolean", boolean.class);
   218         primClasses.put("boolean", boolean.class);
   218         primClasses.put("byte", byte.class);
   219         primClasses.put("byte", byte.class);
   219         primClasses.put("char", char.class);
   220         primClasses.put("char", char.class);
   220         primClasses.put("short", short.class);
   221         primClasses.put("short", short.class);
   618     {
   619     {
   619         String name = desc.getName();
   620         String name = desc.getName();
   620         try {
   621         try {
   621             return Class.forName(name, false, latestUserDefinedLoader());
   622             return Class.forName(name, false, latestUserDefinedLoader());
   622         } catch (ClassNotFoundException ex) {
   623         } catch (ClassNotFoundException ex) {
   623             Class cl = (Class) primClasses.get(name);
   624             Class<?> cl = primClasses.get(name);
   624             if (cl != null) {
   625             if (cl != null) {
   625                 return cl;
   626                 return cl;
   626             } else {
   627             } else {
   627                 throw ex;
   628                 throw ex;
   628             }
   629             }
  1252     /**
  1253     /**
  1253      * Performs reflective checks on given subclass to verify that it doesn't
  1254      * Performs reflective checks on given subclass to verify that it doesn't
  1254      * override security-sensitive non-final methods.  Returns true if subclass
  1255      * override security-sensitive non-final methods.  Returns true if subclass
  1255      * is "safe", false otherwise.
  1256      * is "safe", false otherwise.
  1256      */
  1257      */
  1257     private static boolean auditSubclass(final Class subcl) {
  1258     private static boolean auditSubclass(final Class<?> subcl) {
  1258         Boolean result = AccessController.doPrivileged(
  1259         Boolean result = AccessController.doPrivileged(
  1259             new PrivilegedAction<Boolean>() {
  1260             new PrivilegedAction<Boolean>() {
  1260                 public Boolean run() {
  1261                 public Boolean run() {
  1261                     for (Class cl = subcl;
  1262                     for (Class<?> cl = subcl;
  1262                          cl != ObjectInputStream.class;
  1263                          cl != ObjectInputStream.class;
  1263                          cl = cl.getSuperclass())
  1264                          cl = cl.getSuperclass())
  1264                     {
  1265                     {
  1265                         try {
  1266                         try {
  1266                             cl.getDeclaredMethod(
  1267                             cl.getDeclaredMethod(
  2215          */
  2216          */
  2216         void doCallbacks() throws InvalidObjectException {
  2217         void doCallbacks() throws InvalidObjectException {
  2217             try {
  2218             try {
  2218                 while (list != null) {
  2219                 while (list != null) {
  2219                     AccessController.doPrivileged(
  2220                     AccessController.doPrivileged(
  2220                         new PrivilegedExceptionAction()
  2221                         new PrivilegedExceptionAction<Void>()
  2221                     {
  2222                     {
  2222                         public Object run() throws InvalidObjectException {
  2223                         public Void run() throws InvalidObjectException {
  2223                             list.obj.validateObject();
  2224                             list.obj.validateObject();
  2224                             return null;
  2225                             return null;
  2225                         }
  2226                         }
  2226                     }, list.acc);
  2227                     }, list.acc);
  2227                     list = list.next;
  2228                     list = list.next;