Author: sdumitriu
Date: 2008-02-08 17:32:31 +0100 (Fri, 08 Feb 2008)
New Revision: 7402
Modified:
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/api/User.java
xwiki-platform/core/branches/xwiki-core-1.2/xwiki-core/src/main/java/com/xpn/xwiki/api/User.java
Log:
XWIKI-2088: Add a method to retrieve the e-mail address of a user
Documentation improvements
Modified:
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/api/User.java
===================================================================
---
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/api/User.java
2008-02-08 16:20:25 UTC (rev 7401)
+++
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/api/User.java
2008-02-08 16:32:31 UTC (rev 7402)
@@ -59,7 +59,11 @@
* profile. If the user hasn't changed his profile, then this is the
e-mail address he filled in
* the registration form.
*
- * @return The e-mail address from the user profile
+ * @return The e-mail address from the user profile, or <tt>null</tt> if
there is an error
+ * retrieving the email.
+ * @since 1.1.3
+ * @since 1.2.2
+ * @since 1.3M2
*/
public String getEmail()
{
@@ -69,6 +73,9 @@
BaseObject obj = userDoc.getObject("XWiki.XWikiUsers");
return obj.getStringValue("email");
} catch (Exception e) {
+ // APIs should never throw errors, as velocity cannot catch them,
and scripts should be
+ // as robust as possible. Instead, the code using this should know
that null means there
+ // was an error, if it really needs to report these exceptions.
return null;
}
}
Modified:
xwiki-platform/core/branches/xwiki-core-1.2/xwiki-core/src/main/java/com/xpn/xwiki/api/User.java
===================================================================
---
xwiki-platform/core/branches/xwiki-core-1.2/xwiki-core/src/main/java/com/xpn/xwiki/api/User.java
2008-02-08 16:20:25 UTC (rev 7401)
+++
xwiki-platform/core/branches/xwiki-core-1.2/xwiki-core/src/main/java/com/xpn/xwiki/api/User.java
2008-02-08 16:32:31 UTC (rev 7402)
@@ -61,6 +61,9 @@
*
* @return The e-mail address from the user profile, or <tt>null</tt> if
there is an error
* retrieving the email.
+ * @since 1.1.3
+ * @since 1.2.2
+ * @since 1.3M2
*/
public String getEmail()
{
@@ -70,6 +73,9 @@
BaseObject obj = userDoc.getObject("XWiki.XWikiUsers");
return obj.getStringValue("email");
} catch (Exception e) {
+ // APIs should never throw errors, as velocity cannot catch them,
and scripts should be
+ // as robust as possible. Instead, the code using this should know
that null means there
+ // was an error, if it really needs to report these exceptions.
return null;
}
}
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications