Skip to content

Commit

Permalink
Bug 581932 ArrayIndexOutOfBoundsException in ArrayIntCompressed
Browse files Browse the repository at this point in the history
on beforePass2 parsing

Add debug message if a class address can't be found in
beforePass2 parsing.

Change-Id: I3acf642d7d47b02dc9c6147b8ead4ed32045c472
  • Loading branch information
ajohnson1 committed May 26, 2023
1 parent 8a4b791 commit 5465107
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ public void beforePass2(IProgressListener monitor) throws IOException, SnapshotE
ClassImpl clazz = e.next();
int index = identifiers0.reverse(clazz.getObjectAddress());
clazz.setObjectId(index);
if (index < 0)
{
monitor.sendUserMessage(IProgressListener.Severity.ERROR,
MessageUtil.format(Messages.HprofParserHandlerImpl_ClassNotFoundInAddressIndex,
clazz.getTechnicalName()),
null);
}

maxClassId = Math.max(maxClassId, index);

Expand Down Expand Up @@ -397,6 +404,7 @@ private void addTypesAndDummyStatics()
cl.getFieldDescriptors().toArray(new FieldDescriptor[0]));
newcl.setClassInstance(type);
// Fix up the existing lookups
// Relies on replacement of a value being safe inside iterator
classesByAddress.put(e.getKey(), newcl);
List<ClassImpl>nms = classesByName.get(cl.getName());
for (int i = 0; i < nms.size(); ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class Messages extends NLS
public static String HprofIndexBuilder_Parsing;
public static String HprofIndexBuilder_Scanning;
public static String HprofIndexBuilder_Writing;
public static String HprofParserHandlerImpl_ClassNotFoundInAddressIndex;
public static String HprofParserHandlerImpl_DiscardedObjects;
public static String HprofParserHandlerImpl_Error_ExpectedClassSegment;
public static String HprofParserHandlerImpl_Error_MultipleClassInstancesExist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ HprofIndexBuilder_ExtractingObjects=Extracting objects from {0}
HprofIndexBuilder_Parsing=Parsing {0}
HprofIndexBuilder_Scanning=Scanning {0}
HprofIndexBuilder_Writing=Writing {0}
HprofParserHandlerImpl_ClassNotFoundInAddressIndex={0} not found in address index
HprofParserHandlerImpl_DiscardedObjects=Discarded {0} objects taking {1,number} bytes because of discard ratio {2,number,percent} with pattern {3}
HprofParserHandlerImpl_Error_ExpectedClassSegment=Error: Found instance segment but expected class segment (see FAQ): 0x{0}
HprofParserHandlerImpl_Error_MultipleClassInstancesExist=multiple class instances exist for {0}
Expand Down

0 comments on commit 5465107

Please sign in to comment.