我想通过代码在Bugzilla中附加一个截图。我正在使用J2Bugzilla API,但无法找到所需的方法。请建议是否有任何其他API使用Java在Bugzilla中附加文件。如何使用java prgramming语言将附件添加到bugzilla中?
回答
要附加与J2Bugzilla任何文件,你必须先创建一个Attachment
:
byte[] data = ...;//Read the data as a byte array from the image file
AttachmentFactory attachmentFactory = new AttachmentFactory();
Attachment attachment = attachmentFactory.newAttachment()
.setData(data)
.setMime("...")//Set the appropriate MIME type for the image format
.setSummary("My screenshot")
.createAttachment();
然后,您可以将其添加到现有的bug报告使用AddAttachment
:
AddAttachment add = new AddAttachment(attachment, bug);
//'bug' is a Bug you have previously retrieved
//'conn' is the BugzillaConnector
conn.executeMethod(add);
Bugilla版本3.6的这个工作吗? – 2013-05-03 06:25:15
不,它不会像[WebService文档](http://www.bugzilla.org/docs/3.6/en/html/api/Bugzilla/WebService/Bug.html)所示。不过,这可以在API文档中更好地解释。 – 2013-05-03 15:25:01
该代码适用于哪个版本? – 2013-06-18 08:58:40
- 1. 将语言添加到语言django/python
- 2. 检查互质数,用C语言prgramming
- 3. 如何将语言添加到NSSpellChecker的可用语言?
- 4. 如何将语言添加到pootle
- 5. 在VBA中使用XML-RPC添加Bugzilla的附件
- 6. 如何使用PHP将附件添加到邮件消息中?
- 7. 将声明的语言附加到html?
- 8. 将文字添加到语言中?
- 9. 如何使用EWS将附件添加到嵌入消息中
- 10. 如何将LIGHTBOX添加到附件?
- 11. 如何使用System.Net.Mail将附件添加到电子邮件?
- 12. 如何使用EWS将文件附件添加到约会?
- 13. 如何使用Aspose将附件添加到.oft文件
- 14. 如何将语言支持添加到Constants.h文件?
- 15. cakephp:如何将语言文件夹添加到url?
- 16. 将附件添加到Slackbot
- 17. 如何将动态值附加到Swift语言的GET URL?
- 18. 如何将语言添加到烧杯中的笔记本中?
- 19. 将语言添加到NLTK WordNet
- 20. iTextsharp将语言添加到PDF文档
- 21. 多语言:将自定义语言添加到Web内容php
- 22. 将语言更改器添加到Cookies
- 23. 如何使用Outlook后期绑定将附件添加到mailitem
- 24. 如何添加其他语言到TeX
- 25. 如何在添加参加者后将附件添加到AppointmentItem?
- 26. 将自定义语言添加到django
- 27. 如何将语言代码添加到金字塔中的URL?
- 28. 如何在iTunes Connect中将新语言添加到App Summary?
- 29. 如何将您自己的编程语言添加到IDE中?
- 30. 如何将Urdu语言添加到SpeechSynthesizer中
你找到解决方案,你可以分享吗? 我使用的是Python模块超过XMLRPC与Bugzilla的交互 https://git.fedorahosted.org/git/python-bugzilla.git 我Bugzilla的版本是4.2.3 通过使用add_attachment方法我可以上传具有不同扩展名(.zip,.jpg等)的文件,但上传的文件已损坏。所以,我不确定这个Bugzilla附件API是否稳定。 – Khokhar 2014-01-10 14:52:18