コードを介して Bugzilla のバグにスクリーンショットを添付したいと考えています。J2Bugzilla API を使用していますが、必要なメソッドが見つかりません。Java を使用して Bugzilla にファイルを添付するための他の API があれば提案してください。
1 に答える
0
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();
次に、次を使用して既存のバグ レポートに追加できますAddAttachment
。
AddAttachment add = new AddAttachment(attachment, bug);
//'bug' is a Bug you have previously retrieved
//'conn' is the BugzillaConnector
conn.executeMethod(add);
于 2013-03-12T19:40:35.763 に答える