Hi Matthias,
If you're interested in doing FS attachments, I absolutely recommend doing
it right at the beginning because then you can avoid the migration process
where your attachments are pulled up from the DB and placed into the FS.
You can catch errors in groovy as in java but I don't think that will help
you here. I would do this by posting the attachment up using curl or the like
because I'm not sure if doc.addAttachment() has been optimized for streaming.
My biggest recommendation, especially since you're using HSQLdb is to enable
FS attachments right away so you only have to migrate the attachments which
are part of XWiki and all of your attachments will go strait to the filesystem.
Thanks,
Caleb
On 11/10/2013 10:02 PM, Matthias Wegner wrote:
Hello,
I have an old self-made wiki with nearly thousand pages which i want to
import. At the moment i don't know which attachments makes the problem. On
Images and Content everything works fine for all pages. I want to import the
content to new xwiki-documents and upload into them my attachments and
images with
doc.addAttachment(attachmentName, new FileInputStream(data), xcontext)
in a groovy-script.
In some i get the following exception:
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at org.suigeneris.jrcs.util.ToString.arrayToString(ToString.java:110)
at org.suigeneris.jrcs.rcs.impl.Node.setText(Node.java:349)
at org.suigeneris.jrcs.rcs.Archive.<init>(Archive.java:243)
at org.suigeneris.jrcs.rcs.Archive.<init>(Archive.java:214)
at
com.xpn.xwiki.doc.XWikiAttachmentArchive.updateArchive(XWikiAttachmentArchive.java:186)
at
com.xpn.xwiki.doc.XWikiAttachment.updateContentArchive(XWikiAttachment.java:739)
at
com.xpn.xwiki.store.XWikiHibernateStore.saveAttachment(XWikiHibernateStore.java:1568)
at
com.xpn.xwiki.store.XWikiHibernateStore.saveAttachmentList(XWikiHibernateStore.java:1536)
at
com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:524)
at
com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:177)
at
com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:170)
at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1448)
at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1404)
at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1399)
at com.xpn.xwiki.XWiki$saveDocument.call(Unknown Source)
at Script2.upload(Script2.groovy:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at
groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:149)
at
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$2.invokeMethod(GroovyScriptEngineImpl.java:330)
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
I didn't get it to catch that exception in groovy. Is that possible? The
groovy-script is skipped by the exception, so nothing is done. I really like
to catch that, so all possible is done and i get an information what is not
working. I tried to surround the try-catch-block to thedocument-save method,
but it not helps.
Is that a problem of the size of the attachments? Some are bigger than
100MB. I didn't change the attachment storage to file-system yet. What is
your experience? Is that a problem of the attachment size or something else?
To test this i use the Portable XWiki 5.1 with the Hsqldb.
Regards,
Matthias
--
View this message in context:
http://xwiki.475771.n2.nabble.com/Upload-Attachments-tp7587887.html
Sent from the XWiki- Dev mailing list archive at
Nabble.com.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs