[jira] [Commented] (SLING-7756) Improve logging for Job retries

2018-07-03 Thread indra kumar gurjar (JIRA)


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

indra kumar gurjar commented on SLING-7756:
---

[~kwin] I think the logging is already there with DEBUG log level at [0], and  
[1] but it doesn't contain retry count info. Can we improve this logging by 
adding retry info? Is the log level DEBUG enough here or we should change it to 
WARN/ERROR ? 

I will open a PR with changes after your thoughts on above points. Thanks!

 

[0]:[https://github.com/apache/sling-org-apache-sling-event/blob/ca009499cbe30ae30df5069effe051e0bef9ef72/src/main/java/org/apache/sling/event/impl/jobs/queues/JobQueueImpl.java#L465]

[1]:https://github.com/apache/sling-org-apache-sling-event/blob/ca009499cbe30ae30df5069effe051e0bef9ef72/src/main/java/org/apache/sling/event/impl/jobs/queues/JobQueueImpl.java#L458

> Improve logging for Job retries
> ---
>
> Key: SLING-7756
> URL: https://issues.apache.org/jira/browse/SLING-7756
> Project: Sling
>  Issue Type: Improvement
>  Components: Event
>Affects Versions: Event 4.2.10
>Reporter: Konrad Windszus
>Priority: Major
>
> Currently a {{JobConsumer}} returning {{JobResult.FAILED}} is usually retried 
> (https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html).
>  Unfortunately this is not exposed in the logs, so in case a JobConsumer logs 
> an error before returning {{JobResult.FAILED}} the job is silently retried 
> without any particular log message. I think each failed job should lead to a 
> WARN in the log (in case the job is retried) with the attempt number and 
> outstanding attempts in the log message. In case a job is not retried, an 
> ERROR should be emitted to the log for every failed job.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (SLING-7658) XSSApi.encodeForHtml doesn't leave unicode character escapes untouched

2018-05-29 Thread indra kumar gurjar (JIRA)


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

indra kumar gurjar edited comment on SLING-7658 at 5/30/18 5:24 AM:


[~kwin] I think  XSSAPI.encodeForHTML() API is working as designed as it 
protects from introducing html entities. the unicode escaped characters are 
like html entities and not simple text.

We expect browser to not interpret(render) the encoded string as html entity 
but as plain text. so when we encode "#9989;" , we expect this to be 
rendered as "#9989;", not render differently and XSSAPI.encodeForHTML() 
API is doing this very well.

I have opened issue - [https://github.com/OWASP/owasp-java-encoder/issues/18]

at OWASP java encoder project and this is their view:

"The encoder is meant, on purpose, to encode all dangerous characters like you 
are describing. This is not the right tool for you. If you have HTML entities 
that you wish to preserve then your input is HTML. Consider using the OWASP 
HTML Sanitizer instead." [0]

Can XSSFilter [1] help here?

[0]: 
[https://github.com/OWASP/java-html-sanitizer/blob/master/src/main/java/org/owasp/html/HtmlSanitizer.java]

[1]:[https://github.com/apache/sling-org-apache-sling-xss/blob/master/src/main/java/org/apache/sling/xss/XSSFilter.java#L51]

 


was (Author: igurjar):
[~kwin] I think  XSSAPI.encodeForHTML() API is working as designed as it 
protects from introducing html entities. the unicode escaped characters are 
like html entities and not simple text.

We expect browser to not interpret(render) the encoded string as html entity 
but as plain text. so when we encode "" , we expect this to be rendered 
as "", not render differently and XSSAPI.encodeForHTML() API is doing 
this very well.

I have opened issue - [https://github.com/OWASP/owasp-java-encoder/issues/18]

at OWASP java encoder project and this is their view:

"The encoder is meant, on purpose, to encode all dangerous characters like you 
are describing. This is not the right tool for you. If you have HTML entities 
that you wish to preserve then your input is HTML. Consider using the OWASP 
HTML Sanitizer instead." [0]

Can XSSFilter [1] help here?

[0]: 
[https://github.com/OWASP/java-html-sanitizer/blob/master/src/main/java/org/owasp/html/HtmlSanitizer.java]

[1]:[https://github.com/apache/sling-org-apache-sling-xss/blob/master/src/main/java/org/apache/sling/xss/XSSFilter.java#L51]

 

> XSSApi.encodeForHtml doesn't leave unicode character escapes untouched
> --
>
> Key: SLING-7658
> URL: https://issues.apache.org/jira/browse/SLING-7658
> Project: Sling
>  Issue Type: Bug
>  Components: XSS Protection API
>Affects Versions: XSS Protection API 2.1.0
>Reporter: Konrad Windszus
>Priority: Major
> Attachments: SLING-7658-v01.patch
>
>
> Whenever {{encodeForHtml}} is called with a string containing a unicode 
> character escapes 
> (https://www.w3.org/International/questions/qa-escapes#answer), the {{&}} 
> gets escaped again. I.e. {{}} becomes {{#9989;}}.
> Compare with the discussion at 
> https://www.mail-archive.com/dev@sling.apache.org/msg76863.html.
> Attached is a patch with a failing test.
> Another use case for using unicode character escapes is the soft hyphen 
> (https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens#Suggesting_line_break_opportunities).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SLING-7658) XSSApi.encodeForHtml doesn't leave unicode character escapes untouched

2018-05-29 Thread indra kumar gurjar (JIRA)


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

indra kumar gurjar commented on SLING-7658:
---

[~kwin] I think  XSSAPI.encodeForHTML() API is working as designed as it 
protects from introducing html entities. the unicode escaped characters are 
like html entities and not simple text.

We expect browser to not interpret(render) the encoded string as html entity 
but as plain text. so when we encode "" , we expect this to be rendered 
as "", not render differently and XSSAPI.encodeForHTML() API is doing 
this very well.

I have opened issue - [https://github.com/OWASP/owasp-java-encoder/issues/18]

at OWASP java encoder project and this is their view:

"The encoder is meant, on purpose, to encode all dangerous characters like you 
are describing. This is not the right tool for you. If you have HTML entities 
that you wish to preserve then your input is HTML. Consider using the OWASP 
HTML Sanitizer instead." [0]

Can XSSFilter [1] help here?

[0]: 
[https://github.com/OWASP/java-html-sanitizer/blob/master/src/main/java/org/owasp/html/HtmlSanitizer.java]

[1]:[https://github.com/apache/sling-org-apache-sling-xss/blob/master/src/main/java/org/apache/sling/xss/XSSFilter.java#L51]

 

> XSSApi.encodeForHtml doesn't leave unicode character escapes untouched
> --
>
> Key: SLING-7658
> URL: https://issues.apache.org/jira/browse/SLING-7658
> Project: Sling
>  Issue Type: Bug
>  Components: XSS Protection API
>Affects Versions: XSS Protection API 2.1.0
>Reporter: Konrad Windszus
>Priority: Major
> Attachments: SLING-7658-v01.patch
>
>
> Whenever {{encodeForHtml}} is called with a string containing a unicode 
> character escapes 
> (https://www.w3.org/International/questions/qa-escapes#answer), the {{&}} 
> gets escaped again. I.e. {{}} becomes {{#9989;}}.
> Compare with the discussion at 
> https://www.mail-archive.com/dev@sling.apache.org/msg76863.html.
> Attached is a patch with a failing test.
> Another use case for using unicode character escapes is the soft hyphen 
> (https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens#Suggesting_line_break_opportunities).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SLING-7686) Test case for org.apache.sling.feature.builder.ApplicationBuilder

2018-05-28 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar commented on SLING-7686:
---

PR opened with new test cases covering these use cases - 
[https://github.com/apache/sling-org-apache-sling-feature/pull/1]

[~bosschaert]  I would like to contribute by adding test cases. Could you 
please help in reviewing the pull request?

> Test case for org.apache.sling.feature.builder.ApplicationBuilder
> -
>
> Key: SLING-7686
> URL: https://issues.apache.org/jira/browse/SLING-7686
> Project: Sling
>  Issue Type: Test
>  Components: Feature Model
>Affects Versions: Feature Model 0.1.0
>Reporter: indra kumar gurjar
>Priority: Major
> Fix For: Feature Model 0.1.0
>
>
> Add new test case for  org.apache.sling.feature.builder.ApplicationBuilder 
> which validates various use cases e.g.
>  # Application built without feature existence.
>  # Application built with duplicate features
>  # Application built with duplicate bundles, configurations, framework 
> properties
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (SLING-7686) Test case for org.apache.sling.feature.builder.ApplicationBuilder

2018-05-28 Thread indra kumar gurjar (JIRA)
indra kumar gurjar created SLING-7686:
-

 Summary: Test case for 
org.apache.sling.feature.builder.ApplicationBuilder
 Key: SLING-7686
 URL: https://issues.apache.org/jira/browse/SLING-7686
 Project: Sling
  Issue Type: Test
  Components: Feature Model
Affects Versions: Feature Model 0.1.0
Reporter: indra kumar gurjar
 Fix For: Feature Model 0.1.0


Add new test case for  org.apache.sling.feature.builder.ApplicationBuilder 
which validates various use cases e.g.
 # Application built without feature existence.
 # Application built with duplicate features
 # Application built with duplicate bundles, configurations, framework 
properties

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-15 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar commented on SLING-7666:
---

[~rombert] Here is the PR - 
[https://github.com/apache/sling-site/pull/14|https://github.com/apache/sling-site/pull/14.]
 . 

> Update sling site documentation for bundle - sling-eventing-and-job-handling
> 
>
> Key: SLING-7666
> URL: https://issues.apache.org/jira/browse/SLING-7666
> Project: Sling
>  Issue Type: Improvement
>  Components: Documentation
>Reporter: indra kumar gurjar
>Priority: Minor
> Attachments: site.patch
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> The sling sling-eventing-and-job-handling bundle documentation doesn't 
> include information of  "JobExecutor" , it describes only "JobConsumer".
> If consumer needs more features like providing progress information or adding 
> more information of the processing, JobExecutor should be implemented. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar edited comment on SLING-7666 at 5/14/18 2:58 PM:


[^site.patch] Contains proposed improvements in documentation.

cc [~lnra54] 


was (Author: igurjar):
[^site.patch] Contains proposed improvements in documentation.

 

cc [~lnra54] 

> Update sling site documentation for bundle - sling-eventing-and-job-handling
> 
>
> Key: SLING-7666
> URL: https://issues.apache.org/jira/browse/SLING-7666
> Project: Sling
>  Issue Type: Improvement
>  Components: Documentation
>Reporter: indra kumar gurjar
>Priority: Minor
> Attachments: site.patch
>
>
> The sling sling-eventing-and-job-handling bundle documentation doesn't 
> include information of  "JobExecutor" , it describes only "JobConsumer".
> If consumer needs more features like providing progress information or adding 
> more information of the processing, JobExecutor should be implemented. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar edited comment on SLING-7666 at 5/14/18 2:58 PM:


[^site.patch] Contains proposed improvements in documentation.

 

cc [~lnra54] 


was (Author: igurjar):
[^site.patch] Contains proposed improvements in documentation.

> Update sling site documentation for bundle - sling-eventing-and-job-handling
> 
>
> Key: SLING-7666
> URL: https://issues.apache.org/jira/browse/SLING-7666
> Project: Sling
>  Issue Type: Improvement
>  Components: Documentation
>Reporter: indra kumar gurjar
>Priority: Minor
> Attachments: site.patch
>
>
> The sling sling-eventing-and-job-handling bundle documentation doesn't 
> include information of  "JobExecutor" , it describes only "JobConsumer".
> If consumer needs more features like providing progress information or adding 
> more information of the processing, JobExecutor should be implemented. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar commented on SLING-7666:
---

[^site.patch] Contains proposed improvements in documentation.

> Update sling site documentation for bundle - sling-eventing-and-job-handling
> 
>
> Key: SLING-7666
> URL: https://issues.apache.org/jira/browse/SLING-7666
> Project: Sling
>  Issue Type: Improvement
>  Components: Documentation
>Reporter: indra kumar gurjar
>Priority: Minor
> Attachments: site.patch
>
>
> The sling sling-eventing-and-job-handling bundle documentation doesn't 
> include information of  "JobExecutor" , it describes only "JobConsumer".
> If consumer needs more features like providing progress information or adding 
> more information of the processing, JobExecutor should be implemented. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar updated SLING-7666:
--
Attachment: site.patch

> Update sling site documentation for bundle - sling-eventing-and-job-handling
> 
>
> Key: SLING-7666
> URL: https://issues.apache.org/jira/browse/SLING-7666
> Project: Sling
>  Issue Type: Improvement
>  Components: Documentation
>Reporter: indra kumar gurjar
>Priority: Minor
> Attachments: site.patch
>
>
> The sling sling-eventing-and-job-handling bundle documentation doesn't 
> include information of  "JobExecutor" , it describes only "JobConsumer".
> If consumer needs more features like providing progress information or adding 
> more information of the processing, JobExecutor should be implemented. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar updated SLING-7666:
--
Component/s: (was: API)
 Documentation

> Update sling site documentation for bundle - sling-eventing-and-job-handling
> 
>
> Key: SLING-7666
> URL: https://issues.apache.org/jira/browse/SLING-7666
> Project: Sling
>  Issue Type: Improvement
>  Components: Documentation
>Reporter: indra kumar gurjar
>Priority: Minor
>
> The sling sling-eventing-and-job-handling bundle documentation doesn't 
> include information of  "JobExecutor" , it describes only "JobConsumer".
> If consumer needs more features like providing progress information or adding 
> more information of the processing, JobExecutor should be implemented. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SLING-7661) Provide mechanism to persist error message/s in Sling Jobs API

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar commented on SLING-7661:
---

[~lnra54] Opened SLING-7666  for updating sling site documentation.

> Provide mechanism to persist error message/s in Sling Jobs API
> --
>
> Key: SLING-7661
> URL: https://issues.apache.org/jira/browse/SLING-7661
> Project: Sling
>  Issue Type: Improvement
>  Components: API
>Reporter: Leonardo Rodriguez
>Priority: Minor
>
> The sling Jobs API provides a JobConsumer interface: 
> org.apache.sling.event.jobs.consumer.JobConsumer" and Job interface: 
> org.apache.sling.event.jobs.Job.
> Currently, when a JobConsumer fails, it's supposed to return a 
> JobResult.CANCEL, but there is no way to set an error message.
> Looking at the JCR, we see that such (failed/canceled) jobs are saved to 
> /var/eventing/jobs/cancelled/ with a property 
> "slingevent:finishedState=ERROR".
> It would be beneficial to add a method to the Job interface to set an error 
> String or List for multiple errors (to save stacktrace perhaps). That 
> way if a job fails we can debug the issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar updated SLING-7666:
--
Description: 
The sling sling-eventing-and-job-handling bundle documentation doesn't include 
information of  "JobExecutor" , it describes only "JobConsumer".

If consumer needs more features like providing progress information or adding 
more information of the processing, JobExecutor should be implemented. 

 

  was:
The sling 

Currently, when a JobConsumer fails, it's supposed to return a 
JobResult.CANCEL, but there is no way to set an error message.

Looking at the JCR, we see that such (failed/canceled) jobs are saved to 
/var/eventing/jobs/cancelled/ with a property "slingevent:finishedState=ERROR".

It would be beneficial to add a method to the Job interface to set an error 
String or List for multiple errors (to save stacktrace perhaps). That 
way if a job fails we can debug the issue.


> Update sling site documentation for bundle - sling-eventing-and-job-handling
> 
>
> Key: SLING-7666
> URL: https://issues.apache.org/jira/browse/SLING-7666
> Project: Sling
>  Issue Type: Improvement
>  Components: API
>Reporter: indra kumar gurjar
>Priority: Minor
>
> The sling sling-eventing-and-job-handling bundle documentation doesn't 
> include information of  "JobExecutor" , it describes only "JobConsumer".
> If consumer needs more features like providing progress information or adding 
> more information of the processing, JobExecutor should be implemented. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar updated SLING-7666:
--
Description: 
The sling 

Currently, when a JobConsumer fails, it's supposed to return a 
JobResult.CANCEL, but there is no way to set an error message.

Looking at the JCR, we see that such (failed/canceled) jobs are saved to 
/var/eventing/jobs/cancelled/ with a property "slingevent:finishedState=ERROR".

It would be beneficial to add a method to the Job interface to set an error 
String or List for multiple errors (to save stacktrace perhaps). That 
way if a job fails we can debug the issue.

  was:
The sling Jobs API provides a JobConsumer interface: 
org.apache.sling.event.jobs.consumer.JobConsumer" and Job interface: 
org.apache.sling.event.jobs.Job.

Currently, when a JobConsumer fails, it's supposed to return a 
JobResult.CANCEL, but there is no way to set an error message.

Looking at the JCR, we see that such (failed/canceled) jobs are saved to 
/var/eventing/jobs/cancelled/ with a property "slingevent:finishedState=ERROR".

It would be beneficial to add a method to the Job interface to set an error 
String or List for multiple errors (to save stacktrace perhaps). That 
way if a job fails we can debug the issue.


> Update sling site documentation for bundle - sling-eventing-and-job-handling
> 
>
> Key: SLING-7666
> URL: https://issues.apache.org/jira/browse/SLING-7666
> Project: Sling
>  Issue Type: Improvement
>  Components: API
>Reporter: indra kumar gurjar
>Priority: Minor
>
> The sling 
> Currently, when a JobConsumer fails, it's supposed to return a 
> JobResult.CANCEL, but there is no way to set an error message.
> Looking at the JCR, we see that such (failed/canceled) jobs are saved to 
> /var/eventing/jobs/cancelled/ with a property 
> "slingevent:finishedState=ERROR".
> It would be beneficial to add a method to the Job interface to set an error 
> String or List for multiple errors (to save stacktrace perhaps). That 
> way if a job fails we can debug the issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (SLING-7666) Update sling site documentation for bundle - sling-eventing-and-job-handling

2018-05-14 Thread indra kumar gurjar (JIRA)
indra kumar gurjar created SLING-7666:
-

 Summary: Update sling site documentation for bundle - 
sling-eventing-and-job-handling
 Key: SLING-7666
 URL: https://issues.apache.org/jira/browse/SLING-7666
 Project: Sling
  Issue Type: Improvement
  Components: API
Reporter: indra kumar gurjar


The sling Jobs API provides a JobConsumer interface: 
org.apache.sling.event.jobs.consumer.JobConsumer" and Job interface: 
org.apache.sling.event.jobs.Job.

Currently, when a JobConsumer fails, it's supposed to return a 
JobResult.CANCEL, but there is no way to set an error message.

Looking at the JCR, we see that such (failed/canceled) jobs are saved to 
/var/eventing/jobs/cancelled/ with a property "slingevent:finishedState=ERROR".

It would be beneficial to add a method to the Job interface to set an error 
String or List for multiple errors (to save stacktrace perhaps). That 
way if a job fails we can debug the issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SLING-7661) Provide mechanism to persist error message/s in Sling Jobs API

2018-05-14 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar commented on SLING-7661:
---

[~lnra54] JobExecutor.process method gives access to JobExecutionContext. We 
can set the error message by 
JobExecutionContext.result().message(errorMsg).failed() and return this result. 

The error message can be retrieved by Job.getResultMessage();

> Provide mechanism to persist error message/s in Sling Jobs API
> --
>
> Key: SLING-7661
> URL: https://issues.apache.org/jira/browse/SLING-7661
> Project: Sling
>  Issue Type: Improvement
>  Components: API
>Reporter: Leonardo Rodriguez
>Priority: Minor
>
> The sling Jobs API provides a JobConsumer interface: 
> org.apache.sling.event.jobs.consumer.JobConsumer" and Job interface: 
> org.apache.sling.event.jobs.Job.
> Currently, when a JobConsumer fails, it's supposed to return a 
> JobResult.CANCEL, but there is no way to set an error message.
> Looking at the JCR, we see that such (failed/canceled) jobs are saved to 
> /var/eventing/jobs/cancelled/ with a property 
> "slingevent:finishedState=ERROR".
> It would be beneficial to add a method to the Job interface to set an error 
> String or List for multiple errors (to save stacktrace perhaps). That 
> way if a job fails we can debug the issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (SLING-5985) deleting chunks of an asset deletes asset also

2016-08-22 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar edited comment on SLING-5985 at 8/22/16 8:36 AM:


Fix for Issue  https://issues.apache.org/jira/browse/SLING-5637 has broken the 
chunk deletion functionality.


was (Author: igurjar):
Fix for Issue  has broken the chunk deletion functionality.

> deleting chunks of an asset deletes asset also
> --
>
> Key: SLING-5985
> URL: https://issues.apache.org/jira/browse/SLING-5985
> Project: Sling
>  Issue Type: Bug
>  Components: Servlets
>Affects Versions: Servlets Post 2.3.10
>Reporter: indra kumar gurjar
>
> When user deletes chunks of an asset, asset itself is getting deleted.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-5985) deleting chunks of an asset deletes asset also

2016-08-22 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar commented on SLING-5985:
---

Fix for Issue  has broken the chunk deletion functionality.

> deleting chunks of an asset deletes asset also
> --
>
> Key: SLING-5985
> URL: https://issues.apache.org/jira/browse/SLING-5985
> Project: Sling
>  Issue Type: Bug
>  Components: Servlets
>Affects Versions: Servlets Post 2.3.10
>Reporter: indra kumar gurjar
>
> When user deletes chunks of an asset, asset itself is getting deleted.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (SLING-5985) deleting chunks of an asset deletes asset also

2016-08-22 Thread indra kumar gurjar (JIRA)
indra kumar gurjar created SLING-5985:
-

 Summary: deleting chunks of an asset deletes asset also
 Key: SLING-5985
 URL: https://issues.apache.org/jira/browse/SLING-5985
 Project: Sling
  Issue Type: Bug
  Components: Servlets
Affects Versions: Servlets Post 2.3.10
Reporter: indra kumar gurjar


When user deletes chunks of an asset, asset itself is getting deleted.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-5637) Resource.delete is not called if resource is adaptable to Node

2016-08-11 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar commented on SLING-5637:
---

The patch has broken chunk delete functionality.
when trying to delete chunks it deletes asset also.

> Resource.delete is not called if resource is adaptable to Node
> --
>
> Key: SLING-5637
> URL: https://issues.apache.org/jira/browse/SLING-5637
> Project: Sling
>  Issue Type: Bug
>  Components: Servlets
>Affects Versions: Servlets Post 2.3.8
>Reporter: Carsten Ziegeler
>Assignee: Carsten Ziegeler
> Fix For: Servlets Post 2.3.10
>
>
> If a resource is adaptable to Node, the node is directly removed.
> ResourceProvider.delete is never invoked.
> While this works with the JcrResourceProvider it does not work with any other 
> resource provider providing resources which adapt to a node
> Proposed solution:
> {code}
> ### Eclipse Workspace Patch 1.0
> #P org.apache.sling.servlets.post
> Index: 
> src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java
> ===
> --- 
> src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java
>  (Revision 1737673)
> +++ 
> src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java
>  (Arbeitskopie)
> @@ -58,15 +58,15 @@
>  // SLING-3203: selectors, extension and suffix make no sense here and
>  // might lead to deleting other resources than the one the user 
> means.
>  final RequestPathInfo rpi = request.getRequestPathInfo();
> -if( (rpi.getSelectors() != null && rpi.getSelectors().length > 0) 
> +if( (rpi.getSelectors() != null && rpi.getSelectors().length > 0)
>  || (rpi.getExtension() != null && 
> rpi.getExtension().length() > 0)
>  || (rpi.getSuffix() != null && rpi.getSuffix().length() > 
> 0)) {
>  response.setStatus(
> -HttpServletResponse.SC_FORBIDDEN, 
> +HttpServletResponse.SC_FORBIDDEN,
>  "DeleteOperation request cannot include any selectors, 
> extension or suffix");
>  return;
>  }
> -
> +
>  final VersioningConfiguration versioningConfiguration = 
> getVersioningConfiguration(request);
>  final boolean deleteChunks = isDeleteChunkRequest(request);
>  final Iterator res = getApplyToResources(request);
> @@ -100,19 +100,17 @@
>  } else {
>  checkoutIfNecessary(node.getParent(), changes,
>  versioningConfiguration);
> -node.remove();
>  }
> -
> -} else {
> -try {
> -resource.getResourceResolver().delete(resource);
> -} catch (final PersistenceException pe) {
> -if (pe.getCause() instanceof RepositoryException) {
> -throw (RepositoryException) pe.getCause();
> -}
> -throw new RepositoryException(pe);
> +}
> +try {
> +resource.getResourceResolver().delete(resource);
> +} catch (final PersistenceException pe) {
> +if (pe.getCause() instanceof RepositoryException) {
> +throw (RepositoryException) pe.getCause();
>  }
> +throw new RepositoryException(pe);
>  }
> +
>  changes.add(Modification.onDeleted(resource.getPath()));
>  }
>  {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Comment Edited] (SLING-5637) Resource.delete is not called if resource is adaptable to Node

2016-08-11 Thread indra kumar gurjar (JIRA)

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

indra kumar gurjar edited comment on SLING-5637 at 8/11/16 1:29 PM:


[~cziegeler] The patch has broken chunk delete functionality.
when trying to delete chunks it deletes asset also.


was (Author: igurjar):
The patch has broken chunk delete functionality.
when trying to delete chunks it deletes asset also.

> Resource.delete is not called if resource is adaptable to Node
> --
>
> Key: SLING-5637
> URL: https://issues.apache.org/jira/browse/SLING-5637
> Project: Sling
>  Issue Type: Bug
>  Components: Servlets
>Affects Versions: Servlets Post 2.3.8
>Reporter: Carsten Ziegeler
>Assignee: Carsten Ziegeler
> Fix For: Servlets Post 2.3.10
>
>
> If a resource is adaptable to Node, the node is directly removed.
> ResourceProvider.delete is never invoked.
> While this works with the JcrResourceProvider it does not work with any other 
> resource provider providing resources which adapt to a node
> Proposed solution:
> {code}
> ### Eclipse Workspace Patch 1.0
> #P org.apache.sling.servlets.post
> Index: 
> src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java
> ===
> --- 
> src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java
>  (Revision 1737673)
> +++ 
> src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java
>  (Arbeitskopie)
> @@ -58,15 +58,15 @@
>  // SLING-3203: selectors, extension and suffix make no sense here and
>  // might lead to deleting other resources than the one the user 
> means.
>  final RequestPathInfo rpi = request.getRequestPathInfo();
> -if( (rpi.getSelectors() != null && rpi.getSelectors().length > 0) 
> +if( (rpi.getSelectors() != null && rpi.getSelectors().length > 0)
>  || (rpi.getExtension() != null && 
> rpi.getExtension().length() > 0)
>  || (rpi.getSuffix() != null && rpi.getSuffix().length() > 
> 0)) {
>  response.setStatus(
> -HttpServletResponse.SC_FORBIDDEN, 
> +HttpServletResponse.SC_FORBIDDEN,
>  "DeleteOperation request cannot include any selectors, 
> extension or suffix");
>  return;
>  }
> -
> +
>  final VersioningConfiguration versioningConfiguration = 
> getVersioningConfiguration(request);
>  final boolean deleteChunks = isDeleteChunkRequest(request);
>  final Iterator res = getApplyToResources(request);
> @@ -100,19 +100,17 @@
>  } else {
>  checkoutIfNecessary(node.getParent(), changes,
>  versioningConfiguration);
> -node.remove();
>  }
> -
> -} else {
> -try {
> -resource.getResourceResolver().delete(resource);
> -} catch (final PersistenceException pe) {
> -if (pe.getCause() instanceof RepositoryException) {
> -throw (RepositoryException) pe.getCause();
> -}
> -throw new RepositoryException(pe);
> +}
> +try {
> +resource.getResourceResolver().delete(resource);
> +} catch (final PersistenceException pe) {
> +if (pe.getCause() instanceof RepositoryException) {
> +throw (RepositoryException) pe.getCause();
>  }
> +throw new RepositoryException(pe);
>  }
> +
>  changes.add(Modification.onDeleted(resource.getPath()));
>  }
>  {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)