This is implementstion of ReferenceTypeImpl.constantPool():
1012 public byte[] constantPool() {
1013 try {
1014 getConstantPoolInfo();
1015 } catch (RuntimeException exc) {
1016 throw exc;
1017 }
1018 if (constantPoolBytesRef != null) {
1019 byte[] cpbytes = (byte[])constantPoolBytesRef.get();
1020 /*
1021 * Arrays are always modifiable, so it is a little unsafe
1022 * to return the cached bytecodes directly; instead, we
1023 * make a clone at the cost of using more memory.
1024 */
1025 return (byte[])cpbytes.clone();
1026 } else {
1027 return null;
1028 }
1029 }
Implementation uses soft reference 'constantPoolBytesRef' to keep constant pool bytes, but constantPoolBytesRef.get()(line 1019) may return null if soft reference has been cleared, method 'constantPool()' doesn't check it and in this case cpbytes.clone()(line 1025) may thow NullPointerException.
1012 public byte[] constantPool() {
1013 try {
1014 getConstantPoolInfo();
1015 } catch (RuntimeException exc) {
1016 throw exc;
1017 }
1018 if (constantPoolBytesRef != null) {
1019 byte[] cpbytes = (byte[])constantPoolBytesRef.get();
1020 /*
1021 * Arrays are always modifiable, so it is a little unsafe
1022 * to return the cached bytecodes directly; instead, we
1023 * make a clone at the cost of using more memory.
1024 */
1025 return (byte[])cpbytes.clone();
1026 } else {
1027 return null;
1028 }
1029 }
Implementation uses soft reference 'constantPoolBytesRef' to keep constant pool bytes, but constantPoolBytesRef.get()(line 1019) may return null if soft reference has been cleared, method 'constantPool()' doesn't check it and in this case cpbytes.clone()(line 1025) may thow NullPointerException.