[jira] [Comment Edited] (SLING-9068) Add more context to ParseException

2022-06-07 Thread Bertrand Delacretaz (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17550837#comment-17550837
 ] 

Bertrand Delacretaz edited comment on SLING-9068 at 6/7/22 7:05 AM:


I guess what's needed is to include a relevant excerpt of the failing script in 
the error output, maybe something like

{code}
org.apache.sling.repoinit.parser.impl.ParseException: Encountered " "," ", "" 
at line 115, column 46.
Was expecting:
")" ...

Here's the last few lines, where ===> marks the one that causes the error:
create path /content(sling:OrderedFolder)
112 set ACL for anonymous
113 allow jcr:read on /etc/something
114 allow jcr:read on /etc/somethingelse
115 ===> created pathes /allwrong
 {code}

As mentioned, I haven't looked yet at how to implement this, just meant to 
clarify the requirements.


was (Author: bdelacretaz):
I guess what's needed is to include a relevant excerpt of the failing script in 
the error output, maybe something like

{code}
org.apache.sling.repoinit.parser.impl.ParseException: Encountered " "," ", "" 
at line 115, column 46.
Was expecting:
")" ...

Here's the last few lines, where ===> marks the one that causes the error:
create path /content(sling:OrderedFolder)
set ACL for anonymous
allow jcr:read on /etc/something
allow jcr:read on /etc/somethingelse
===> created pathes /allwrong
 {code}

As mentioned, I haven't looked yet at how to implement this, just meant to 
clarify the requirements.

> Add more context to ParseException
> --
>
> Key: SLING-9068
> URL: https://issues.apache.org/jira/browse/SLING-9068
> Project: Sling
>  Issue Type: Improvement
>  Components: Repoinit
>Affects Versions: Repoinit Parser 1.6.2
>Reporter: Angela Schreiber
>Priority: Minor
>
> today the repo init grammar doesn't come with dedicated exception handing and 
> thus the parser will fail with messages that can make it hard to spot actual 
> problem... specially in a lengthy repo-init as it is present with Adobe AEM. 
> Example:
> {code}
> org.apache.sling.repoinit.parser.impl.ParseException: Encountered " "," ", "" 
> at line 115, column 46.
> Was expecting:
> ")" ...
> 
>   at 
> org.apache.sling.repoinit.parser.impl.RepoInitParserImpl.generateParseException(RepoInitParserImpl.java:3095)
>  [org.apache.sling.repoinit.parser:1.3.2]
> {code}
> if i am not mistaken this should be doable be adding explicit exceptions to 
> the grammar.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Comment Edited] (SLING-9068) Add more context to ParseException

2020-02-20 Thread Bertrand Delacretaz (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17040810#comment-17040810
 ] 

Bertrand Delacretaz edited comment on SLING-9068 at 2/20/20 9:53 AM:
-

{quote}this should be doable be adding explicit exceptions to the grammar.
{quote}
I have not used those JavaCC features so far but the docs at 
[https://github.com/javacc/javacc/blob/master/docs/tutorials/error-handling.md] 
seem to confirm this.

The simplest might be to customize the generated {{ParseException.java}} which 
is meant for that, if that's sufficient.


was (Author: bdelacretaz):
bq. this should be doable be adding explicit exceptions to the grammar.

I have not used those JavaCC features so far but the docs at 
https://github.com/javacc/javacc/blob/master/docs/tutorials/error-handling.md 
seem to confirm this.

> Add more context to ParseException
> --
>
> Key: SLING-9068
> URL: https://issues.apache.org/jira/browse/SLING-9068
> Project: Sling
>  Issue Type: Improvement
>  Components: Repoinit
>Reporter: Angela Schreiber
>Priority: Minor
>
> today the repo init grammar doesn't come with dedicated exception handing and 
> thus the parser will fail with messages that can make it hard to spot actual 
> problem... specially in a lengthy repo-init as it is present with Adobe AEM. 
> Example:
> {code}
> org.apache.sling.repoinit.parser.impl.ParseException: Encountered " "," ", "" 
> at line 115, column 46.
> Was expecting:
> ")" ...
> 
>   at 
> org.apache.sling.repoinit.parser.impl.RepoInitParserImpl.generateParseException(RepoInitParserImpl.java:3095)
>  [org.apache.sling.repoinit.parser:1.3.2]
> {code}
> if i am not mistaken this should be doable be adding explicit exceptions to 
> the grammar.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)