- From: Florent Batard via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 18 Jul 2008 07:26:19 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/tasklist In directory hutz:/tmp/cvs-serv27851/org/w3c/unicorn/tasklist Modified Files: TaskListUnmarshallerBeans.java Log Message: Correct some bugs in the new XMLBeans unmarshaller Index: TaskListUnmarshallerBeans.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/tasklist/TaskListUnmarshallerBeans.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TaskListUnmarshallerBeans.java 17 Jul 2008 13:40:24 -0000 1.2 +++ TaskListUnmarshallerBeans.java 18 Jul 2008 07:26:17 -0000 1.3 @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; +import javax.activation.MimeTypeParseException; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; @@ -28,6 +29,8 @@ import org.w3c.unicorn.contract.InputMethod; import org.w3c.unicorn.contract.Observer; import org.w3c.unicorn.exceptions.ParameterException; +import org.w3c.unicorn.generated.tasklist.Observation; +import org.w3c.unicorn.generated.tasklist.Subtask; import org.w3c.unicorn.tasklist.parameters.Mapping; import org.w3c.unicorn.tasklist.parameters.Parameter; import org.w3c.unicorn.tasklist.parameters.ParameterFactory; @@ -76,6 +79,39 @@ final Task aTaskCurrent = new Task(); +// id + aTaskCurrent.setID(aTask.getId()); + + // subtasks + // TODO Refaire l'analyse des subtasks et l'ajout d'observations + /* + for (final Object oObserverOrTask : aTask.getSubtasks().getObservationOrSubtask()) { + if (oObserverOrTask instanceof Observation) { + // observer + try { + this.addObservation( + aTaskCurrent, + (Observation) oObserverOrTask); + } + catch (final MimeTypeParseException e) { + TaskListUnmarshallerBeans.logger.warn("MimeTypeParseException : "+e.getMessage(), e); + } + continue; + } + if (oObserverOrTask instanceof Subtask) { + final Subtask aSubtask = (Subtask) oObserverOrTask; + final String sReference = aSubtask.getRef(); + + if (sReference.equals(aTaskCurrent.getID())) { + TaskListUnmarshallerBeans.logger.warn( + "Simple reference loop detected in " + + "task " + sReference + "... Ignoring"); + continue; + } + aTaskCurrent.addReference(sReference); + } + } + */ // parameters final ParametersType aParameters = aTask.getParameters(); @@ -400,20 +436,13 @@ return this.mapOfTask; } - public void addURL(URL aURL) throws IOException, JAXBException, - SAXException { + public void addURL(URL aURL) throws IOException, XmlException{ TaskListUnmarshallerBeans.logger.trace("addURL"); if (TaskListUnmarshallerBeans.logger.isDebugEnabled()) { TaskListUnmarshallerBeans.logger.debug("URL : "+aURL+"."); } - try { - this.aTaskList = (TasklistType) TasklistType.Factory.parse(aURL.openStream()); - } catch (XmlException e) { - TaskListUnmarshallerBeans.logger.error("Parsing Error with XMLBeans", e); - e.printStackTrace(); - } - + this.aTaskList = (TasklistType) TasklistType.Factory.parse(aURL.openStream()); }
Received on Friday, 18 July 2008 07:26:54 UTC