This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
The following commit(s) were added to refs/heads/trunk by this push: new 7104fc9 BCEL-278: Resolving NoSuchElementException in InvokeInstruction.toString(final ConstantPool cp) (#11) 7104fc9 is described below commit 7104fc95b7ec6b5c24a564b824d276cdd31045b2 Author: valery-barysok <valery.bary...@gmail.com> AuthorDate: Sat Apr 27 15:13:54 2019 +0300 BCEL-278: Resolving NoSuchElementException in InvokeInstruction.toString(final ConstantPool cp) (#11) --- .../java/org/apache/bcel/generic/InvokeInstruction.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/bcel/generic/InvokeInstruction.java b/src/main/java/org/apache/bcel/generic/InvokeInstruction.java index a457bae..63b0467 100644 --- a/src/main/java/org/apache/bcel/generic/InvokeInstruction.java +++ b/src/main/java/org/apache/bcel/generic/InvokeInstruction.java @@ -55,8 +55,19 @@ public abstract class InvokeInstruction extends FieldOrMethod implements Excepti public String toString( final ConstantPool cp ) { final Constant c = cp.getConstant(super.getIndex()); final StringTokenizer tok = new StringTokenizer(cp.constantToString(c)); - return Const.getOpcodeName(super.getOpcode()) + " " + tok.nextToken().replace('.', '/') - + tok.nextToken(); + + String opcodeName = Const.getOpcodeName(super.getOpcode()); + + StringBuilder sb = new StringBuilder(opcodeName); + if (tok.hasMoreTokens()) { + sb.append(" "); + sb.append(tok.nextToken().replace('.', '/')); + if (tok.hasMoreTokens()) { + sb.append(tok.nextToken()); + } + } + + return sb.toString(); }