[xwiki-devs] [VOTE] Modify XWiki.search() returned result + other methods returning a collection
Hi, Since this is an API I'm sending a vote. I'd like to modify the following: public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return null; } To: public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return Collections.EMPTY_LIST; } Rationale: * A method that returns a List (or a Collection in general) should never return null but always an empty collection instead (or throw an exception). I also propose to modify the other methods to return empty collections instead of null. Those include: * public List getDeletedDocuments(String fullname, String lang) throws XWikiException * public List search(String wheresql, int nb, int start) throws XWikiException * public List searchDocuments(String wheresql, int nb, int start, String selectColumns) Here's my +1 Thanks -Vincent
+1 2007/9/21, Vincent Massol <[email protected]>:
Hi,
Since this is an API I'm sending a vote.
I'd like to modify the following:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return null; }
To:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return Collections.EMPTY_LIST; }
Rationale:
* A method that returns a List (or a Collection in general) should never return null but always an empty collection instead (or throw an exception).
I also propose to modify the other methods to return empty collections instead of null. Those include:
* public List getDeletedDocuments(String fullname, String lang) throws XWikiException * public List search(String wheresql, int nb, int start) throws XWikiException * public List searchDocuments(String wheresql, int nb, int start, String selectColumns)
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
+1 On 9/21/07, Vincent Massol <[email protected]> wrote:
Hi,
Since this is an API I'm sending a vote.
I'd like to modify the following:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return null; }
To:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return Collections.EMPTY_LIST; }
Rationale:
* A method that returns a List (or a Collection in general) should never return null but always an empty collection instead (or throw an exception).
I also propose to modify the other methods to return empty collections instead of null. Those include:
* public List getDeletedDocuments(String fullname, String lang) throws XWikiException * public List search(String wheresql, int nb, int start) throws XWikiException * public List searchDocuments(String wheresql, int nb, int start, String selectColumns)
Here's my +1
Thanks -Vincent
+1 On 9/21/07, Marta Girdea <[email protected]> wrote:
+1
On 9/21/07, Vincent Massol <[email protected]> wrote:
Hi,
Since this is an API I'm sending a vote.
I'd like to modify the following:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return null; }
To:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return Collections.EMPTY_LIST; }
Rationale:
* A method that returns a List (or a Collection in general) should never return null but always an empty collection instead (or throw an exception).
I also propose to modify the other methods to return empty collections instead of null. Those include:
* public List getDeletedDocuments(String fullname, String lang) throws XWikiException * public List search(String wheresql, int nb, int start) throws XWikiException * public List searchDocuments(String wheresql, int nb, int start, String selectColumns)
Here's my +1
Thanks -Vincent
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Summary: 4 +1, no 0, no -1. Done. Thanks -Vincent On Sep 21, 2007, at 11:43 AM, Vincent Massol wrote:
Hi,
Since this is an API I'm sending a vote.
I'd like to modify the following:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return null; }
To:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return Collections.EMPTY_LIST; }
Rationale:
* A method that returns a List (or a Collection in general) should never return null but always an empty collection instead (or throw an exception).
I also propose to modify the other methods to return empty collections instead of null. Those include:
* public List getDeletedDocuments(String fullname, String lang) throws XWikiException * public List search(String wheresql, int nb, int start) throws XWikiException * public List searchDocuments(String wheresql, int nb, int start, String selectColumns)
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
I am not able to download xwiki. Erro Message is"ObjectWeb Forge Could Not Connect to Database": On 9/22/07, Vincent Massol <[email protected]> wrote:
Summary: 4 +1, no 0, no -1.
Done.
Thanks -Vincent
On Sep 21, 2007, at 11:43 AM, Vincent Massol wrote:
Hi,
Since this is an API I'm sending a vote.
I'd like to modify the following:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return null; }
To:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return Collections.EMPTY_LIST; }
Rationale:
* A method that returns a List (or a Collection in general) should never return null but always an empty collection instead (or throw an exception).
I also propose to modify the other methods to return empty collections instead of null. Those include:
* public List getDeletedDocuments(String fullname, String lang) throws XWikiException * public List search(String wheresql, int nb, int start) throws XWikiException * public List searchDocuments(String wheresql, int nb, int start, String selectColumns)
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Sep 22, 2007, at 5:45 PM, bernaulli wrote:
I am not able to download xwiki. Erro Message is"ObjectWeb Forge Could Not Connect to Database":
This has nothing to do with this thread, pkease don't hijack thread (this is a bad practice). Regarding your issue I answered earlier this morning about it and provided a loophole. You can check the archives. Thanks -Vincent
On 9/22/07, Vincent Massol < [email protected]> wrote: Summary: 4 +1, no 0, no -1.
Done.
Thanks -Vincent
On Sep 21, 2007, at 11:43 AM, Vincent Massol wrote:
Hi,
Since this is an API I'm sending a vote.
I'd like to modify the following:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return null; }
To:
public List search(String wheresql) throws XWikiException { if (hasProgrammingRights()) return xwiki.search(wheresql, getXWikiContext()); return Collections.EMPTY_LIST; }
Rationale:
* A method that returns a List (or a Collection in general) should never return null but always an empty collection instead (or throw an exception).
I also propose to modify the other methods to return empty collections instead of null. Those include:
* public List getDeletedDocuments(String fullname, String lang) throws XWikiException * public List search(String wheresql, int nb, int start) throws XWikiException * public List searchDocuments(String wheresql, int nb, int start, String selectColumns)
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (5)
-
bernaulli -
Catalin Hritcu -
Marta Girdea -
Thomas Mortagne -
Vincent Massol