moafmoar / weibo4j

Automatically exported from code.google.com/p/weibo4j
Other
0 stars 0 forks source link

Favorite.getFavorites()出现异常 #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. 收藏的微博存在被作者删除的情况,如附件所示
2. 调用Favorite.getFavorites()取到此条微博,将出现异常
3.

What is the expected output? What do you see instead?
此条Favorites内容为空,或者抛弃不取,实际出现了异常

What version of the product are you using? On what operating system?
Weibo4j-oauth2.0-beta on Mac OS Lion

Please provide any additional information below.

org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet FavoritesServlet threw exception
java.lang.ArrayIndexOutOfBoundsException: 1
    at weibo4j.model.Source.<init>(Source.java:13)
    at weibo4j.model.Status.constructJson(Status.java:87)
    at weibo4j.model.Status.<init>(Status.java:132)
    at weibo4j.model.Favorites.<init>(Favorites.java:47)
    at weibo4j.model.Favorites.constructFavorites(Favorites.java:66)
    at weibo4j.Favorite.getFavorites(Favorite.java:46)
    at jmx.servlet.FavoritesServlet.doGet(FavoritesServlet.java:67)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:680)

Original issue reported on code.google.com by jmx...@gmail.com on 16 Dec 2011 at 1:37

Attachments:

GoogleCodeExporter commented 8 years ago
在Status.java中方法constructJson加入条件判断
if (!json.isNull("source")) {
    source = new Source(json.getString("source"));
}
解决问题

Original comment by jmx...@gmail.com on 16 Dec 2011 at 3:14