Skip to content

Commit

Permalink
Bug 582520 beginTask should only be called once per instance.
Browse files Browse the repository at this point in the history
- Use HPROF parser first for .hprof.gz
- remove debug println

Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=582520
Change-Id: I9bbc43c4557f2f11c140700d77e5230a434876af
  • Loading branch information
ajohnson1 committed Oct 27, 2023
1 parent aecc806 commit 186324e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public IResult execute(IProgressListener listener) throws Exception
+ " -defaultoptions \"\"" //$NON-NLS-1$
+ " -options " + Converters.convertAndEscape(String.class, opts.toString()) //$NON-NLS-1$
);
System.out.println(spec.getCommand());
spec.set(Params.Html.COLLAPSED, Boolean.TRUE.toString());
spec.set(Params.Rendering.SORT_COLUMN, "#5"); //$NON-NLS-1$
spec.set(Params.Rendering.HIDE_COLUMN, "#7,#8,#9"); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,20 @@ public ISnapshot openSnapshot(File file, Map<String, String> args, IProgressList
cd2 = null;
}
if (cd1 != null && cd2 == null)
listtypes.add(tp);
for (String ext: tp.getFileSpecs(IContentType.FILE_EXTENSION_SPEC))
{
// Does extension itself contains a dot, and matches this file ?
if (ext.indexOf('.') >= 0 && name.endsWith("." + ext)) //$NON-NLS-1$
listtypes.add(tp);
for (String ext: tp.getFileSpecs(IContentType.FILE_EXTENSION_SPEC))
{
// It has a dot, so remove
n1 = name.substring(0, name.length() - ext.length());
// Does extension itself contains a dot, and matches this file ?
if (ext.indexOf('.') >= 0 && name.endsWith("." + ext)) //$NON-NLS-1$
{
// It has a dot, so remove
n1 = name.substring(0, name.length() - ext.length());
// This looks a good content type as matches with long extension.
// So put it first.
listtypes.remove(tp);
listtypes.add(0, tp);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ public CheckedWorkProgressListener(ErrorCollector collector)
public void beginTask(String s, int total)
{
collector.checkThat(s + ": Total work should be non-negative", total, greaterThanOrEqualTo(0));
collector.checkThat(s + ": beginTask() should not have already been called, total: ", this.total, equalTo(0));
collector.checkThat(s + ": beginTask(\"" + this.task + "\"," + this.total + ") should not have already been called, total: ", this.total, equalTo(0));
this.total = total;
this.task = s;
}
Expand Down Expand Up @@ -1485,8 +1485,12 @@ else if (hasMethods == Methods.FRAMES_ONLY)
}

ISnapshot newSnapshot;
// Fresh listener, can't be checked work as sometimes the dump is parsed twice, once as phd.gz and once and hprof.gz
checkListener = new CheckedProgressListener(collector);
/*
* Fresh listener.
* Checked work okay so long as the dump is parsed by the correct
* parser first, e.g. HPROF for hprof.gz rather than as PHD gz first.
*/
checkListener = new CheckedWorkProgressListener(collector);
try
{
newSnapshot = SnapshotFactory.openSnapshot(newSnapshotFile, Collections.<String,String>emptyMap(), checkListener);
Expand Down

0 comments on commit 186324e

Please sign in to comment.