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
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -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,6 +248,9 @@ public abstract class AbstractTAPFactory extends TAPFactory {
			TAPParameters tapParams = createTAPParameters(request);
			return new TAPJob(owner, tapParams);
		}catch(TAPException te){
			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,6 +268,9 @@ public abstract class AbstractTAPFactory extends TAPFactory {
		try{
			return new TAPJob(jobId, owner, params, quote, startTime, endTime, results, error);
		}catch(TAPException te){
			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 !");
		}
	}
+8 −5
Original line number Diff line number Diff line
@@ -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,6 +364,9 @@ public abstract class TAPFactory implements UWSFactory {
		try{
			return new AsyncThread((TAPJob)job, createADQLExecutor(), getErrorWriter());
		}catch(TAPException te){
			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);