From 10020f9323c009d7c8dcf0198ba4ab8b5fedc739 Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Wed, 20 Aug 2014 10:56:28 +0200
Subject: [PATCH] [All] Add missing @Override and correct the LGPL header

---
 src/adql/db/DBCommonColumn.java               |  2 +-
 src/adql/db/DefaultDBTable.java               |  2 +-
 src/adql/db/SearchColumnList.java             |  2 +-
 src/adql/db/SearchTableList.java              | 12 +++++----
 src/adql/db/exception/UnresolvedJoin.java     |  2 +-
 src/adql/query/ADQLQuery.java                 |  2 +-
 src/adql/query/ClauseADQL.java                |  2 +-
 src/adql/query/from/ADQLJoin.java             |  2 +-
 src/adql/query/from/FromContent.java          |  2 +-
 .../query/operand/function/DefaultUDF.java    |  2 +-
 .../query/operand/function/MathFunction.java  |  2 +-
 .../function/geometry/RegionFunction.java     |  2 +-
 src/tap/error/DefaultTAPErrorWriter.java      | 27 ++++++++++++-------
 src/tap/metadata/TAPType.java                 |  2 +-
 src/tap/metadata/VotType.java                 |  2 +-
 src/tap/parameters/MaxRecController.java      |  2 +-
 src/tap/resource/ASync.java                   |  2 --
 src/uws/job/UWSJob.java                       |  2 +-
 .../AbstractQueuedExecutionManager.java       |  8 +++++-
 .../job/manager/QueuedExecutionManager.java   |  1 -
 src/uws/service/UWSFactory.java               |  2 --
 src/uws/service/UWSUrl.java                   |  2 +-
 22 files changed, 48 insertions(+), 36 deletions(-)

diff --git a/src/adql/db/DBCommonColumn.java b/src/adql/db/DBCommonColumn.java
index fbbc73d..cab30f6 100644
--- a/src/adql/db/DBCommonColumn.java
+++ b/src/adql/db/DBCommonColumn.java
@@ -16,7 +16,7 @@ package adql.db;
  * You should have received a copy of the GNU Lesser General Public License
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
- * Copyright 2014 - Astronomishes Rechen Institute (ARI)
+ * Copyright 2014 - Astronomishes Rechen Institut (ARI)
  */
 
 import java.util.ArrayList;
diff --git a/src/adql/db/DefaultDBTable.java b/src/adql/db/DefaultDBTable.java
index baf7140..35fcfc5 100644
--- a/src/adql/db/DefaultDBTable.java
+++ b/src/adql/db/DefaultDBTable.java
@@ -17,7 +17,7 @@ package adql.db;
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomisches Rechen Institute (ARI)
+ *                       Astronomisches Rechen Institut (ARI)
  */
 
 import java.util.Collection;
diff --git a/src/adql/db/SearchColumnList.java b/src/adql/db/SearchColumnList.java
index 115e9d0..8411e4b 100644
--- a/src/adql/db/SearchColumnList.java
+++ b/src/adql/db/SearchColumnList.java
@@ -17,7 +17,7 @@ package adql.db;
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomishes Rechen Institute (ARI)
+ *                       Astronomishes Rechen Institut (ARI)
  */
 
 import java.util.ArrayList;
diff --git a/src/adql/db/SearchTableList.java b/src/adql/db/SearchTableList.java
index 649b4fd..d025be9 100644
--- a/src/adql/db/SearchTableList.java
+++ b/src/adql/db/SearchTableList.java
@@ -16,13 +16,14 @@ package adql.db;
  * You should have received a copy of the GNU Lesser General Public License
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
- * Copyright 2012 - UDS/Centre de Données astronomiques de Strasbourg (CDS)
+ * Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS)
+ *                       Astronomisches Rechen Institut (ARI)
  */
 
 import java.util.ArrayList;
 import java.util.Collection;
-import adql.query.IdentifierField;
 
+import adql.query.IdentifierField;
 import adql.query.from.ADQLTable;
 import cds.utils.TextualSearchList;
 
@@ -34,8 +35,8 @@ import cds.utils.TextualSearchList;
  * 	These last information will be used only if the ADQL table name is ambiguous, otherwise all matching elements are returned.
  * </p>
  * 
