jdk/src/share/classes/java/io/ObjectStreamClass.java
changeset 10419 12c063b39232
parent 9035 1255eb81cc2f
child 11117 b6e68b1344d4
equal deleted inserted replaced
10418:1d57022fdb6e 10419:12c063b39232
   476 
   476 
   477         try {
   477         try {
   478             fieldRefl = getReflector(fields, this);
   478             fieldRefl = getReflector(fields, this);
   479         } catch (InvalidClassException ex) {
   479         } catch (InvalidClassException ex) {
   480             // field mismatches impossible when matching local fields vs. self
   480             // field mismatches impossible when matching local fields vs. self
   481             throw new InternalError();
   481             throw new InternalError(ex);
   482         }
   482         }
   483 
   483 
   484         if (deserializeEx == null) {
   484         if (deserializeEx == null) {
   485             if (isEnum) {
   485             if (isEnum) {
   486                 deserializeEx = new InvalidClassException(name, "enum type");
   486                 deserializeEx = new InvalidClassException(name, "enum type");
   939         if (cons != null) {
   939         if (cons != null) {
   940             try {
   940             try {
   941                 return cons.newInstance();
   941                 return cons.newInstance();
   942             } catch (IllegalAccessException ex) {
   942             } catch (IllegalAccessException ex) {
   943                 // should not occur, as access checks have been suppressed
   943                 // should not occur, as access checks have been suppressed
   944                 throw new InternalError();
   944                 throw new InternalError(ex);
   945             }
   945             }
   946         } else {
   946         } else {
   947             throw new UnsupportedOperationException();
   947             throw new UnsupportedOperationException();
   948         }
   948         }
   949     }
   949     }
   967                 } else {
   967                 } else {
   968                     throwMiscException(th);
   968                     throwMiscException(th);
   969                 }
   969                 }
   970             } catch (IllegalAccessException ex) {
   970             } catch (IllegalAccessException ex) {
   971                 // should not occur, as access checks have been suppressed
   971                 // should not occur, as access checks have been suppressed
   972                 throw new InternalError();
   972                 throw new InternalError(ex);
   973             }
   973             }
   974         } else {
   974         } else {
   975             throw new UnsupportedOperationException();
   975             throw new UnsupportedOperationException();
   976         }
   976         }
   977     }
   977     }
   998                 } else {
   998                 } else {
   999                     throwMiscException(th);
   999                     throwMiscException(th);
  1000                 }
  1000                 }
  1001             } catch (IllegalAccessException ex) {
  1001             } catch (IllegalAccessException ex) {
  1002                 // should not occur, as access checks have been suppressed
  1002                 // should not occur, as access checks have been suppressed
  1003                 throw new InternalError();
  1003                 throw new InternalError(ex);
  1004             }
  1004             }
  1005         } else {
  1005         } else {
  1006             throw new UnsupportedOperationException();
  1006             throw new UnsupportedOperationException();
  1007         }
  1007         }
  1008     }
  1008     }
  1026                 } else {
  1026                 } else {
  1027                     throwMiscException(th);
  1027                     throwMiscException(th);
  1028                 }
  1028                 }
  1029             } catch (IllegalAccessException ex) {
  1029             } catch (IllegalAccessException ex) {
  1030                 // should not occur, as access checks have been suppressed
  1030                 // should not occur, as access checks have been suppressed
  1031                 throw new InternalError();
  1031                 throw new InternalError(ex);
  1032             }
  1032             }
  1033         } else {
  1033         } else {
  1034             throw new UnsupportedOperationException();
  1034             throw new UnsupportedOperationException();
  1035         }
  1035         }
  1036     }
  1036     }
  1051                 Throwable th = ex.getTargetException();
  1051                 Throwable th = ex.getTargetException();
  1052                 if (th instanceof ObjectStreamException) {
  1052                 if (th instanceof ObjectStreamException) {
  1053                     throw (ObjectStreamException) th;
  1053                     throw (ObjectStreamException) th;
  1054                 } else {
  1054                 } else {
  1055                     throwMiscException(th);
  1055                     throwMiscException(th);
  1056                     throw new InternalError();  // never reached
  1056                     throw new InternalError(th);  // never reached
  1057                 }
  1057                 }
  1058             } catch (IllegalAccessException ex) {
  1058             } catch (IllegalAccessException ex) {
  1059                 // should not occur, as access checks have been suppressed
  1059                 // should not occur, as access checks have been suppressed
  1060                 throw new InternalError();
  1060                 throw new InternalError(ex);
  1061             }
  1061             }
  1062         } else {
  1062         } else {
  1063             throw new UnsupportedOperationException();
  1063             throw new UnsupportedOperationException();
  1064         }
  1064         }
  1065     }
  1065     }
  1080                 Throwable th = ex.getTargetException();
  1080                 Throwable th = ex.getTargetException();
  1081                 if (th instanceof ObjectStreamException) {
  1081                 if (th instanceof ObjectStreamException) {
  1082                     throw (ObjectStreamException) th;
  1082                     throw (ObjectStreamException) th;
  1083                 } else {
  1083                 } else {
  1084                     throwMiscException(th);
  1084                     throwMiscException(th);
  1085                     throw new InternalError();  // never reached
  1085                     throw new InternalError(th);  // never reached
  1086                 }
  1086                 }
  1087             } catch (IllegalAccessException ex) {
  1087             } catch (IllegalAccessException ex) {
  1088                 // should not occur, as access checks have been suppressed
  1088                 // should not occur, as access checks have been suppressed
  1089                 throw new InternalError();
  1089                 throw new InternalError(ex);
  1090             }
  1090             }
  1091         } else {
  1091         } else {
  1092             throw new UnsupportedOperationException();
  1092             throw new UnsupportedOperationException();
  1093         }
  1093         }
  1094     }
  1094     }
  1772             for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) {
  1772             for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) {
  1773                 hash = (hash << 8) | (hashBytes[i] & 0xFF);
  1773                 hash = (hash << 8) | (hashBytes[i] & 0xFF);
  1774             }
  1774             }
  1775             return hash;
  1775             return hash;
  1776         } catch (IOException ex) {
  1776         } catch (IOException ex) {
  1777             throw new InternalError();
  1777             throw new InternalError(ex);
  1778         } catch (NoSuchAlgorithmException ex) {
  1778         } catch (NoSuchAlgorithmException ex) {
  1779             throw new SecurityException(ex.getMessage());
  1779             throw new SecurityException(ex.getMessage());
  1780         }
  1780         }
  1781     }
  1781     }
  1782 
  1782