diff --git a/src/tap/AbstractTAPFactory.java b/src/tap/AbstractTAPFactory.java index cc364a31b01345868c936a88eedbd50f6cf063d0..7642a5240554c3af5f54a19b3a2d5532a46fe4a4 100644 --- a/src/tap/AbstractTAPFactory.java +++ b/src/tap/AbstractTAPFactory.java @@ -16,7 +16,7 @@ package tap; * 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 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS), + * Copyright 2012-2015 - UDS/Centre de Données astronomiques de Strasbourg (CDS), * Astronomisches Rechen Institut (ARI) */ @@ -53,7 +53,7 @@ import adql.query.ADQLQuery; * Only the functions related with the database connection stay abstract. * * @author Grégory Mantelet (CDS;ARI) - * @version 2.0 (12/2014) + * @version 2.0 (02/2015) */ public abstract class AbstractTAPFactory extends TAPFactory { @@ -248,7 +248,10 @@ public abstract class AbstractTAPFactory extends TAPFactory { TAPParameters tapParams = createTAPParameters(request); return new TAPJob(owner, tapParams); }catch(TAPException te){ - throw new UWSException(UWSException.INTERNAL_SERVER_ERROR, te, "Can not create a TAP asynchronous job!"); + if (te.getCause() != null && te.getCause() instanceof UWSException) + throw (UWSException)te.getCause(); + else + throw new UWSException(UWSException.INTERNAL_SERVER_ERROR, te, "Can not create a TAP asynchronous job!"); } } @@ -265,7 +268,10 @@ public abstract class AbstractTAPFactory extends TAPFactory { try{ return new TAPJob(jobId, owner, params, quote, startTime, endTime, results, error); }catch(TAPException te){ - throw new UWSException(UWSException.INTERNAL_SERVER_ERROR, te, "Can not create a TAP asynchronous job !"); + if (te.getCause() != null && te.getCause() instanceof UWSException) + throw (UWSException)te.getCause(); + else + throw new UWSException(UWSException.INTERNAL_SERVER_ERROR, te, "Can not create a TAP asynchronous job !"); } } diff --git a/src/tap/TAPFactory.java b/src/tap/TAPFactory.java index 6dbc9a84209c0f76986dd7ebd94af6abce8b3a99..8c632c4d2047b218687fd2972f2cfb6a77a7e9b8 100644 --- a/src/tap/TAPFactory.java +++ b/src/tap/TAPFactory.java @@ -16,7 +16,7 @@ package tap; * 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 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS), + * Copyright 2012-2015 - UDS/Centre de Données astronomiques de Strasbourg (CDS), * Astronomisches Rechen Institut (ARI) */ @@ -61,7 +61,7 @@ import adql.query.ADQLQuery; * </ul> * * @author Grégory Mantelet (CDS;ARI) - * @version 2.0 (12/2014) + * @version 2.0 (02/2015) */ public abstract class TAPFactory implements UWSFactory { @@ -364,7 +364,10 @@ public abstract class TAPFactory implements UWSFactory { try{ return new AsyncThread((TAPJob)job, createADQLExecutor(), getErrorWriter()); }catch(TAPException te){ - throw new UWSException(UWSException.INTERNAL_SERVER_ERROR, te, "Impossible to create an AsyncThread !"); + if (te.getCause() != null && te.getCause() instanceof UWSException) + throw (UWSException)te.getCause(); + else + throw new UWSException(UWSException.INTERNAL_SERVER_ERROR, te, "Impossible to create an AsyncThread !"); } } @@ -385,7 +388,7 @@ public abstract class TAPFactory implements UWSFactory { try{ return createTAPParameters(request); }catch(TAPException te){ - if (te.getCause() != null && te.getCause() instanceof UWSException && te.getMessage().equals(te.getCause().getMessage())) + if (te.getCause() != null && te.getCause() instanceof UWSException) throw (UWSException)te.getCause(); else throw new UWSException(te.getHttpErrorCode(), te); @@ -423,7 +426,7 @@ public abstract class TAPFactory implements UWSFactory { try{ return createTAPParameters(params); }catch(TAPException te){ - if (te.getCause() != null && te.getCause() instanceof UWSException && te.getMessage().equals(te.getCause().getMessage())) + if (te.getCause() != null && te.getCause() instanceof UWSException) throw (UWSException)te.getCause(); else throw new UWSException(te.getHttpErrorCode(), te);