Skip to content
Snippets Groups Projects
Commit 25a783a8 authored by Grégory Mantelet's avatar Grégory Mantelet
Browse files

[TAP] Fix intermixed VOTable documents in synchronous mode.

Fix #52
parent 30dc11cb
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,8 @@ package tap.formatter;
* You should have received a copy of the GNU Lesser General Public License
* along with TAPLibrary. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2014-2015 - Astronomisches Rechen Institut (ARI)
* Copyright 2014-2020 - UDS/Centre de Données astronomiques de Strasbourg (CDS)
* Astronomisches Rechen Institut (ARI)
*/
import java.io.IOException;
......@@ -35,21 +36,24 @@ import uk.ac.starlink.table.StoragePolicy;
/**
* Format any given query (table) result into FITS.
*
* @author Gr&eacute;gory Mantelet (ARI)
* @version 2.1 (11/2015)
* @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 2.4 (08/2020)
* @since 2.0
*/
public class FITSFormat implements OutputFormat {
/** 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). */
protected final ServiceConnection service;
/**
* Creates a FITS formatter.
*
* @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.
*/
public FITSFormat(final ServiceConnection service) throws NullPointerException {
if (service == null)
......@@ -87,7 +91,20 @@ public class FITSFormat implements OutputFormat {
LimitedStarTable table = new LimitedStarTable(result, colInfos, execReport.parameters.getMaxRec(), thread);
// Copy the table on disk (or in memory if the table is short):
StarTable copyTable = StoragePolicy.PREFER_DISK.copyTable(table);
StarTable copyTable;
try {
copyTable = StoragePolicy.PREFER_DISK.copyTable(table);
} catch(IOException ioe) {
/* In case of time out, LimitedStarTable makes copyTable to stop by
* throwing an IOException. In such case, this IOException has to be
* interpreted as a normal interruption: */
if (thread.isInterrupted())
throw new InterruptedException();
/* Otherwise, the error has to be managed properly (so, wrap it
* inside a TAPException): */
else
throw new TAPException("Unexpected error while formatting the result!", ioe);
}
if (thread.isInterrupted())
throw new InterruptedException();
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment