Details about the known misuse from the MUBench dataset.
Description:
StringTokenizer.nextToken() is invoked without prior check of hasMoreTokens(). Test target method implements a lookup, which may be expected to throw if there is no matching element. However, this is not explicit.
Fix Description:
Violation Types:
missing/condition/value_or_state
In File:
com/itextpdf/text/pdf/CJKFont.java
In Method:
getBBox(int)
Code with Misuse:
class CJKFont {
private float getBBox(int idx) {
String s = (String)fontDesc.get("FontBBox");
StringTokenizer tk = new StringTokenizer(s, " []\r\n\t\f");
String ret = tk.nextToken();
for (int k = 0; k < idx; ++k)
ret = tk.nextToken();
return Integer.parseInt(ret);
}
}