You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2007/10/19 18:58:50 UTC

[jira] Resolved: (SLING-69) ESPReader fails to parse some ESPs

     [ https://issues.apache.org/jira/browse/SLING-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-69.
------------------------------------

    Resolution: Fixed

The problem is the EspReader.read(char[] buf, int off, int len), which did not handle the number of characters read correctly if the offset is not zero, which is the case for Rhino.

Fixed the read method and added unit tests for this method.

Please confirm, whether it works. Thanks.

Fixed in Rev. 586537.

> ESPReader fails to parse some ESPs
> ----------------------------------
>
>                 Key: SLING-69
>                 URL: https://issues.apache.org/jira/browse/SLING-69
>             Project: Sling
>          Issue Type: Bug
>          Components: microsling
>            Reporter: Lars Trieloff
>            Assignee: Felix Meschberger
>
> The ESPReader is unable to pre-process following ESP snippet:
> <%-- microsling ESP template example, store this as html.esp --%>
> <html>
> <body>
> <p>This page is generated from an ESP template!</p>
> <h1>Edit <%= resource.getURI() %></h1>
> <form method="POST" action="/microsling<%= resource.getURI() %>.sling">
> <% 
> var it = resource.item.properties;
> while(it.hasNext()) {
> var p = it.next();
> %>
> <%
> if (p.name=="jcr:primaryType") {
> continue;
> }
> %>
> <p>
> <%= p.name %>
> <input type="text" name="<%= p.name %>" value="<%= p.string %>"/>
> </p>
> <%
> }
> %>
> <input type="submit">
> </form>
> <form method="POST" action="/microsling<%= resource.getURI() %>.edit.html">
> Downcase!
> <input type="submit">
> </form>
> </body>
> </html>
> The Javascript generated by the reader is as follows:
> out.write("\n");
> out.write("<html>\n");
> out.write("<body>\n");
> out.write("<p>This page is generated from an ESP template!</p>\n");
> out.write("<h1>Edit ");out.write( resource.getURI() );out.write("</h1>\n");
> out.write("\n");
> out.write("<form method=\"POST\" action=\"/microsling");out.write( resource.getURI() );out.write(".sling\">\n");
>  
> var it = resource.item.properties;
> while(it.hasNext()) {
> var p = it.next();
> out.write("\n");
> if (p.name=="jcr:primaryType") {
> continue;
> }
> out.write("\n");
> out.write("<p>\n");
> out.write( p.name );out.write("\n");
> out.write("<input type=\"text\" name=\"");out.write( p.name );out.write("\" value=\"");out.write( p.string );out.write("\"/>\n");
> out.write("</p>\n");
> }
> out.write("\n");
> out.write("<input type=\"submit\">\n");
> out.write("</form>\n");
> out.write("\n");
> out.write("\n");
> out.write("<form method=\"POST\" action=\"/microsling");out.write( resource.getURI() );out.write(".edit.html\">\n");
> out.write("Downcase!\n");
> out.write("<input type=\"submit\">\n");
> out.write("</form>\n");
> out.write("\n");
> out.write("</body>\n");
> out.write("</html>\n");
> This leads to an parser exception in Rhino, 
> unterminated string literal (/sling/scripts/microsling/example/edit/html.esp#31)
> org.mozilla.javascript.EvaluatorException: unterminated string literal (/sling/scripts/microsling/example/edit/html.esp#31)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.