Skip to content
Snippets Groups Projects
Commit 34e04bf4 authored by gmantele's avatar gmantele
Browse files

[TAP] Fix exception management: do not encapsulate in a UWSException a...

[TAP] Fix exception management: do not encapsulate in a UWSException a TAPException whose the cause is already a UWSException ; in such case, the TAPException cause must be returned.
parent e7dff888
No related branches found
No related tags found
No related merge requests found
......@@ -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&eacute;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 !");
}
}
......
......@@ -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&eacute;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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment