Program: 78723
Project: 78723
Buggy source:
/** 
 * Inserts the HTML specified as a string at the start of the element. <p>Consider the following structure (the <code>elem</code> parameter is <b>in bold</b>).</p> <pre> &lt;body&gt; | <b>&lt;div&gt;</b> /  \ &lt;p&gt;   &lt;p&gt; </pre> <p>Invoking <code>insertAfterStart(elem, "&lt;ul&gt;&lt;li&gt;")</code> results in the following structure (new elements are <font style="color: red;">in red</font>).</p> <pre> &lt;body&gt; | <b>&lt;div&gt;</b> /  |  \ <font style="color: red;">&lt;ul&gt;</font> &lt;p&gt; &lt;p&gt; / <font style="color: red;">&lt;li&gt;</font> </pre> <p>Unlike the <code>insertBeforeStart</code> method, new elements become <em>children</em> of the specified element, not siblings.</p> <p>Parameter <code>elem</code> must not be a leaf element, otherwise an <code>IllegalArgumentException</code> is thrown. If either <code>elem</code> or <code>htmlText</code> parameter is <code>null</code>, no changes are made to the document.</p> <p>For this to work correctly, the document must have an <code>HTMLEditorKit.Parser</code> set. This will be the case if the document was created from an HTMLEditorKit via the <code>createDefaultDocument</code> method.</p>
 * @param elem the branch element to be the root for the new text
 * @param htmlText the string to be parsed and assigned to <code>elem</code>
 * @throws IllegalArgumentException if <code>elem</code> is a leaf
 * @throws IllegalStateException if an HTMLEditorKit.Parser has notbeen set on the document
 * @since 1.3
 */
public void insertAfterStart(Element elem,String htmlText) throws BadLocationException, IOException {
  verifyParser();
  if (elem == null || htmlText == null) {
    return;
  }
  if (elem.isLeaf()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  insertHTML(elem,elem.getStartOffset(),htmlText,false);
}

Fixed version (ground truth):
/** 
 * Inserts the HTML specified as a string at the start of the element. <p>Consider the following structure (the <code>elem</code> parameter is <b>in bold</b>).</p> <pre> &lt;body&gt; | <b>&lt;div&gt;</b> /  \ &lt;p&gt;   &lt;p&gt; </pre> <p>Invoking <code>insertAfterStart(elem, "&lt;ul&gt;&lt;li&gt;")</code> results in the following structure (new elements are <font style="color: red;">in red</font>).</p> <pre> &lt;body&gt; | <b>&lt;div&gt;</b> /  |  \ <font style="color: red;">&lt;ul&gt;</font> &lt;p&gt; &lt;p&gt; / <font style="color: red;">&lt;li&gt;</font> </pre> <p>Unlike the <code>insertBeforeStart</code> method, new elements become <em>children</em> of the specified element, not siblings.</p> <p>Parameter <code>elem</code> must not be a leaf element, otherwise an <code>IllegalArgumentException</code> is thrown. If either <code>elem</code> or <code>htmlText</code> parameter is <code>null</code>, no changes are made to the document.</p> <p>For this to work correctly, the document must have an <code>HTMLEditorKit.Parser</code> set. This will be the case if the document was created from an HTMLEditorKit via the <code>createDefaultDocument</code> method.</p>
 * @param elem the branch element to be the root for the new text
 * @param htmlText the string to be parsed and assigned to <code>elem</code>
 * @throws IllegalArgumentException if <code>elem</code> is a leaf
 * @throws IllegalStateException if an HTMLEditorKit.Parser has notbeen set on the document
 * @throws BadLocationException if insertion is impossible because ofa structural issue
 * @throws IOException if an I/O exception occurs
 * @since 1.3
 */
public void insertAfterStart(Element elem,String htmlText) throws BadLocationException, IOException {
  verifyParser();
  if (elem == null || htmlText == null) {
    return;
  }
  if (elem.isLeaf()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  insertHTML(elem,elem.getStartOffset(),htmlText,false);
}