1102 return defineClass(name, tb, 0, len, protectionDomain);
1103 }
1104 }
1105
1106 protectionDomain = preDefineClass(name, protectionDomain);
1107 String source = defineClassSourceLocation(protectionDomain);
1108 Class<?> c = defineClass2(this, name, b, b.position(), len, protectionDomain, source);
1109 postDefineClass(c, protectionDomain);
1110 return c;
1111 }
1112
1113 static native Class<?> defineClass1(ClassLoader loader, String name, byte[] b, int off, int len,
1114 ProtectionDomain pd, String source);
1115
1116 static native Class<?> defineClass2(ClassLoader loader, String name, java.nio.ByteBuffer b,
1117 int off, int len, ProtectionDomain pd,
1118 String source);
1119
1120 // true if the name is null or has the potential to be a valid binary name
1121 private boolean checkName(String name) {
1122 if ((name == null) || (name.length() == 0))
1123 return true;
1124 if ((name.indexOf('/') != -1) || (name.charAt(0) == '['))
1125 return false;
1126 return true;
1127 }
1128
1129 private void checkCerts(String name, CodeSource cs) {
1130 int i = name.lastIndexOf('.');
1131 String pname = (i == -1) ? "" : name.substring(0, i);
1132
1133 Certificate[] certs = null;
1134 if (cs != null) {
1135 certs = cs.getCertificates();
1136 }
1137 Certificate[] pcerts = null;
1138 if (parallelLockMap == null) {
1139 synchronized (this) {
1140 pcerts = package2certs.get(pname);
1141 if (pcerts == null) {
1142 package2certs.put(pname, (certs == null? nocerts:certs));
|
1102 return defineClass(name, tb, 0, len, protectionDomain);
1103 }
1104 }
1105
1106 protectionDomain = preDefineClass(name, protectionDomain);
1107 String source = defineClassSourceLocation(protectionDomain);
1108 Class<?> c = defineClass2(this, name, b, b.position(), len, protectionDomain, source);
1109 postDefineClass(c, protectionDomain);
1110 return c;
1111 }
1112
1113 static native Class<?> defineClass1(ClassLoader loader, String name, byte[] b, int off, int len,
1114 ProtectionDomain pd, String source);
1115
1116 static native Class<?> defineClass2(ClassLoader loader, String name, java.nio.ByteBuffer b,
1117 int off, int len, ProtectionDomain pd,
1118 String source);
1119
1120 // true if the name is null or has the potential to be a valid binary name
1121 private boolean checkName(String name) {
1122 if ((name == null) || (name.isEmpty()))
1123 return true;
1124 if ((name.indexOf('/') != -1) || (name.charAt(0) == '['))
1125 return false;
1126 return true;
1127 }
1128
1129 private void checkCerts(String name, CodeSource cs) {
1130 int i = name.lastIndexOf('.');
1131 String pname = (i == -1) ? "" : name.substring(0, i);
1132
1133 Certificate[] certs = null;
1134 if (cs != null) {
1135 certs = cs.getCertificates();
1136 }
1137 Certificate[] pcerts = null;
1138 if (parallelLockMap == null) {
1139 synchronized (this) {
1140 pcerts = package2certs.get(pname);
1141 if (pcerts == null) {
1142 package2certs.put(pname, (certs == null? nocerts:certs));
|