error:does multipart has image? error_code:20007/2/statuses/upload.json JAVA

新浪微博 官网sdk .

在调用 public Status UploadStatus(String status, ImageItem item) 这个接口发布带图片的微博时,出现如下异常:

 

weibo4j2.model.WeiboException: 400:The request was invalid.  An accompanying error message will explain why. This is the status code will be returned during rate limiting.
 error:does multipart has image? error_code:20007/2/statuses/upload.json
    at weibo4j2.http.HttpClient.multPartURL(HttpClient.java:334)
    at weibo4j2.Timeline.UploadStatus(Timeline.java:765)
    at com.chineseall.util.SnsPostThread.run(SnsPostThread.java:51)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: weibo4j2.model.WeiboException: 400:The request was invalid.  An accompanying error message will explain why. This is the status code will be returned during rate limiting.
 error:does multipart has image? error_code:20007/2/statuses/upload.json
    at weibo4j2.http.HttpClient.httpRequest(HttpClient.java:413)
    at weibo4j2.http.HttpClient.httpRequest(HttpClient.java:371)
    at weibo4j2.http.HttpClient.multPartURL(HttpClient.java:331)
    ... 5 more

 

解决:

参数里的 ImageItem 这个对象,在 new 的时候,如果使用了 new ImageItem(name, content) 这个构造方法的话,

则 第一个参数 必须是 pic

new ImageItem("pic",byteArrayOutStream.toByteArray());

 

转载于:https://www.cnblogs.com/BennyTian/archive/2013/05/22/3092710.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值