[xwiki-devs] [VOTE] ScriptServiceManager#get should never throw exception
Hi devs, Right now it's pretty dangerous to manipulate script services from Velocity. If even you try to get a service that does not exist that will produce an exception which will kill your script for good. It's a pain to have use case like using a service only if it's here and fallback on something else otherwise. For example even if you disabled CSRF XWiki will fill in many places if you even think or removing the csrf jar. That seems pretty bad to me. The exception does not bring much value to scripts here (even for scripts supporting it) so I proposed to return null instead of throwing an exception. WDYT ? Here is my +1. -- Thomas Mortagne
+1 On Fri, Sep 16, 2011 at 5:47 PM, Thomas Mortagne <thomas.mortagne@xwiki.com>wrote:
Hi devs,
Right now it's pretty dangerous to manipulate script services from Velocity.
If even you try to get a service that does not exist that will produce an exception which will kill your script for good. It's a pain to have use case like using a service only if it's here and fallback on something else otherwise.
For example even if you disabled CSRF XWiki will fill in many places if you even think or removing the csrf jar. That seems pretty bad to me.
The exception does not bring much value to scripts here (even for scripts supporting it) so I proposed to return null instead of throwing an exception.
WDYT ?
Here is my +1.
-- Thomas Mortagne _______________________________________________ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
-- Jérôme Velociter Winesquare http://www.winesquare.net/
On 09/16/2011 11:47 AM, Thomas Mortagne wrote:
Hi devs,
Right now it's pretty dangerous to manipulate script services from Velocity.
If even you try to get a service that does not exist that will produce an exception which will kill your script for good. It's a pain to have use case like using a service only if it's here and fallback on something else otherwise.
For example even if you disabled CSRF XWiki will fill in many places if you even think or removing the csrf jar. That seems pretty bad to me.
The exception does not bring much value to scripts here (even for scripts supporting it) so I proposed to return null instead of throwing an exception.
WDYT ?
Here is my +1.
+1 as well. Should there be a WARN log entry as well? I'd say no, since it will fill the logs needlessly. -- Sergiu Dumitriu http://purl.org/net/sergiu/
On Sep 16, 2011, at 5:59 PM, Sergiu Dumitriu wrote:
On 09/16/2011 11:47 AM, Thomas Mortagne wrote:
Hi devs,
Right now it's pretty dangerous to manipulate script services from Velocity.
If even you try to get a service that does not exist that will produce an exception which will kill your script for good. It's a pain to have use case like using a service only if it's here and fallback on something else otherwise.
For example even if you disabled CSRF XWiki will fill in many places if you even think or removing the csrf jar. That seems pretty bad to me.
The exception does not bring much value to scripts here (even for scripts supporting it) so I proposed to return null instead of throwing an exception.
WDYT ?
Here is my +1.
+1 as well.
Should there be a WARN log entry as well? I'd say no, since it will fill the logs needlessly.
I'd say no too since the method returns null so we already indicate that the service doesn't exist. Thanks -Vincent
On Fri, Sep 16, 2011 at 5:59 PM, Sergiu Dumitriu <sergiu@xwiki.com> wrote:
On 09/16/2011 11:47 AM, Thomas Mortagne wrote:
Hi devs,
Right now it's pretty dangerous to manipulate script services from Velocity.
If even you try to get a service that does not exist that will produce an exception which will kill your script for good. It's a pain to have use case like using a service only if it's here and fallback on something else otherwise.
For example even if you disabled CSRF XWiki will fill in many places if you even think or removing the csrf jar. That seems pretty bad to me.
The exception does not bring much value to scripts here (even for scripts supporting it) so I proposed to return null instead of throwing an exception.
WDYT ?
Here is my +1.
+1 as well.
Should there be a WARN log entry as well? I'd say no, since it will fill the logs needlessly.
No since it's not an error, sometimes it's more or less expected that the service is not here and that in that case you do something else in your script.
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
On Sep 16, 2011, at 5:47 PM, Thomas Mortagne wrote:
Hi devs,
Right now it's pretty dangerous to manipulate script services from Velocity.
If even you try to get a service that does not exist that will produce an exception which will kill your script for good. It's a pain to have use case like using a service only if it's here and fallback on something else otherwise.
For example even if you disabled CSRF XWiki will fill in many places if you even think or removing the csrf jar. That seems pretty bad to me.
The exception does not bring much value to scripts here (even for scripts supporting it) so I proposed to return null instead of throwing an exception.
WDYT ?
Here is my +1.
+1 Thanks -Vincent
+1 Thanks, Marius On Fri, Sep 16, 2011 at 6:47 PM, Thomas Mortagne <thomas.mortagne@xwiki.com> wrote:
Hi devs,
Right now it's pretty dangerous to manipulate script services from Velocity.
If even you try to get a service that does not exist that will produce an exception which will kill your script for good. It's a pain to have use case like using a service only if it's here and fallback on something else otherwise.
For example even if you disabled CSRF XWiki will fill in many places if you even think or removing the csrf jar. That seems pretty bad to me.
The exception does not bring much value to scripts here (even for scripts supporting it) so I proposed to return null instead of throwing an exception.
WDYT ?
Here is my +1.
-- Thomas Mortagne _______________________________________________ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
participants (5)
-
Jerome Velociter -
Marius Dumitru Florea -
Sergiu Dumitriu -
Thomas Mortagne -
Vincent Massol