* <li>QUERY = the ADQL query at the origin of this result.</li>
* </ul>
*
* <p>
* Furthermore, this formatter provides a function to format an error in VOTable: {@link #writeError(String, Map, PrintWriter)}.
* This is useful for TAP which requires to return in VOTable any error that occurs while any operation.
* <i>See {@link DefaultTAPErrorWriter} for more details.</i>
* Furthermore, this formatter provides a function to format an error in
* VOTable: {@link #writeError(String, Map, PrintWriter)}. This is useful for
* TAP which requires to return in VOTable any error that occurs while any
* operation. <i>See {@link DefaultTAPErrorWriter} for more details.</i>
* </p>
*
* @author Grégory Mantelet (CDS;ARI)
* @version 2.3 (03/2019)
* @version 2.4 (08/2020)
*/
publicclassVOTableFormatimplementsOutputFormat{
/** The {@link ServiceConnection} to use (for the log and to have some information about the service (particularly: name, description). */
/** The {@link ServiceConnection} to use (for the log and to have some
* information about the service (particularly: name, description). */
protectedfinalServiceConnectionservice;
/** Format of the VOTable data part in which data must be formatted. Possible values are: TABLEDATA, BINARY, BINARY2 or FITS. By default, it is set to BINARY. */
/** Format of the VOTable data part in which data must be formatted.
* Possible values are: TABLEDATA, BINARY, BINARY2 or FITS.
* By default, it is set to BINARY. */
protectedfinalDataFormatvotFormat;
/** VOTable version in which table data must be formatted. By default, it is set to v13. */
/** VOTable version in which table data must be formatted.
* By default, it is set to v13. */
protectedfinalVOTableVersionvotVersion;
/** MIME type associated with this format. */
@@ -106,61 +127,90 @@ public class VOTableFormat implements OutputFormat {
protectedStringshortMimeType;
/**
* <p>Creates a VOTable formatter.</p>
* Creates a VOTable formatter.
*
* <p><i>Note:
* The MIME type is automatically set to "application/x-votable+xml" = "votable".
* It is however possible to change this default value thanks to {@link #setMimeType(String, String)}.
* <p><i><b>Note:</b>
* The MIME type is automatically set to "application/x-votable+xml" =
* "votable". It is however possible to change this default value thanks to
* {@link #setMimeType(String, String)}.
* </i></p>
*
* @param service The service to use (for the log and to have some information about the service (particularly: name, description).
* @param service The service to use (for the log and to have some
* information about the service (particularly: name,
* description).
*
* @throws NullPointerException If the given service connection is <code>null</code>.
* @throws NullPointerException If the given service connection is NULL.
out.write("<INFO name=\"QUERY_STATUS\" value=\"ERROR\">Result truncated due to an unexpected grave error: "+VOSerializer.formatText(ex.getMessage())+"</INFO>");
// ...if synchronous, end properly the VOTable with an error INFO:
if(execReport!=null&&execReport.synchronous){
out.write("<INFO name=\"QUERY_STATUS\" value=\"ERROR\">Time out! (Hint: Try running this query in asynchronous mode to get the complete result)</INFO>");
out.newLine();
}
// ...if asynchronous, merely propagate the interruption:
else
thrownewInterruptedException();
/* Check for overflow and write INFO if required. */