Skip to content

Commit

Permalink
Fixed bug introduced by negative addresses support
Browse files Browse the repository at this point in the history
  • Loading branch information
aragozin committed Dec 16, 2014
1 parent 4c4c910 commit 68f476a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Expand Up @@ -137,7 +137,7 @@ long offsetForCompressed(long cid) {
}
int shift = shiftMap[(int) (ref % pageSize)];
if (shift < 0) {
throw new IllegalArgumentException("ID is not valid: " + cid);
throw new IllegalArgumentException("Compressed ID is not valid: " + cid);
}
long offs = baseOffs + shift;
return offs;
Expand All @@ -164,7 +164,7 @@ private int scanPage(int page) {

// number of pages to be added up front
int ps = (int) (((cidOffset - ciid + pageSize - 1) / (pageSize)));
long oldIdBase = cidOffset;
long oldCidBase = cidOffset;
cidOffset -= ps * pageSize;
long[] noffsetMap = new long[offsetMap.length + ps];
Arrays.fill(noffsetMap, 0, ps, 0); // explicitly nullify array to avoid possible JIT bug
Expand All @@ -177,7 +177,7 @@ private int scanPage(int page) {
nestedScan = true;
scanPage(ps - 1);
// another shift may have happen
ps = (int) (compressID(oldIdBase) / pageSize);
ps = (int) (compressID(oldCidBase << allignmentBits) / pageSize);
maxPage = savedMaxPage + ps;
nestedScan = savedNestedScan;
page += ps;
Expand Down
Expand Up @@ -79,8 +79,7 @@ static HprofByteBuffer createHprofByteBuffer(File dumpFile)
long fileLen = dumpFile.length();

if (fileLen < MINIMAL_SIZE) {
String errText = ResourceBundle.getBundle("org/netbeans/lib/profiler/heap/Bundle")
.getString("HprofByteBuffer_ShortFile"); // NOI18N
String errText = "File size is too small";
throw new IOException(errText);
}

Expand Down

0 comments on commit 68f476a

Please sign in to comment.