Hello devs,
I have a proposal to make about the IRCbot Application. As you know, the
bot logs the channel and saves
the content in order to make it viewable from the xwiki designated page.
I would like to propose two things :
Proposal 1
In order to make archive logs more easily readable and more easy to
follow, I would like to change the
way the logs are saved.
I would like to use a standard format (also used my all major IRC
clients like Pidgin, IRC, XChat, irssi, etc).
Because date/time will have always the same length, aligning it and
putting it at the begginning of the line, makes the text more easy to
follow.
So, the proposals are :
Version 1 (the one we have now)
user1 - (20:07): You can comment if you have edit right
JohnDoe - (20:07): ok, thx for the answer
IreallyLoveXWiki - (20:07): I’m off for today, bye
XWikiNormalUser left at 20:07 (Quit: Leaving.
EnterpriseUser joined #xwiki at 20:38
EnterpriseUser left at 20:38 (Client Quit
sburjan is now known as sburjan1 (~sburjan(a)this.is.areally.long.address.ro
Note that the ")" doesn't appear on logs, so this should be fixed any way.
Version 2
[11:05] XWikiNormalUser : How can I edit a page?
[11:05] IreallyLoveXWiki : You have to be logged in order to do that
[11:05] JohnDoe : I love Open Source !
[22:55] EnterpriseUser : joined #xwiki at 20:38
[22:56] EnterpriseUser : left at 20:38 (Client Quit
[14:22] sburjan is now known as sburjan1
(~sburjan(a)this.is.areally.long.address.ro)
Version 3
[11:05] <XWikiNormalUser> How can I edit a page?
[11:05] <IreallyLoveXWiki> You have to be logged in order to do that
[11:05] <JohnDoe> I love Open Source !
[22:55] <EnterpriseUser> joined #xwiki at 20:38
[22:56] <EnterpriseUser> left at 20:38 (Client Quit)
Version 1 : keep these addresses in log (like we have now)
sburjan is now known as sburjan1 (~sburjan(a)this.is.areally.long.address.ro
Version 2 : remove then from logging
sburjan is now known as sburjan1
I am +1 for 1.3 and +1 for 2.1
Please send your feedback and even your proposals if you have one.
WDYT ?
Regards,
Sorin B. [14:22] sburjan is now known as sburjan1
(~sburjan(a)this.is.areally.long.address.ro)
Proposal 2
We also log the user ip/host addresses when user joins. This also makes
the line much longer with information that it's not needed IMO.
This could be also a privacy concert, because your ip/host address is
exposed to anyone who uses xwiki.org .
Version 1 : keep these addresses in log (like we have now)
sburjan is now known as sburjan1 (~sburjan(a)this.is.areally.long.address.ro
Version 2 : remove then from logging
sburjan is now known as sburjan1
I am +1 for 1.3 and +1 for 2.1
Please send your feedback and even your proposals if you have one.
WDYT ?
Regards,
Sorin B.
According to this page http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial I should have an XWiki space on the default home page. It says I should be able to search for 'XWikiClasses' and find it in the XWiki space. I see neither the XWiki space under the "Spaces" heading nor do I get anything from the search result. Not sure if that tutorial is referencing some older version of the software or what.
I am unable to complete the installation using either the Windows .exe or the jar file. I get to the unpacking step and the 'next arrow' doesn't do anything. I am running Windows 7 64-bit. I am running as administrator. In the command window I get:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
could not create shortcut instance
java.lang.Exception: error loading library
java.lang.Exception: can't locate library
at com.izforge.izpack.util.Librarian.loadArchSpecificLibrary(Unknown Sou
rce)
at com.izforge.izpack.util.Librarian.loadLibrary(Unknown Source)
at com.izforge.izpack.util.os.ShellLink.initialize(Unknown Source)
at com.izforge.izpack.util.os.ShellLink.<init>(Unknown Source)
at com.izforge.izpack.util.os.Win_Shortcut.initialize(Unknown Source)
at com.izforge.izpack.panels.ShortcutPanel.panelActivate(Unknown Source)
at com.izforge.izpack.installer.InstallerFrame.switchPanel(Unknown Sourc
e)
at com.izforge.izpack.installer.InstallerFrame.navigateNext(Unknown Sour
ce)
at com.izforge.izpack.installer.InstallerFrame.navigateNext(Unknown Sour
ce)
at com.izforge.izpack.installer.InstallerFrame$NavigationHandler.actionP
erformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NullPointerException
at com.izforge.izpack.util.os.Win_Shortcut.getProgramsFolder(Unknown Sou
rce)
at com.izforge.izpack.panels.ShortcutPanel.getProgramsFolder(Unknown Sou
rce)
at com.izforge.izpack.panels.ShortcutPanel.panelActivate(Unknown Source)
at com.izforge.izpack.installer.InstallerFrame.switchPanel(Unknown Sourc
e)
at com.izforge.izpack.installer.InstallerFrame.navigateNext(Unknown Sour
ce)
at com.izforge.izpack.installer.InstallerFrame.navigateNext(Unknown Sour
ce)
at com.izforge.izpack.installer.InstallerFrame$NavigationHandler.actionP
erformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Hello devs,
I'm encountering some problems on the http://imigrant.myxwiki.org
1) Email confirmation upon user registration:
Although I've correctly configured the SMTP server (using my gmail account)
and tested it with the "Send page" feature, new users don't receive any
confirmation messages upon their registration.
2) Wrong main menu (upper left horizontal area) labels
These are displayed as: Space__SEPARATOR__XWiki,
Page__SEPARATOR__XWikiPreferences aso.
I strongly believe this being an issue related to the update of the "latest
XAR" provided by default.
While it is recommendable to always update to latest XAR, I find it also
awkward as the site would be of no interest till the admin makes the
upgrade.
Perhaps I have skipped some configuration steps and thus any advice/hint is
welcomed!
Best regards,
--
ing. Flueras Bogdan
Hi devs,
When importing an office document using the "Add > Page from Office"
menu the page title is given by
org.xwiki.officeimporter.document.XDOMOfficeDocument#getTitle() which
looks for the first heading (org.xwiki.rendering.block.HeaderBlock) in
the document content.
This is fine most of the time, but if the title of the office document
is not set using heading style (e.g. a custom defined style is used
instead) then:
(1) The page title is wrong.
(2) The first heading is hidden because it equals the page title. This
is very bad when there is text before the first heading.
WDYT about modifying XDOMOfficeDocument#getTitle() to take into account
the first paragraph also when looking for the page title?
Note that I have many Word documents with this problem so fixing them to
use heading style for their titles is not a good option for me.
Thanks,
Marius
Hi Sergiu,
I don't like several of the changes here since I believe they're increasing our technical debt so I'd like we find a better way. Here's some feedback/ideas:
1) com.xpn.util.Util and com.xpn.xwiki.web.Utils are deprecated and shouldn't be used. On the contrary we should work towards removing stuff from them, not adding to them :) I see you've added a new method which isn't too good IMO.
2) The EscapeTool you've added to the velocity module doesn't belong there IMO since I don't see why it would be restricted to Velocity. It's not about a language limitation that would be only needed for Velocity. I believe other scripts and even other java part of XWiki might need to escape XML. In addition you haven't commented why there's a need to write a new class when an escape tool already exists and is provided by the Velocity Tools project (in a few days/months we'll wonder why).
For 2) what I think is best is to add the escape code to the xwiki-xml module and have a ScriptService to make it available to all scripts. BTW there's already a XMLUtils in there and which already does xml escaping (and which I don't like and it could a good time to extract part of its stuff into an Escaper/Encoder component).
So XML and HTML escaping should go in xwiki-xml IMO and URL escaping should go in the xwiki-URL module (should we need them).
WDYT?
Thanks
-Vincent
On Dec 8, 2010, at 4:47 AM, sdumitriu (SVN) wrote:
> Author: sdumitriu
> Date: 2010-12-08 04:47:08 +0100 (Wed, 08 Dec 2010)
> New Revision: 33301
>
> Added:
> platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/tools/EscapeTool.java
> platform/core/trunk/xwiki-velocity/src/test/java/org/xwiki/velocity/tools/EscapeToolTest.java
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/util/Util.java
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java
> platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/printer/XHTMLWriter.java
> platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityConfiguration.java
> Log:
> XWIKI-5514: "apostrophe" character badly displayed in Internet Explorer
> XWIKI-5763: Remove entity encoding from UTF-8 text in XHTML
> Fixed.
>
> Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
> ===================================================================
> --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java 2010-12-07 16:01:32 UTC (rev 33300)
> +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java 2010-12-08 03:47:08 UTC (rev 33301)
> @@ -5806,12 +5806,12 @@
> try {
> userdoc = getDocument(user, context);
> if (userdoc == null) {
> - return StringEscapeUtils.escapeXml(user);
> + return Utils.escapeXml(user);
> }
>
> BaseObject userobj = userdoc.getObject("XWiki.XWikiUsers");
> if (userobj == null) {
> - return StringEscapeUtils.escapeXml(userdoc.getName());
> + return Utils.escapeXml(userdoc.getName());
> }
>
> Set<String> proplist = userobj.getPropertyList();
> @@ -5832,7 +5832,7 @@
> + context.getDoc().getPrefixedFullName() + ">", vcontext, context);
> }
>
> - text = StringEscapeUtils.escapeXml(text.trim());
> + text = Utils.escapeXml(text.trim());
>
> if (link) {
> text =
>
> Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/util/Util.java
> ===================================================================
> --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/util/Util.java 2010-12-07 16:01:32 UTC (rev 33300)
> +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/util/Util.java 2010-12-08 03:47:08 UTC (rev 33301)
> @@ -51,7 +51,6 @@
> import org.apache.commons.io.FileUtils;
> import org.apache.commons.io.IOUtils;
> import org.apache.commons.lang.ArrayUtils;
> -import org.apache.commons.lang.StringEscapeUtils;
> import org.apache.commons.lang.StringUtils;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> @@ -623,8 +622,8 @@
>
> public static String getHTMLExceptionMessage(XWikiException xe, XWikiContext context)
> {
> - String title = StringEscapeUtils.escapeXml(xe.getMessage());
> - String text = StringEscapeUtils.escapeXml(xe.getFullMessage());
> + String title = Utils.escapeXml(xe.getMessage());
> + String text = Utils.escapeXml(xe.getFullMessage());
> String id = (String) context.get("xwikierrorid");
> if (id == null) {
> id = "1";
>
> 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-12-07 16:01:32 UTC (rev 33300)
> +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/web/Utils.java 2010-12-08 03:47:08 UTC (rev 33301)
> @@ -40,8 +40,6 @@
> import org.apache.commons.lang.StringUtils;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> -import org.apache.ecs.Filter;
> -import org.apache.ecs.filter.CharacterFilter;
> import org.apache.log4j.MDC;
> import org.apache.struts.upload.MultipartRequestWrapper;
> import org.xwiki.component.manager.ComponentLookupException;
> @@ -512,14 +510,58 @@
> map.put(name, newValues);
> }
>
> + /**
> + * Escapes the XML special characters in a <code>String</code> using numerical XML entities.
> + *
> + * @param value the text to escape, may be null
> + * @return a new escaped <code>String</code>, <code>null</code> if null input
> + * @deprecated starting with 2.7 use {@link #escapeXml(String)}
> + */
> + @Deprecated
> public static String formEncode(String value)
> {
> - Filter filter = new CharacterFilter();
> - filter.removeAttribute("'");
> - String svalue = filter.process(value);
> - return svalue;
> + return escapeXml(value);
> }
>
> + /**
> + * Escapes the XML special characters in a <code>String</code> using numerical XML entities.
> + *
> + * @param value the text to escape, may be {@code null}
> + * @return a new escaped {@code String}, {@code null} if {@code null} input
> + */
> + public static String escapeXml(String value)
> + {
> + if (value == null) {
> + return null;
> + }
> + StringBuilder result = new StringBuilder((int) (value.length() * 1.1));
> + int length = value.length();
> + char c;
> + for (int i = 0; i < length; ++i) {
> + c = value.charAt(i);
> + switch (c) {
> + case '&':
> + result.append("&");
> + break;
> + case '<':
> + result.append("<");
> + break;
> + case '>':
> + result.append(">");
> + break;
> + case '"':
> + result.append(""");
> + break;
> + case '\'':
> + result.append("'");
> + break;
> + default:
> + result.append(c);
> + }
> + }
> + return result.toString();
> + }
> +
> public static String SQLFilter(String text)
> {
> try {
>
> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/printer/XHTMLWriter.java
> ===================================================================
> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/printer/XHTMLWriter.java 2010-12-07 16:01:32 UTC (rev 33300)
> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/printer/XHTMLWriter.java 2010-12-08 03:47:08 UTC (rev 33301)
> @@ -44,6 +44,19 @@
> super(writer, DEFAULT_XHTML_FORMAT);
>
> // escape all non US-ASCII to have as less encoding problems as possible
> - setMaximumAllowedCharacter(127);
> + setMaximumAllowedCharacter(-1);
> }
> +
> + /**
> + * Escapes a string to be used as an attribute value. Unlike the original method in {@link XMLWriter}, apostrophes
> + * are replaced by a numerical entity &#38;, since &apos; is not valid in HTML documents.
> + *
> + * @param text the attribute value to escape
> + * @return the text with all occurrences of special XML characters replaced by entity references.
> + */
> + @Override
> + protected String escapeAttributeEntities(String text)
> + {
> + return super.escapeAttributeEntities(text).replace("'", "&");
> + }
> }
>
> Modified: platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityConfiguration.java
> ===================================================================
> --- platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityConfiguration.java 2010-12-07 16:01:32 UTC (rev 33300)
> +++ platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityConfiguration.java 2010-12-08 03:47:08 UTC (rev 33301)
> @@ -22,7 +22,6 @@
> import java.util.Properties;
>
> import org.apache.velocity.tools.generic.ComparisonDateTool;
> -import org.apache.velocity.tools.generic.EscapeTool;
> import org.apache.velocity.tools.generic.ListTool;
> import org.apache.velocity.tools.generic.MathTool;
> import org.apache.velocity.tools.generic.NumberTool;
> @@ -37,6 +36,7 @@
> import org.xwiki.velocity.VelocityConfiguration;
> import org.xwiki.velocity.introspection.ChainingUberspector;
> import org.xwiki.velocity.introspection.DeprecatedCheckUberspector;
> +import org.xwiki.velocity.tools.EscapeTool;
> import org.xwiki.velocity.tools.RegexTool;
>
> /**
>
> Added: platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/tools/EscapeTool.java
> ===================================================================
> --- platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/tools/EscapeTool.java (rev 0)
> +++ platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/tools/EscapeTool.java 2010-12-08 03:47:08 UTC (rev 33301)
> @@ -0,0 +1,72 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +
> +package org.xwiki.velocity.tools;
> +
> +/**
> + * Tool for working with escaping in Velocity templates. It provides methods to escape outputs for Velocity, Java,
> + * JavaScript, HTML, XML and SQL.
> + *
> + * @version $Id$
> + * @since 2.7RC1
> + */
> +public class EscapeTool extends org.apache.velocity.tools.generic.EscapeTool
> +{
> + /**
> + * Escapes the XML special characters in a <code>String</code> using numerical XML entities.
> + *
> + * @param value the text to escape, may be {@code null}
> + * @return a new escaped {@code String}, {@code null} if {@code null} input
> + */
> + @Override
> + public String xml(Object source)
> + {
> + if (source == null) {
> + return null;
> + }
> + String str = String.valueOf(source);
> + StringBuilder result = new StringBuilder((int) (str.length() * 1.1));
> + int length = str.length();
> + char c;
> + for (int i = 0; i < length; ++i) {
> + c = str.charAt(i);
> + switch (c) {
> + case '&':
> + result.append("&");
> + break;
> + case '<':
> + result.append("<");
> + break;
> + case '>':
> + result.append(">");
> + break;
> + case '"':
> + result.append(""");
> + break;
> + case '\'':
> + result.append("'");
> + break;
> + default:
> + result.append(c);
> + }
> + }
> + return result.toString();
> + }
> +}
>
>
> Property changes on: platform/core/trunk/xwiki-velocity/src/main/java/org/xwiki/velocity/tools/EscapeTool.java
> ___________________________________________________________________
> Added: svn:keywords
> + Author Id Revision HeadURL
> Added: svn:eol-style
> + native
>
> Added: platform/core/trunk/xwiki-velocity/src/test/java/org/xwiki/velocity/tools/EscapeToolTest.java
> ===================================================================
> --- platform/core/trunk/xwiki-velocity/src/test/java/org/xwiki/velocity/tools/EscapeToolTest.java (rev 0)
> +++ platform/core/trunk/xwiki-velocity/src/test/java/org/xwiki/velocity/tools/EscapeToolTest.java 2010-12-08 03:47:08 UTC (rev 33301)
> @@ -0,0 +1,70 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +
> +package org.xwiki.velocity.tools;
> +
> +import org.junit.Assert;
> +import org.junit.Test;
> +
> +/**
> + * Unit tests for {@link EscapeTool}.
> + *
> + * @version $Id$
> + * @since 2.7RC1
> + */
> +public class EscapeToolTest
> +{
> + @Test
> + public void testEscapeSimpleXML()
> + {
> + EscapeTool tool = new EscapeTool();
> + String escapedText = tool.xml("a < a' && a' < a\" => a < a\"");
> +
> + Assert.assertFalse("Failed to escape <", escapedText.contains("<"));
> + Assert.assertFalse("Failed to escape >", escapedText.contains(">"));
> + Assert.assertFalse("Failed to escape '", escapedText.contains("'"));
> + Assert.assertFalse("Failed to escape \"", escapedText.contains("\""));
> + Assert.assertFalse("Failed to escape &", escapedText.contains("&&"));
> + }
> +
> + @Test
> + public void testEscapeXMLApos()
> + {
> + EscapeTool tool = new EscapeTool();
> +
> + Assert.assertFalse("' wrongly escaped to non-HTML '", tool.xml("'").equals("'"));
> + }
> +
> + @Test
> + public void testEscapeXMLWithNull()
> + {
> + EscapeTool tool = new EscapeTool();
> +
> + Assert.assertNull("null should be null", tool.xml(null));
> + }
> +
> + @Test
> + public void testEscapeXMLNonAscii()
> + {
> + EscapeTool tool = new EscapeTool();
> +
> + Assert.assertTrue("Non-ASCII characters shouldn't be escaped", tool.xml("\u0123").equals("\u0123"));
> + }
> +}
>
>
> Property changes on: platform/core/trunk/xwiki-velocity/src/test/java/org/xwiki/velocity/tools/EscapeToolTest.java
> ___________________________________________________________________
> Added: svn:keywords
> + Author Id Revision HeadURL
> Added: svn:eol-style
> + native
Hi devs,
I have a serious problem. I'm using a fresh XE 2.6 with MySql (fresh db
+ XE 2.6 XAR import) and I'm doing this:
1. Create a class Main.TestClass with only one property (say "city") of
type "String".
2. Add an object of type Main.TestClass to Main.TestClass page and set
the value of "city" to a large string (say 270 characters).
3. Save.
I get:
----------8<----------
org.hibernate.exception.DataException: could not insert:
[com.xpn.xwiki.objects.StringProperty]
...
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too
long for column 'XWS_VALUE' at row 1
---------->8----------
IMO "Data too long" should be only a warning. Why isn't the string
simply truncated if it's too long?
If I go back to the object editor the value of the "city" property is
empty. If I try to set the value to a short string, say "Paris" and then
save, I get:
----------8<----------
Failed to commit or rollback transaction. Root cause []
...
Wrapped Exception:
org.hibernate.StaleObjectStateException: Row was updated or deleted by
another transaction (or unsaved-value mapping was incorrect):
[com.xpn.xwiki.objects.StringProperty#<?xml version="1.0" encoding="UTF-8"?>
<city>Paris</city>
]
---------->8----------
So how can I fix this? If I delete the object and then create a new one,
setting the value of "city" to "Rome" I get the same exception as
before, but with:
<city>Rome</city>
Is this related to my configuration?
Thanks,
Marius
On Dec 7, 2010, at 2:30 AM, sdumitriu (SVN) wrote:
> Author: sdumitriu
> Date: 2010-12-07 02:30:38 +0100 (Tue, 07 Dec 2010)
> New Revision: 33282
>
> Modified:
> platform/xwiki-plugins/trunk/activitystream/src/main/java/com/xpn/xwiki/plugin/activitystream/api/ActivityStream.java
> platform/xwiki-plugins/trunk/activitystream/src/main/java/com/xpn/xwiki/plugin/activitystream/impl/ActivityStreamImpl.java
> platform/xwiki-plugins/trunk/activitystream/src/main/java/com/xpn/xwiki/plugin/activitystream/plugin/ActivityStreamPluginApi.java
> Log:
> XPLUCENE-74: Add a method to return the list of pages with events grouped by days and sorted by the event date
Error in JIRA issue?
Thanks
-Vincent
Hi devs,
This is a buy one, get two proposal.
I propose that first we rename DocumentUpdateEvent and
DocumentSaveEvent to respectively DocumentUpdatedEvent and
DocumentCreatedEvent. Which would be both more clear and would comply
to the naming rules we've agreed on (see
http://xwiki.markmail.org/thread/frzfzookl2lstsfj ). By rename I don't
mean real rename, but deprecation of the old events and creation of
two new ones.
Then I propose we introduce two new events : DocumentCreatingEvent and
DocumentUpdatingEvent, that would be fired before the actual save.
This is a pretty common use case for code that needs to hook on save
to perform any kind of verification/pre-computation/etc. This is the
same idea as the "preverify" method of the legacy notification
mechanism. The events would actually be fired from the same place as
the preverify method in old XWiki.java.
WDYT ?
I'm +1 and if we agree I volunteer to make those changes on 3.0 branch
- and maybe the 2.7 too if we agree we want that too (I do).