Details about the known misuse from the MUBench dataset.
Description:
On line 187 EXTENDED.charAt() is invoked without ensuring that the
respective string actually has sufficiently many characters.
Fix Description:
Violation Types:
missing/condition/value_or_state
In File:
com/itextpdf/text/pdf/Barcode39.java
In Method:
getCode39Ex(String)
Code with Misuse:
class Barcode39 {
/** Converts the extended text into a normal, escaped text,
* ready to generate bars.
* @param text the extended text
* @return the escaped text
*/
public static String getCode39Ex(String text) {
StringBuilder out = new StringBuilder("");
for (int k = 0; k < text.length(); ++k) {
char c = text.charAt(k);
if (c > 127)
throw new IllegalArgumentException(MessageLocalization.getComposedMessage("the.character.1.is.illegal.in.code.39.extended", c));
char c1 = EXTENDED.charAt(c * 2);
char c2 = EXTENDED.charAt(c * 2 + 1);
if (c1 != ' ')
out.append(c1);
out.append(c2);
}
return out.toString();
}
}