Program: 25109
Project: 25109
Buggy source:
/** 
 * <p>Write the given error message as VOTable document.</p> <p><i>Note: In the TAP protocol, all errors must be returned as VOTable. The class   {@link DefaultTAPErrorWriter} is in charge of the managementand reporting of all errors. It is calling this function while the error message to display to the user is ready and must be written in the HTTP response. </i></p> <p>Here is the XML format of this VOTable error:</p> <pre> &lt;VOTABLE version="..." xmlns="..." &gt; &lt;RESOURCE type="results"&gt; &lt;INFO name="QUERY_STATUS" value="ERROR&gt; ... &lt;/INFO&gt; &lt;INFO name="PROVIDER" value="..."&gt;...&lt;/INFO&gt; &lt;!-- other optional INFOs (e.g. request parameters) --&gt; &lt;/RESOURCE&gt; &lt;/VOTABLE&gt; </pre>
 * @param message	Error message to display to the user.
 * @param otherInfo	List of other additional information to display. <i>optional</i>
 * @param out		Stream in which the VOTable error must be written.
 * @throws IOException	If any error occurs while writing in the given output.
 * @since 2.0
 */
public void writeError(final String message,final Map<String,String> otherInfo,final PrintWriter writer) throws IOException {
  BufferedWriter out=new BufferedWriter(writer);
  out.write("String_Node_Str" + VOSerializer.formatAttribute("String_Node_Str",votVersion.getVersionNumber()) + VOSerializer.formatAttribute("String_Node_Str",votVersion.getXmlNamespace())+ "String_Node_Str");
  out.newLine();
  out.write("String_Node_Str");
  out.newLine();
  out.write("String_Node_Str" + VOSerializer.formatText(message) + "String_Node_Str");
  out.newLine();
  if (service.getProviderName() != null) {
    out.write("String_Node_Str" + VOSerializer.formatAttribute("String_Node_Str",service.getProviderName()) + "String_Node_Str"+ ((service.getProviderDescription() == null) ? "String_Node_Str" : VOSerializer.formatText(service.getProviderDescription()))+ "String_Node_Str");
    out.newLine();
  }
  if (otherInfo != null) {
    Iterator<Map.Entry<String,String>> it=otherInfo.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<String,String> entry=it.next();
      out.write("String_Node_Str" + VOSerializer.formatAttribute("String_Node_Str",entry.getKey()) + "String_Node_Str"+ VOSerializer.formatText(entry.getValue())+ "String_Node_Str");
      out.newLine();
    }
  }
  out.flush();
  out.write("String_Node_Str");
  out.newLine();
  out.write("String_Node_Str");
  out.newLine();
  out.flush();
}

Fixed version (ground truth):
/** 
 * <p>Write the given error message as VOTable document.</p> <p><i>Note: In the TAP protocol, all errors must be returned as VOTable. The class   {@link DefaultTAPErrorWriter} is in charge of the managementand reporting of all errors. It is calling this function while the error message to display to the user is ready and must be written in the HTTP response. </i></p> <p>Here is the XML format of this VOTable error:</p> <pre> &lt;VOTABLE version="..." xmlns="..." &gt; &lt;RESOURCE type="results"&gt; &lt;INFO name="QUERY_STATUS" value="ERROR&gt; ... &lt;/INFO&gt; &lt;INFO name="PROVIDER" value="..."&gt;...&lt;/INFO&gt; &lt;!-- other optional INFOs (e.g. request parameters) --&gt; &lt;/RESOURCE&gt; &lt;/VOTABLE&gt; </pre>
 * @param message	Error message to display to the user.
 * @param otherInfo	List of other additional information to display. <i>optional</i>
 * @param out		Stream in which the VOTable error must be written.
 * @throws IOException	If any error occurs while writing in the given output.
 * @since 2.0
 */
public void writeError(final String message,final Map<String,String> otherInfo,final PrintWriter writer) throws IOException {
  BufferedWriter out=new BufferedWriter(writer);
  out.write("String_Node_Str" + VOSerializer.formatAttribute("String_Node_Str",votVersion.getVersionNumber()) + VOSerializer.formatAttribute("String_Node_Str",votVersion.getXmlNamespace())+ "String_Node_Str");
  out.newLine();
  out.write("String_Node_Str");
  out.newLine();
  out.write("String_Node_Str" + (message == null ? "String_Node_Str" : VOSerializer.formatText(message)) + "String_Node_Str");
  out.newLine();
  if (service.getProviderName() != null) {
    out.write("String_Node_Str" + VOSerializer.formatAttribute("String_Node_Str",service.getProviderName()) + "String_Node_Str"+ ((service.getProviderDescription() == null) ? "String_Node_Str" : VOSerializer.formatText(service.getProviderDescription()))+ "String_Node_Str");
    out.newLine();
  }
  if (otherInfo != null) {
    Iterator<Map.Entry<String,String>> it=otherInfo.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<String,String> entry=it.next();
      out.write("String_Node_Str" + VOSerializer.formatAttribute("String_Node_Str",entry.getKey()) + "String_Node_Str"+ VOSerializer.formatText(entry.getValue())+ "String_Node_Str");
      out.newLine();
    }
  }
  out.flush();
  out.write("String_Node_Str");
  out.newLine();
  out.write("String_Node_Str");
  out.newLine();
  out.flush();
}