mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8331655: ClassFile API ClassCastException with verbose output of certain class files
Reviewed-by: psandoz
This commit is contained in:
parent
36c9607f66
commit
c1a164528a
2 changed files with 13 additions and 15 deletions
|
@ -391,21 +391,10 @@ public final class ClassReaderImpl
|
|||
|
||||
@Override
|
||||
public AbstractPoolEntry.Utf8EntryImpl utf8EntryByIndex(int index) {
|
||||
if (index <= 0 || index >= constantPoolCount) {
|
||||
throw new ConstantPoolException("Bad CP UTF8 index: " + index);
|
||||
if (entryByIndex(index, TAG_UTF8, TAG_UTF8) instanceof AbstractPoolEntry.Utf8EntryImpl utf8) {
|
||||
return utf8;
|
||||
}
|
||||
PoolEntry info = cp[index];
|
||||
if (info == null) {
|
||||
int offset = cpOffset[index];
|
||||
int tag = readU1(offset);
|
||||
final int q = offset + 1;
|
||||
if (tag != TAG_UTF8) throw new ConstantPoolException("Not a UTF8 - index: " + index);
|
||||
AbstractPoolEntry.Utf8EntryImpl uinfo
|
||||
= new AbstractPoolEntry.Utf8EntryImpl(this, index, buffer, q + 2, readU2(q));
|
||||
cp[index] = uinfo;
|
||||
return uinfo;
|
||||
}
|
||||
return (AbstractPoolEntry.Utf8EntryImpl) info;
|
||||
throw new ConstantPoolException("Not a UTF8 - index: " + index);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue