[xwiki-users] issue with getAttachment from different document in Groovy
Hello I put a file Text.txt as attachment in a page: Sandbox.Page1 I in an other page Sandbox.Page2, I write the following script: {{groovy}} def mydoc=xwiki.getDocument('Sandbox.Page1') def myfile=mydoc.getAttachment('Text.txt') println "|"+mydoc+"|"+myfile {{/goovy}} The result is |Sandbox.Page1|null If I put the same script in Sandbox.Page2, the result become: |Sandbox.Page1|com.xpn.xwiki.api.Attachment@331be8 Why cannot get attachments from other document? I run XWiki 2.5 with Tomcat 6.0.28, Mysql 5.1.49, Ubuntu 10.10 Arnaud.
Hi! Arnaud bourree wrote:
Hello
I put a file Text.txt as attachment in a page: Sandbox.Page1 I in an other page Sandbox.Page2, I write the following script: {{groovy}} def mydoc=xwiki.getDocument('Sandbox.Page1') def myfile=mydoc.getAttachment('Text.txt') println "|"+mydoc+"|"+myfile {{/goovy}} The result is |Sandbox.Page1|null
If I put the same script in Sandbox.Page2, the result become: |Sandbox.Page1|com.xpn.xwiki.api.Attachment@331be8
I don't understand the situation: do you have two documents? One having an attachment, and another one without it? In any case, myfile gets an array: classname (com.xpn.xwiki.api.Attachment) and an object ID. I can't explain why it varies though.
Why cannot get attachments from other document?
Check this... http://ebiotic.net/bin/ICT/HasAttachment#Attachments http://ebiotic.net/bin/ICT/GetAttachment#Attachments This should help: http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/com... Please, take into account that I'm not a maven! I've just picked up some ideas here and there. Please, consider critically this message! Thanks.
I run XWiki 2.5 with Tomcat 6.0.28, Mysql 5.1.49, Ubuntu 10.10
Arnaud. _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
-- Ricardo RodrÃguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems
Hi Arnaud, I have indeed repeated this problem. It appears that I have introduced a bug when I fixed http://jira.xwiki.org/jira/browse/XWIKI-5405. This bug nolonger exists on the 2.6 trunk due to additional refactoring and I will work on a targeted patch for v2.5.1 Terribly sorry for the inconvenience and thank you for the report! Caleb On 10/28/2010 06:25 PM, [Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Arnaud bourree wrote:
Hello
I put a file Text.txt as attachment in a page: Sandbox.Page1 I in an other page Sandbox.Page2, I write the following script: {{groovy}} def mydoc=xwiki.getDocument('Sandbox.Page1') def myfile=mydoc.getAttachment('Text.txt') println "|"+mydoc+"|"+myfile {{/goovy}} The result is |Sandbox.Page1|null
If I put the same script in Sandbox.Page2, the result become: |Sandbox.Page1|com.xpn.xwiki.api.Attachment@331be8
I don't understand the situation: do you have two documents? One having an attachment, and another one without it? In any case, myfile gets an array: classname (com.xpn.xwiki.api.Attachment) and an object ID. I can't explain why it varies though.
Why cannot get attachments from other document?
Check this...
http://ebiotic.net/bin/ICT/HasAttachment#Attachments http://ebiotic.net/bin/ICT/GetAttachment#Attachments
This should help:
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/com...
Please, take into account that I'm not a maven! I've just picked up some ideas here and there. Please, consider critically this message! Thanks.
I run XWiki 2.5 with Tomcat 6.0.28, Mysql 5.1.49, Ubuntu 10.10
Arnaud. _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
2010/10/29 Caleb James DeLisle <calebdelisle@lavabit.com>:
Hi Arnaud,
I have indeed repeated this problem. It appears that I have introduced a bug when I fixed http://jira.xwiki.org/jira/browse/XWIKI-5405. This bug nolonger exists on the 2.6 trunk due to additional refactoring and I will work on a targeted patch for v2.5.1 Terribly sorry for the inconvenience and thank you for the report!
Caleb
Thanks Caleb That explain why that doesn't work for me and work for Ricardo Arnaud.
On 10/28/2010 06:25 PM, [Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Arnaud bourree wrote:
Hello
I put a file Text.txt as attachment in a page: Sandbox.Page1 I in an other page Sandbox.Page2, I write the following script: {{groovy}} def mydoc=xwiki.getDocument('Sandbox.Page1') def myfile=mydoc.getAttachment('Text.txt') println "|"+mydoc+"|"+myfile {{/goovy}} The result is |Sandbox.Page1|null
If I put the same script in Sandbox.Page2, the result become: |Sandbox.Page1|com.xpn.xwiki.api.Attachment@331be8
I don't understand the situation: do you have two documents? One having an attachment, and another one without it? In any case, myfile gets an array: classname (com.xpn.xwiki.api.Attachment) and an object ID. I can't explain why it varies though.
Why cannot get attachments from other document?
Check this...
http://ebiotic.net/bin/ICT/HasAttachment#Attachments http://ebiotic.net/bin/ICT/GetAttachment#Attachments
This should help:
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/com...
Please, take into account that I'm not a maven! I've just picked up some ideas here and there. Please, consider critically this message! Thanks.
I run XWiki 2.5 with Tomcat 6.0.28, Mysql 5.1.49, Ubuntu 10.10
Arnaud. _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Reported an issue in JIRA for this. http://jira.xwiki.org/jira/browse/XWIKI-5640 I have proven that is affects only 2.5 and not 2.4.4 nor 2.6 trunk. Caleb On 10/28/2010 07:20 PM, Caleb James DeLisle wrote:
Hi Arnaud,
I have indeed repeated this problem. It appears that I have introduced a bug when I fixed http://jira.xwiki.org/jira/browse/XWIKI-5405. This bug nolonger exists on the 2.6 trunk due to additional refactoring and I will work on a targeted patch for v2.5.1 Terribly sorry for the inconvenience and thank you for the report!
Caleb
On 10/28/2010 06:25 PM, [Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Arnaud bourree wrote:
Hello
I put a file Text.txt as attachment in a page: Sandbox.Page1 I in an other page Sandbox.Page2, I write the following script: {{groovy}} def mydoc=xwiki.getDocument('Sandbox.Page1') def myfile=mydoc.getAttachment('Text.txt') println "|"+mydoc+"|"+myfile {{/goovy}} The result is |Sandbox.Page1|null
If I put the same script in Sandbox.Page2, the result become: |Sandbox.Page1|com.xpn.xwiki.api.Attachment@331be8
I don't understand the situation: do you have two documents? One having an attachment, and another one without it? In any case, myfile gets an array: classname (com.xpn.xwiki.api.Attachment) and an object ID. I can't explain why it varies though.
Why cannot get attachments from other document?
Check this...
http://ebiotic.net/bin/ICT/HasAttachment#Attachments http://ebiotic.net/bin/ICT/GetAttachment#Attachments
This should help:
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/com...
Please, take into account that I'm not a maven! I've just picked up some ideas here and there. Please, consider critically this message! Thanks.
I run XWiki 2.5 with Tomcat 6.0.28, Mysql 5.1.49, Ubuntu 10.10
Arnaud. _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
participants (3)
-
[Ricardo Rodriguez] eBioTIC. -
Arnaud bourree -
Caleb James DeLisle