daisy / pipeline-webui

A Web User Interface for the DAISY Pipeline 2
Other
3 stars 2 forks source link

Problem when submitting empty options #79

Closed josteinaj closed 8 years ago

josteinaj commented 8 years ago

As of v2.1 the handling of empty options have changed. Before, an empty option were interpreted as an "undefined" option, and hence it was not submitted in the job request to the engine. After v2.1, I've changed it so that empty options are actually submitted in the job request. I'm getting the error below when submitting a job to the nlb:dtbook-to-pef script and not providing anything on the "stylesheet" file input widget. This might be an issue only with file input widgets actually...

2016-03-18 18:07:51,337 - [INFO] - from application in application-akka.actor.default-dispatcher-3 
------------------------------ Posting job... ------------------------------

2016-03-18 18:07:51,337 - [WARN] - from application in application-akka.actor.default-dispatcher-3 
[WS clientlib] File referenced from 'stylesheet' not found in context: ''

2016-03-18 18:07:51,338 - [DEBUG] - from application in application-akka.actor.default-dispatcher-3 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jobRequest xmlns="http://www.daisy.org/ns/pipeline/data">
<script href="http://localhost:8181/ws/scripts/nlb:dtbook-to-pef"/>
<input name="source">
<item value="file:/usr/share/daisy-pipeline2-webui/data/jobs/3305/context/555923.xml"/>
</input>
<option name="braille-standard">(dots:6)(grade:0)</option>
<option name="hyphenation">true</option>
<option name="line-spacing">single</option>
<option name="capital-letters">true</option>
<option name="stylesheet">
<item value=""/>
</option>
<option name="page-width">30</option>
<option name="page-height">28</option>
<option name="left-margin">0</option>
<option name="duplex">true</option>
<option name="include-captions">true</option>
<option name="include-images">true</option>
<option name="include-image-groups">true</option>
<option name="include-line-groups">true</option>
<option name="text-level-formatting">true</option>
<option name="include-note-references">true</option>
<option name="include-production-notes">false</option>
<option name="show-braille-page-numbers">true</option>
<option name="show-print-page-numbers">true</option>
<option name="toc-depth">0</option>
<option name="choice-of-colophon">
<item value=""/>
</option>
<option name="footnotes-placement">
<item value=""/>
</option>
<option name="colophon-metadata-placement">
<item value=""/>
</option>
<option name="rear-cover-placement">
<item value=""/>
</option>
<option name="number-of-pages">50</option>
<option name="maximum-number-of-pages">70</option>
<option name="minimum-number-of-pages">30</option>
</jobRequest>

2016-03-18 18:07:51,338 - [WARN] - from application in application-akka.actor.default-dispatcher-3 
[WS clientlib] File referenced from 'stylesheet' not found in context: ''

2016-03-18 18:07:51,353 - [ERROR] - from application in application-akka.actor.default-dispatcher-3 
[WS clientlib] http://localhost:8181/ws/jobs?authid=clientid&time=2016-03-18T17:07:51Z&nonce=379716178062170679860408676066&sign=5l0UuU1ZXtWdGwfT2ho%2Bk/rDtVg= failed: 

Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:517)
    at org.restlet.resource.ServerResource.post(ServerResource.java:1215)
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:592)
    at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:649)
    at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:348)
    at org.restlet.resource.ServerResource.handle(ServerResource.java:951)
    at org.restlet.resource.Finder.handle(Finder.java:246)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Router.doHandle(Router.java:431)
    at org.restlet.routing.Router.handle(Router.java:648)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)
    at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:84)
    at org.restlet.Application.handle(Application.java:381)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Router.doHandle(Router.java:431)
    at org.restlet.routing.Router.handle(Router.java:648)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Router.doHandle(Router.java:431)
    at org.restlet.routing.Router.handle(Router.java:648)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)
    at org.restlet.Component.handle(Component.java:392)
    at org.restlet.Server.handle(Server.java:516)
    at org.restlet.engine.ServerHelper.handle(ServerHelper.java:72)
    at org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:152)
    at org.restlet.ext.jetty.JettyServerHelper$WrappedServer.handle(JettyServerHelper.java:170)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Error parsing uri (

) for option stylesheet
    at org.daisy.pipeline.job.impl.XProcDecorator.decorateInputOptions(XProcDecorator.java:207)
    at org.daisy.pipeline.job.impl.XProcDecorator.decorateOptions(XProcDecorator.java:181)
    at org.daisy.pipeline.job.impl.XProcDecorator.decorate(XProcDecorator.java:93)
    at org.daisy.pipeline.job.JobContextFactory$SimpleJobContext.<init>(JobContextFactory.java:66)
    at org.daisy.pipeline.job.JobContextFactory.newJobContext(JobContextFactory.java:30)
    at org.daisy.pipeline.job.impl.DefaultJobManager$DefaultJobBuilder.build(DefaultJobManager.java:168)
    at org.daisy.pipeline.webservice.impl.JobsResource.createJob(JobsResource.java:387)
    at org.daisy.pipeline.webservice.impl.JobsResource.createResource(JobsResource.java:178)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:503)
    ... 52 more

2016-03-18 18:07:51,354 - [ERROR] - from application in application-akka.actor.default-dispatcher-3 
An error occured when trying to post job
bertfrees commented 8 years ago

What does <item value=""/> mean?

josteinaj commented 8 years ago

It's how we pass values to options when we submit jobs.

<option name="stylesheets">value</option> is a shorthand for <option name="stylesheets"><item value="value"/></option> for when there's only one value.

When the value is an empty string though I force the addition of the item element since otherwise the <option/> would self-close, thus removing the text node, and thus essentially undeclaring the option which is not the intention.

I think the solution to this bug is to remove all files with an empty href when parsing the values from the file widget. I'm going to try that now, hopefully I get it done this evening.