- * @author Gr&eacute;gory Mantelet (CDS)
- * @version 09/2011
+ * @author Gr&eacute;gory Mantelet (CDS;ARI)
+ * @version 1.3 (08/2014)
  */
 public class SearchTableList extends TextualSearchList<DBTable> {
 	private static final long serialVersionUID = 1L;
@@ -58,7 +59,7 @@ public class SearchTableList extends TextualSearchList<DBTable> {
 	 * 
 	 * @param collection	Collection of {@link DBTable} to copy.
 	 */
-	public SearchTableList(final Collection<DBTable> collection){
+	public SearchTableList(final Collection<? extends DBTable> collection){
 		super(collection, new DBTableKeyExtractor());
 	}
 
@@ -199,6 +200,7 @@ public class SearchTableList extends TextualSearchList<DBTable> {
 	 * @version 09/2011
 	 */
 	private static class DBTableKeyExtractor implements KeyExtractor<DBTable> {
+		@Override
 		public String getKey(DBTable obj){
 			return obj.getADQLName();
 		}
diff --git a/src/adql/db/exception/UnresolvedJoin.java b/src/adql/db/exception/UnresolvedJoin.java
index ac47cfd..c92440e 100644
--- a/src/adql/db/exception/UnresolvedJoin.java
+++ b/src/adql/db/exception/UnresolvedJoin.java
@@ -16,7 +16,7 @@ package adql.db.exception;
  * You should have received a copy of the GNU Lesser General Public License
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
- * Copyright 2013-2014 - Astronomishes Rechen Institute (ARI)
+ * Copyright 2013-2014 - Astronomishes Rechen Institut (ARI)
  */
 
 import adql.parser.ParseException;
diff --git a/src/adql/query/ADQLQuery.java b/src/adql/query/ADQLQuery.java
index ffbc997..39a7e6b 100644
--- a/src/adql/query/ADQLQuery.java
+++ b/src/adql/query/ADQLQuery.java
@@ -17,7 +17,7 @@ package adql.query;
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomishes Rechen Institute (ARI)
+ *                       Astronomishes Rechen Institut (ARI)
  */
 
 import java.util.ArrayList;
diff --git a/src/adql/query/ClauseADQL.java b/src/adql/query/ClauseADQL.java
index 7116b41..30bf6ab 100644
--- a/src/adql/query/ClauseADQL.java
+++ b/src/adql/query/ClauseADQL.java
@@ -17,7 +17,7 @@ package adql.query;
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2013 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomisches Rechen Institute (ARI)
+ *                       Astronomisches Rechen Institut (ARI)
  */
 
 /**
diff --git a/src/adql/query/from/ADQLJoin.java b/src/adql/query/from/ADQLJoin.java
index 9c9cb14..c719933 100644
--- a/src/adql/query/from/ADQLJoin.java
+++ b/src/adql/query/from/ADQLJoin.java
@@ -17,7 +17,7 @@ package adql.query.from;
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomishes Rechen Institute (ARI)
+ *                       Astronomishes Rechen Institut (ARI)
  */
 
 import java.util.ArrayList;
diff --git a/src/adql/query/from/FromContent.java b/src/adql/query/from/FromContent.java
index e9157f8..64da1e5 100644
--- a/src/adql/query/from/FromContent.java
+++ b/src/adql/query/from/FromContent.java
@@ -17,7 +17,7 @@ package adql.query.from;
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomishes Rechen Institute (ARI)
+ *                       Astronomishes Rechen Institut (ARI)
  */
 
 import java.util.ArrayList;
diff --git a/src/adql/query/operand/function/DefaultUDF.java b/src/adql/query/operand/function/DefaultUDF.java
index 55cafc3..c084365 100644
--- a/src/adql/query/operand/function/DefaultUDF.java
+++ b/src/adql/query/operand/function/DefaultUDF.java
@@ -16,7 +16,7 @@ package adql.query.operand.function;
  * You should have received a copy of the GNU Lesser General Public License
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
- * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS), Astronomisches Rechen Institute (ARI)
+ * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS), Astronomisches Rechen Institut (ARI)
  */
 
 import adql.query.ADQLList;
diff --git a/src/adql/query/operand/function/MathFunction.java b/src/adql/query/operand/function/MathFunction.java
index 0e89163..15acf0a 100644
--- a/src/adql/query/operand/function/MathFunction.java
+++ b/src/adql/query/operand/function/MathFunction.java
@@ -17,7 +17,7 @@ package adql.query.operand.function;
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomisches Rechen Institute (ARI)
+ *                       Astronomisches Rechen Institut (ARI)
  */
 
 import adql.query.ADQLObject;
diff --git a/src/adql/query/operand/function/geometry/RegionFunction.java b/src/adql/query/operand/function/geometry/RegionFunction.java
index 05ccf5e..dea04a2 100644
--- a/src/adql/query/operand/function/geometry/RegionFunction.java
+++ b/src/adql/query/operand/function/geometry/RegionFunction.java
@@ -17,7 +17,7 @@ package adql.query.operand.function.geometry;
  * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomisches Rechen Institute (ARI)
+ *                       Astronomisches Rechen Institut (ARI)
  */
 
 import adql.query.ADQLObject;
diff --git a/src/tap/error/DefaultTAPErrorWriter.java b/src/tap/error/DefaultTAPErrorWriter.java
index 85236b9..28c8602 100644
--- a/src/tap/error/DefaultTAPErrorWriter.java
+++ b/src/tap/error/DefaultTAPErrorWriter.java
@@ -27,10 +27,10 @@ import javax.servlet.http.HttpServletResponse;
 
 import tap.ServiceConnection;
 import uws.UWSException;
+import uws.job.ErrorType;
 import uws.job.user.JobOwner;
 import uws.service.error.AbstractServiceErrorWriter;
 import uws.service.error.ServiceErrorWriter;
-import uws.service.log.UWSLog;
 
 /**
  * <p>Default implementation of {@link ServiceErrorWriter} for a TAP service.</p>
@@ -52,7 +52,7 @@ import uws.service.log.UWSLog;
  * 
  * @see AbstractServiceErrorWriter
  */
-public class DefaultTAPErrorWriter extends AbstractServiceErrorWriter {
+public class DefaultTAPErrorWriter implements ServiceErrorWriter {
 
 	protected final ServiceConnection service;
 
@@ -60,11 +60,6 @@ public class DefaultTAPErrorWriter extends AbstractServiceErrorWriter {
 		this.service = service;
 	}
 
-	@Override
-	protected final UWSLog getLogger(){
-		return service.getLogger();
-	}
-
 	@Override
 	public void writeError(Throwable t, HttpServletResponse response, HttpServletRequest request, JobOwner user, String action) throws IOException{
 		if (t instanceof UWSException){
@@ -73,8 +68,22 @@ public class DefaultTAPErrorWriter extends AbstractServiceErrorWriter {
 			if (ue.getHttpErrorCode() == UWSException.INTERNAL_SERVER_ERROR)
 				getLogger().error(ue);
 			getLogger().httpRequest(request, user, action, ue.getHttpErrorCode(), ue.getMessage(), ue);
-		}else
-			super.writeError(t, response, request, user, action);
+		}else{
+			if (t != null && response != null){
+				formatError(t, true, ErrorType.FATAL, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, action, user, response, (request != null) ? request.getHeader("Accept") : null);
+				getLogger().error(t);
+				String errorMsg = t.getMessage();
+				if (errorMsg == null || errorMsg.trim().isEmpty())
+					errorMsg = t.getClass().getName() + " (no error message)";
+				getLogger().httpRequest(request, user, action, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errorMsg, t);
+			}
+		}
+	}
+
+	@Override
+	public void writeError(String message, ErrorType type, int httpErrorCode, HttpServletResponse response, HttpServletRequest request, JobOwner user, String action) throws IOException{
+		// TODO ServiceErrorWriter.writeError
+
 	}
 
 }
diff --git a/src/tap/metadata/TAPType.java b/src/tap/metadata/TAPType.java
index 9064354..1990d56 100644
--- a/src/tap/metadata/TAPType.java
+++ b/src/tap/metadata/TAPType.java
@@ -16,7 +16,7 @@ package tap.metadata;
  * 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 - Astronomishes Rechen Institute (ARI)
+ * Copyright 2014 - Astronomishes Rechen Institut (ARI)
  */
 
 /**
diff --git a/src/tap/metadata/VotType.java b/src/tap/metadata/VotType.java
index 16332eb..203c01d 100644
--- a/src/tap/metadata/VotType.java
+++ b/src/tap/metadata/VotType.java
@@ -17,7 +17,7 @@ package tap.metadata;
  * along with TAPLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomishes Rechen Institute (ARI)
+ *                       Astronomishes Rechen Institut (ARI)
  */
 
 import tap.TAPException;
diff --git a/src/tap/parameters/MaxRecController.java b/src/tap/parameters/MaxRecController.java
index 30851bc..3dabe0e 100644
--- a/src/tap/parameters/MaxRecController.java
+++ b/src/tap/parameters/MaxRecController.java
@@ -17,7 +17,7 @@ package tap.parameters;
  * along with TAPLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomisches Rechen Institute (ARI)
+ *                       Astronomisches Rechen Institut (ARI)
  */
 
 import tap.ServiceConnection;
diff --git a/src/tap/resource/ASync.java b/src/tap/resource/ASync.java
index c23eb72..6d8746a 100644
--- a/src/tap/resource/ASync.java
+++ b/src/tap/resource/ASync.java
@@ -42,12 +42,10 @@ public class ASync implements TAPResource {
 
 	public static final String RESOURCE_NAME = "async";
 
-	@SuppressWarnings("unchecked")
 	protected final ServiceConnection service;
 	protected final UWSService uws;
 	protected final JobList jobList;
 
-	@SuppressWarnings("unchecked")
 	public ASync(ServiceConnection service) throws UWSException, TAPException{
 		this.service = service;
 
diff --git a/src/uws/job/UWSJob.java b/src/uws/job/UWSJob.java
index 9fe509a..24b24e8 100644
--- a/src/uws/job/UWSJob.java
+++ b/src/uws/job/UWSJob.java
@@ -17,7 +17,7 @@ package uws.job;
  * along with UWSLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomisches Rechen Institute (ARI)
+ *                       Astronomisches Rechen Institut (ARI)
  */
 
 import java.io.IOException;
diff --git a/src/uws/job/manager/AbstractQueuedExecutionManager.java b/src/uws/job/manager/AbstractQueuedExecutionManager.java
index a2e1d40..6a14c8f 100644
--- a/src/uws/job/manager/AbstractQueuedExecutionManager.java
+++ b/src/uws/job/manager/AbstractQueuedExecutionManager.java
@@ -26,7 +26,6 @@ import java.util.Vector;
 
 import uws.UWSException;
 import uws.UWSToolBox;
-
 import uws.job.ErrorType;
 import uws.job.ExecutionPhase;
 import uws.job.UWSJob;
@@ -72,18 +71,22 @@ public abstract class AbstractQueuedExecutionManager implements ExecutionManager
 	/* ***************** */
 	/* GETTERS & SETTERS */
 	/* ***************** */
+	@Override
 	public final Iterator<UWSJob> getRunningJobs(){
 		return runningJobs.values().iterator();
 	}
 
+	@Override
 	public final int getNbRunningJobs(){
 		return runningJobs.size();
 	}
 
+	@Override
 	public final Iterator<UWSJob> getQueuedJobs(){
 		return queuedJobs.iterator();
 	}
 
+	@Override
 	public final int getNbQueuedJobs(){
 		return queuedJobs.size();
 	}
@@ -123,6 +126,7 @@ public abstract class AbstractQueuedExecutionManager implements ExecutionManager
 	 * 
 	 * @see uws.job.manager.ExecutionManager#refresh()
 	 */
+	@Override
 	public synchronized final void refresh() throws UWSException{
 		// Return immediately if no queue:
 		if (!hasQueue())
@@ -177,6 +181,7 @@ public abstract class AbstractQueuedExecutionManager implements ExecutionManager
 	 * 
 	 * @see uws.job.manager.ExecutionManager#execute(AbstractJob)
 	 */
+	@Override
 	public synchronized final ExecutionPhase execute(final UWSJob jobToExecute) throws UWSException{
 		if (jobToExecute == null)
 			return null;
@@ -216,6 +221,7 @@ public abstract class AbstractQueuedExecutionManager implements ExecutionManager
 	 * 
 	 * @see uws.job.manager.ExecutionManager#remove(uws.job.UWSJob)
 	 */
+	@Override
 	public final synchronized void remove(final UWSJob jobToRemove) throws UWSException{
 		if (jobToRemove != null){
 			runningJobs.remove(jobToRemove.getJobId());
diff --git a/src/uws/job/manager/QueuedExecutionManager.java b/src/uws/job/manager/QueuedExecutionManager.java
index 9fd9de4..4d750e4 100644
--- a/src/uws/job/manager/QueuedExecutionManager.java
+++ b/src/uws/job/manager/QueuedExecutionManager.java
@@ -20,7 +20,6 @@ package uws.job.manager;
  */
 
 import uws.UWSException;
-
 import uws.job.UWSJob;
 import uws.service.log.UWSLog;
 
diff --git a/src/uws/service/UWSFactory.java b/src/uws/service/UWSFactory.java
index 4cf384c..e9b45c2 100644
--- a/src/uws/service/UWSFactory.java
+++ b/src/uws/service/UWSFactory.java
@@ -25,12 +25,10 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 
 import uws.UWSException;
-
 import uws.job.ErrorSummary;
 import uws.job.JobThread;
 import uws.job.Result;
 import uws.job.UWSJob;
-
 import uws.job.parameters.UWSParameters;
 import uws.job.user.JobOwner;
 
diff --git a/src/uws/service/UWSUrl.java b/src/uws/service/UWSUrl.java
index 932b279..2376fa7 100644
--- a/src/uws/service/UWSUrl.java
+++ b/src/uws/service/UWSUrl.java
@@ -17,7 +17,7 @@ package uws.service;
  * along with UWSLibrary.  If not, see <http://www.gnu.org/licenses/>.
  * 
  * Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
- *                       Astronomishes Rechen Institute (ARI)
+ *                       Astronomishes Rechen Institut (ARI)
  */
 
 import java.io.Serializable;
-- 
GitLab