You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by bu...@apache.org on 2003/05/09 01:31:46 UTC
DO NOT REPLY [Bug 19784] New: -
StackMapType.printIndex fails if index is -1
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19784>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19784
StackMapType.printIndex fails if index is -1
Summary: StackMapType.printIndex fails if index is -1
Product: BCEL
Version: unspecified
Platform: All
URL: http://cvs.apache.org/viewcvs/jakarta-
bcel/src/java/org/apache/bcel/classfile/StackMapType.jav
a?rev=1.2&content-type=text/vnd.viewcvs-markup
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Main
AssignedTo: bcel-dev@jakarta.apache.org
ReportedBy: mcrocker@markcrocker.com
There are circumstances where a StackMapType might have an index of -1.
Unfortunately, the printIndex method in StackMapType has problems with this.
The fix is simple:
Original code:
private String printIndex() {
if(type == Constants.ITEM_Object)
return ", class=" + constant_pool.constantToString(index,
Constants.CONSTANT_Class);
else if(type == Constants.ITEM_NewObject)
return ", offset=" + index;
else
return "";
}
Proposed fix:
private String printIndex() {
if(type == Constants.ITEM_Object) {
if(index == -1) {
return ", class=<unknown>";
} else {
return ", class=" + constant_pool.constantToString(index,
Constants.CONSTANT_Class) + "(" + index + ")";
}
} else if(type == Constants.ITEM_NewObject) {
if(index == -1) {
return ", offset=<unknown>";
} else {
return ", offset=" + index;
}
} else {
return "";
}
}
One could also argue that the ConstantPool.constantToString methods should be
fixed as well, though it could also be argued that such cases should fail. In
the case of StackMapType.printIndex, the case is much clearer.
P.S. While I'm at this, Bugzilla for BCEL doesn't have an option to select
version 5.1 of BCEL. This particular bug is in both 5.0 and 5.1.
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org