[xwiki-users] ERROR: could not insert: xpn.xwiki.objects.Large String Property !?
Sergiu Dumitriu
sergiu at xwiki.com
Fri Mar 7 05:41:31 CET 2008
Hi,
Can you give the full stacktrace of the error?
If you try to manually create an MyClass object and add a line from that
file in it, does it work?
Did you configure XWiki to work with UTF-8 as described on
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Encoding ?
Ngo Thi Hong Nga wrote:
> Hi, I have a class named MyClass with "content" property with type TextArea.
> I write some Groovy code to read a text file (*.txt) with encoding
> UTF-8, and print each line in the screen (code snippet 1) , no errors.
> but when I replace code snippet (1) with (2), the following error occurs:
> com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while
> saving document ..Wrapped Exception: could not insert:
> xpn.xwiki.objects.Large String Property?
> <http://localhost:8080/xwiki/bin/edit/com.xpn.xwiki.objects/LargeStringProperty?parent=Nga.ImportCorpus&editor=wysiwyg>
>
> I try text files with encoding Unicode, replace UTF-8 with UNICODE,
> execute code snippet (1) and (2), both are ok.
> Anyone can explain me why I'm getting error with UTF-8 and how to solve
> this problem ?
> My code here:
>
> /byte[] bytes=...
> String[] lines=new String(bytes,"UTF-8").split("\n");
>
> list=mydoc.getObjects("XWiki.MyClass");
>
> for (i in 0..<lines.length)
> {
> (1)
> println lines[i];
>
> (2)
> newobj=mydoc.newObject("XWiki.MyClass");
> newobj.set("content", lines[i]);
> list.add(newobj);
> }
> mydoc.save();/
>
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
More information about the users
mailing list