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

2006/unicorn/src/org/w3c/unicorn/response/parser DefaultParser.java,1.1.2.1,1.1.2.2

From: Jean-Guilhem Rouel via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 21 Aug 2009 13:27:01 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MeU8z-0000nv-Ox@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/response/parser
In directory hutz:/tmp/cvs-serv3072/src/org/w3c/unicorn/response/parser

Modified Files:
      Tag: dev2
	DefaultParser.java 
Log Message:
Fixed issue with empty elements

Index: DefaultParser.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/response/parser/Attic/DefaultParser.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- DefaultParser.java	11 Aug 2009 16:05:37 -0000	1.1.2.1
+++ DefaultParser.java	21 Aug 2009 13:26:59 -0000	1.1.2.2
@@ -14,6 +14,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
 import org.w3.unicorn.observationresponse.ObservationresponseDocument;
 import org.w3.unicorn.observationresponse.ObservationresponseDocument.Observationresponse;
 import org.w3c.unicorn.response.A;
@@ -158,12 +159,36 @@
 			org.w3.unicorn.observationresponse.WarningDocument.Warning x,
 			String lang) {
 		Warning y = new Warning();
-		y.setLine(x.getLine());
-		y.setColumn(x.getColumn());
-		y.setContext(x.getContext());
-		y.setLevel(x.getLevel());
-		y.setMessage(swapListMessage(x.getMessageArray(), lang));
-		y.setLongmessage(swapListLongmessage(x.getLongmessageArray(), lang));
+		try {
+			y.setLine(x.getLine());
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the line. Or set it to 0?
+		}
+		try {
+			y.setColumn(x.getColumn());
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the column. Or set it to 0?
+		}
+		try {
+			y.setContext(x.getContext());
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the context. Or set it to 0?
+		}
+		try {
+			y.setLevel(x.getLevel());
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the level. Or set it to 0?
+		}
+		try {
+			y.setMessage(swapListMessage(x.getMessageArray(), lang));
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the message. Or set it to ""?
+		}
+		try {
+			y.setLongmessage(swapListLongmessage(x.getLongmessageArray(), lang));
+		}	 catch(XmlValueOutOfRangeException e) {
+			// just don't set the longmessage. Or set it to ""?
+		}
 		return y;
 	}
 
@@ -180,12 +205,37 @@
 			org.w3.unicorn.observationresponse.ErrorDocument.Error x,
 			String lang) {
 		Error y = new Error();
-		y.setLine(x.getLine());
-		y.setColumn(x.getColumn());
-		y.setErrortype(x.getErrortype());
-		y.setContext(x.getContext());
-		y.setMessage(swapListMessage(x.getMessageArray(), lang));
-		y.setLongmessage(swapListLongmessage(x.getLongmessageArray(), lang));
+		try {
+			y.setLine(x.getLine());
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the line. Or set it to 0?
+		}
+		try {
+			y.setColumn(x.getColumn());
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the column. Or set it to 0?
+		}
+		try {
+			y.setContext(x.getContext());
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the context. Or set it to 0?
+		}
+		try {
+			y.setErrortype(x.getErrortype());
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the type. Or set it to 0?
+		}
+		try {
+			y.setMessage(swapListMessage(x.getMessageArray(), lang));
+		} catch(XmlValueOutOfRangeException e) {
+			// just don't set the message. Or set it to ""?
+		}
+		try {
+			y.setLongmessage(swapListLongmessage(x.getLongmessageArray(), lang));
+		}	 catch(XmlValueOutOfRangeException e) {
+			// just don't set the longmessage. Or set it to ""?
+		}
+		
 		return y;
 	}
 
Received on Friday, 21 August 2009 13:27:11 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:38 UTC