W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2009

2006/unicorn/src/org/w3c/unicorn RequestThread.java,1.5,1.6

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 21 Sep 2009 12:14:36 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Mphmu-0008Bu-C9@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn
In directory hutz:/tmp/cvs-serv31464/src/org/w3c/unicorn

Modified Files:
	RequestThread.java 
Log Message:
cleanup
+ added an ArrayList<Message> used to contain messages to display on the result page

Index: RequestThread.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/RequestThread.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- RequestThread.java	18 Sep 2009 17:10:59 -0000	1.5
+++ RequestThread.java	21 Sep 2009 12:14:34 -0000	1.6
@@ -6,16 +6,18 @@
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.net.MalformedURLException;
-import java.util.Map;
+import java.util.ArrayList;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.event.EventCartridge;
+import org.w3c.unicorn.exceptions.UnicornException;
 import org.w3c.unicorn.request.Request;
 import org.w3c.unicorn.response.Response;
 import org.w3c.unicorn.response.parser.ResponseParserFactory;
 import org.w3c.unicorn.util.EscapeXMLEntities;
+import org.w3c.unicorn.util.Message;
 import org.w3c.unicorn.util.Templates;
 
 /**
@@ -29,11 +31,6 @@
 	 * Used for complex logging purpose
 	 */
 	private static final Log logger = LogFactory.getLog(RequestThread.class);;
-
-	/**
-	 * Data Structure for the responses
-	 */
-	//private Map<String, Response> mapOfResponse;
 	
 	private Response aResponse;
 
@@ -48,11 +45,8 @@
 	private String obsID;
 
 	private String lang;
-
-	/**
-	 * The call to perform
-	 */
-	//private UnicornCall unicornCall;
+	
+	private ArrayList<Message> messages;
 
 	/**
 	 * Initialize the thread by filling the properties
@@ -66,16 +60,14 @@
 	 * @param unicorn
 	 *            the unicorn call to make
 	 */
-	public RequestThread(//Map<String, Response> mapOfResponse, 
+	public RequestThread( 
 			Request aRequest,
 			String obsID,
-			//UnicornCall unicorn,
 			String lang) {
-		//this.mapOfResponse = mapOfResponse;
 		this.aRequest = aRequest;
 		this.obsID = obsID;
 		this.lang = lang;
-		//this.unicornCall = unicorn;
+		messages = new ArrayList<Message>();
 	}
 
 	/**
@@ -88,6 +80,8 @@
 			// Uncomment/comment next lines to test io_error
 			//throw new Exception("Message test de l'exception");
 			aResponse = this.aRequest.doRequest();
+		} catch (final UnicornException e) {
+			messages.add(e.getUnicornMessage());
 		} catch (final Exception e) {
 			RequestThread.logger.error("Exception : " + e.getMessage(), e);
 			try {
@@ -134,12 +128,6 @@
 		}
 		
 		this.aResponse.setObserverId(obsID);
-		
-		RequestThread.logger.debug(obsID + " before sync mapOfResponse");
-		/*synchronized (mapOfResponse) {
-			mapOfResponse.put(obsID, aResponse);
-		}*/
-		RequestThread.logger.debug(obsID + " after sync mapOfResponse");
 	}
 
 	public String getObsID() {
@@ -154,6 +142,14 @@
 		this.aResponse = aResponse;
 	}
 
+	public ArrayList<Message> getMessages() {
+		return messages;
+	}
+
+	public void setMessages(ArrayList<Message> messages) {
+		this.messages = messages;
+	}
+
 	
 	
 }
Received on Monday, 21 September 2009 12:14:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:14 GMT