From f2337c4de4adf7700ccd05f1e92a6225b6c4e059 Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Fri, 14 Nov 2014 17:48:51 +0100
Subject: [PATCH] [TAP] Fix a grave error: synchronous jobs were stopped much
 before the specified execution duration ; the library was waiting N
 milliseconds, where N is the TAP execution duration always expressed in
 seconds.

---
 src/tap/TAPSyncJob.java        | 6 +++---
 src/tap/log/DefaultTAPLog.java | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/tap/TAPSyncJob.java b/src/tap/TAPSyncJob.java
index 92b2a08..81709c1 100644
--- a/src/tap/TAPSyncJob.java
+++ b/src/tap/TAPSyncJob.java
@@ -47,7 +47,7 @@ import uws.service.log.UWSLog.LogLevel;
  * </p>
  * 
  * @author Gr&eacute;gory Mantelet (CDS;ARI)
- * @version 2.0 (09/2014)
+ * @version 2.0 (11/2014)
  */
 public class TAPSyncJob {
 
@@ -190,7 +190,7 @@ public class TAPSyncJob {
 		boolean timeout = false;
 		try{
 			// wait the end:
-			thread.join(tapParams.getExecutionDuration());
+			thread.join(tapParams.getExecutionDuration() * 1000);
 			// if still alive after this duration, interrupt it:
 			if (thread.isAlive()){
 				timeout = true;
@@ -198,7 +198,7 @@ public class TAPSyncJob {
 				thread.join(waitForStop);
 			}
 		}catch(InterruptedException ie){
-			/* Having a such exception here, is not surprising, because we may have interrupt the thread! */
+			/* Having a such exception here, is not surprising, because we may have interrupted the thread! */
 		}finally{
 			// Whatever the way the execution stops (normal, cancel or error), an execution report must be fulfilled:
 			execReport = thread.getExecutionReport();
diff --git a/src/tap/log/DefaultTAPLog.java b/src/tap/log/DefaultTAPLog.java
index f20e6fa..629e24d 100644
--- a/src/tap/log/DefaultTAPLog.java
+++ b/src/tap/log/DefaultTAPLog.java
@@ -35,7 +35,7 @@ import uws.service.log.DefaultUWSLog;
  * Default implementation of the {@link TAPLog} interface which lets logging any message about a TAP service.
  * 
  * @author Gr&eacute;gory Mantelet (CDS;ARI)
- * @version 2.0 (09/2014)
+ * @version 2.0 (11/2014)
  * 
  * @see DefaultUWSLog
  */
@@ -126,7 +126,7 @@ public class DefaultTAPLog extends DefaultUWSLog implements TAPLog {
 		}
 
 		// Log the message:
-		log(level, "TAP", event, jobId, message + msgAppend, error);
+		log(level, "TAP", event, jobId, message + (msgAppend != null ? msgAppend : ""), error);
 	}
 
 }
-- 
GitLab