Re: [xwiki-devs] [xwiki-notifications] r29588 - platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web
On Jun 21, 2010, at 9:28 AM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2010-06-21 09:28:46 +0200 (Mon, 21 Jun 2010) New Revision: 29588
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java Log: [cleanup] Updated deprecated method call
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java =================================================================== --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 2010-06-21 07:28:40 UTC (rev 29587) +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 2010-06-21 07:28:46 UTC (rev 29588) @@ -65,8 +65,8 @@ Utils.class.getCanonicalName() + "_placeholders_enabled";
/** - * The component manager used by {@link #getComponent(Class)} and {@link #getComponent(Class, String)}. It is - * useful for any non component code that need to initialize/access components. + * The component manager used by {@link #getComponent(Class)} and {@link #getComponent(Class, String)}. It is useful + * for any non component code that need to initialize/access components. */ private static ComponentManager componentManager;
@@ -150,7 +150,7 @@ // the content is fully rendered. The rendering code can use Utils.createPlaceholder. // Initialize the placeholder map enablePlaceholders(context); - String content; + String content = ""; try { content = context.getWiki().evaluateTemplate(template + ".vm", context); // Replace all placeholders with the protected values @@ -163,8 +163,12 @@ }
// get Error template "This template does not exist - content = context.getWiki().parseTemplate("templatedoesnotexist.vm", context); - content = content.trim(); + try { + content = context.getWiki().evaluateTemplate("templatedoesnotexist.vm", context); + content = content.trim(); + } catch (IOException ex) { + // Cannot write output, can't do anything else
Shouldn't we log a warning/error? Thanks -Vincent
On 06/21/2010 09:46 AM, Vincent Massol wrote:
On Jun 21, 2010, at 9:28 AM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2010-06-21 09:28:46 +0200 (Mon, 21 Jun 2010) New Revision: 29588
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java Log: [cleanup] Updated deprecated method call
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java =================================================================== --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 2010-06-21 07:28:40 UTC (rev 29587) +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 2010-06-21 07:28:46 UTC (rev 29588) @@ -65,8 +65,8 @@ Utils.class.getCanonicalName() + "_placeholders_enabled";
/** - * The component manager used by {@link #getComponent(Class)} and {@link #getComponent(Class, String)}. It is - * useful for any non component code that need to initialize/access components. + * The component manager used by {@link #getComponent(Class)} and {@link #getComponent(Class, String)}. It is useful + * for any non component code that need to initialize/access components. */ private static ComponentManager componentManager;
@@ -150,7 +150,7 @@ // the content is fully rendered. The rendering code can use Utils.createPlaceholder. // Initialize the placeholder map enablePlaceholders(context); - String content; + String content = ""; try { content = context.getWiki().evaluateTemplate(template + ".vm", context); // Replace all placeholders with the protected values @@ -163,8 +163,12 @@ }
// get Error template "This template does not exist - content = context.getWiki().parseTemplate("templatedoesnotexist.vm", context); - content = content.trim(); + try { + content = context.getWiki().evaluateTemplate("templatedoesnotexist.vm", context); + content = content.trim(); + } catch (IOException ex) { + // Cannot write output, can't do anything else
Shouldn't we log a warning/error?
IOException means that the connection was closed. Is that important? It's just a client canceling the request. -- Sergiu Dumitriu http://purl.org/net/sergiu/
On Jun 21, 2010, at 10:57 AM, Sergiu Dumitriu wrote:
On 06/21/2010 09:46 AM, Vincent Massol wrote:
On Jun 21, 2010, at 9:28 AM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2010-06-21 09:28:46 +0200 (Mon, 21 Jun 2010) New Revision: 29588
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java Log: [cleanup] Updated deprecated method call
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java =================================================================== --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 2010-06-21 07:28:40 UTC (rev 29587) +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 2010-06-21 07:28:46 UTC (rev 29588) @@ -65,8 +65,8 @@ Utils.class.getCanonicalName() + "_placeholders_enabled";
/** - * The component manager used by {@link #getComponent(Class)} and {@link #getComponent(Class, String)}. It is - * useful for any non component code that need to initialize/access components. + * The component manager used by {@link #getComponent(Class)} and {@link #getComponent(Class, String)}. It is useful + * for any non component code that need to initialize/access components. */ private static ComponentManager componentManager;
@@ -150,7 +150,7 @@ // the content is fully rendered. The rendering code can use Utils.createPlaceholder. // Initialize the placeholder map enablePlaceholders(context); - String content; + String content = ""; try { content = context.getWiki().evaluateTemplate(template + ".vm", context); // Replace all placeholders with the protected values @@ -163,8 +163,12 @@ }
// get Error template "This template does not exist - content = context.getWiki().parseTemplate("templatedoesnotexist.vm", context); - content = content.trim(); + try { + content = context.getWiki().evaluateTemplate("templatedoesnotexist.vm", context); + content = content.trim(); + } catch (IOException ex) { + // Cannot write output, can't do anything else
Shouldn't we log a warning/error?
IOException means that the connection was closed. Is that important? It's just a client canceling the request.
Then maybe the doc should say so since it's not important if it's a user cancellation. Thanks -Vincent
participants (2)
-
Sergiu Dumitriu -
Vincent Massol