W3C home > Mailing lists > Public > xproc-dev@w3.org > February 2011

Re: try/catch not behaving correctly in pipeline. No way to retrieve the c:error elements within c:errors

From: Romain Deltour <rdeltour@gmail.com>
Date: Thu, 3 Feb 2011 11:12:44 +0100
Message-Id: <C942F529-31CE-4941-A067-A070D08691C4@gmail.com>
To: Alam Sher <alam.sher@advoss.com>, XProc Dev <xproc-dev@w3.org>
> Norm's attention is requested :)

I suggest you file a new issue in the tracker:
http://code.google.com/p/xmlcalabash/issues/list

I guess patches are welcome too :)

BR
Romain.

Le 3 févr. 11 à 10:54, Alam Sher a écrit :

> Here is the catch block of XTry.java
>
> I can see the error in stack trace I manually print in the catch  
> block, but 'runtime.getXProcData().errors()' and 'errors' object  
> both are empty so nothing gets appended to c:errors block as I see.  
> I haven't seen the code base in detail yet where these error objects  
> should be populated, but seems to me an obvious bug in calabash.
>
>
> try {
>             xgroup.run();
>         } catch (Exception xe) {
>             xe.printStackTrace();
>             TreeWriter treeWriter = new TreeWriter(runtime);
>             treeWriter.startDocument(step.getNode().getBaseURI());
>             treeWriter.addStartElement(c_errors);
>             treeWriter.startContent();
>
>             for (XdmNode doc : runtime.getXProcData().errors()) {
>                 System.out.println("Adding error : " +  
> doc.getStringValue());
>                 treeWriter.addSubtree(doc);
>             }
>
>             for (XdmNode doc : errors) {
>                 System.out.println("Adding error : " +  
> doc.getStringValue());
>                 treeWriter.addSubtree(doc);
>             }
>
>             treeWriter.addEndElement();
>             treeWriter.endDocument();
>
>             XCatch xcatch = (XCatch) subpipeline.get(1);
>
>             xcatch.writeError(treeWriter.getResult());
>
>             for (String port : inputs.keySet()) {
>                 if (!port.startsWith("|")) {
>                     xcatch.inputs.put(port, inputs.get(port));
>                 }
>             }
>
>             for (String port : outputs.keySet()) {
>                 if (!port.endsWith("|")) {
>                     xcatch.outputs.put(port, outputs.get(port));
>                 }
>             }
>
>             xcatch.run();
>         }
>
>
>
>
> On 2/3/2011 12:04 AM, Romain Deltour wrote:
>>
>> It looks like a bug to me (as far as I understand)...
>>
>> Romain.
>>
>> Le 2 févr. 11 à 17:08, Alam Sher a écrit :
>>
>>> Why in the world I would get following output from this pipeline  
>>> using calabash?
>>>
>>>
>>> **************OUTPUT****************
>>> <c:errors xmlns:c="http://www.w3.org/ns/xproc-step"/>
>>>
>>> Should I not receive <c:error> children in here?
>>>
>>>
>>>
>>>
>>>
>>>
>>> ******************My Pipeline: *******************
>>>
>>> <?xml version="1.0"?>
>>> <p:declare-step name="vomsPipe" xmlns:p="http://www.w3.org/ns/xproc"
>>>     xmlns:c="http://www.w3.org/ns/xproc-step"
>>>     xmlns:cx="http://xmlcalabash.com/ns/extensions"
>>>     version="1.0">
>>>
>>>     <p:input port="source">
>>>         <p:empty/>
>>>     </p:input>
>>>     <p:output port="result">
>>>         <p:pipe step="try" port="result"/>
>>>     </p:output>
>>>
>>>     <p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl 
>>> "/>
>>>
>>>     <p:try name="try">
>>>         <p:group>
>>>             <p:output port="result"/>
>>>             <p:error name="sp-error" code="rc-non-zero" code- 
>>> prefix="advoss">
>>>                 <p:input port="source">
>>>                     <p:inline>
>>>                         <sometag>somevalue</sometag>
>>>                     </p:inline>
>>>                 </p:input>
>>>             </p:error>
>>>         </p:group>
>>>         <p:catch name="catch">
>>>             <p:output port="result"/>
>>>             <p:identity>
>>>                 <p:input port="source">
>>>                     <p:pipe step="catch" port="error"/>
>>>                 </p:input>
>>>             </p:identity>
>>>         </p:catch>
>>>     </p:try>
>>> </p:declare-step>
>>>
>>>
>>>
>>> -- 
>>> Alam Sher Khan
>>> Lead Engineer, Billing & Integration
>>> http://www.AdvOSS.com
>>> +92 321 512 6543
>>
>
>
> -- 
> Alam Sher Khan
> Lead Engineer, Billing & Integration
> http://www.AdvOSS.com
> +92 321 512 6543
Received on Thursday, 3 February 2011 10:19:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 3 February 2011 10:19:15 GMT