提交 9d65e189 authored 作者: Thomas Mueller's avatar Thomas Mueller

The MVStoreTool could throw an IllegalArgumentException.

上级 a87076f0
...@@ -136,7 +136,13 @@ public class MVStoreTool { ...@@ -136,7 +136,13 @@ public class MVStoreTool {
TreeMap<Integer, Integer> mapSizes = new TreeMap<Integer, Integer>(); TreeMap<Integer, Integer> mapSizes = new TreeMap<Integer, Integer>();
int totalSize = 0; int totalSize = 0;
while (remaining > 0) { while (remaining > 0) {
chunk.position(p); try {
chunk.position(p);
} catch (IllegalArgumentException e) {
// too far
pw.printf("ERROR illegal position %d%n", p);
break;
}
int pageSize = chunk.getInt(); int pageSize = chunk.getInt();
// check value (ignored) // check value (ignored)
chunk.getShort(); chunk.getShort();
...@@ -232,12 +238,17 @@ public class MVStoreTool { ...@@ -232,12 +238,17 @@ public class MVStoreTool {
pw.printf("map %x: %d%%%n", mapId, percent); pw.printf("map %x: %d%%%n", mapId, percent);
} }
int footerPos = chunk.limit() - Chunk.FOOTER_LENGTH; int footerPos = chunk.limit() - Chunk.FOOTER_LENGTH;
chunk.position(footerPos); try {
pw.printf( chunk.position(footerPos);
"+%0" + len + "x chunkFooter %s%n", pw.printf(
footerPos, "+%0" + len + "x chunkFooter %s%n",
new String(chunk.array(), chunk.position(), footerPos,
Chunk.FOOTER_LENGTH, DataUtils.LATIN).trim()); new String(chunk.array(), chunk.position(),
Chunk.FOOTER_LENGTH, DataUtils.LATIN).trim());
} catch (IllegalArgumentException e) {
// too far
pw.printf("ERROR illegal footer position %d%n", footerPos);
}
} }
pw.printf("%n%0" + len + "x eof%n", fileSize); pw.printf("%n%0" + len + "x eof%n", fileSize);
pw.printf("\n"); pw.printf("\n");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论