svnno****@sourc*****
svnno****@sourc*****
2010年 12月 6日 (月) 23:23:27 JST
Revision: 1171 http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1171 Author: syo68k Date: 2010-12-06 23:23:27 +0900 (Mon, 06 Dec 2010) Log Message: ----------- PostClass作成時のエラーチェック強化 Modified Paths: -------------- trunk/Tween/MyCommon.vb trunk/Tween/Twitter.vb -------------- next part -------------- Modified: trunk/Tween/MyCommon.vb =================================================================== --- trunk/Tween/MyCommon.vb 2010-12-06 10:16:50 UTC (rev 1170) +++ trunk/Tween/MyCommon.vb 2010-12-06 14:23:27 UTC (rev 1171) @@ -159,6 +159,12 @@ BlinkIcon End Enum + Public Sub TraceOut(ByVal ex As Exception, ByVal Message As String) + Dim buf As String = "" + ExceptionOut(ex, buf) + TraceOut(TraceFlag, Message + Environment.NewLine + buf) + End Sub + Public Sub TraceOut(ByVal Message As String) TraceOut(TraceFlag, Message) End Sub Modified: trunk/Tween/Twitter.vb =================================================================== --- trunk/Tween/Twitter.vb 2010-12-06 10:16:50 UTC (rev 1170) +++ trunk/Tween/Twitter.vb 2010-12-06 14:23:27 UTC (rev 1171) @@ -1483,6 +1483,10 @@ Private Function CreatePostsFromStatusData(ByVal status As TwitterDataModel.Status) As PostClass Dim post As New PostClass + If status Is Nothing Then + TraceOut("CreatePostsFromStatusData:status is Nothing.") + Return Nothing + End If post.Id = status.Id If status.RetweetedStatus IsNot Nothing Then Dim retweeted As TwitterDataModel.RetweetedStatus = status.RetweetedStatus @@ -1502,6 +1506,12 @@ '以下、ユーザー情報 Dim user As TwitterDataModel.User = retweeted.User + + If status Is Nothing Then + TraceOut("CreatePostsFromStatusData:retweeted.user is Nothing.") + Return Nothing + End If + post.Uid = user.Id post.Name = user.ScreenName post.Nickname = user.Name @@ -1524,6 +1534,12 @@ '以下、ユーザー情報 Dim user As TwitterDataModel.User = status.User + + If status Is Nothing Then + TraceOut("CreatePostsFromStatusData:status.user is Nothing.") + Return Nothing + End If + post.Uid = user.Id post.Name = user.ScreenName post.Nickname = user.Name @@ -1564,10 +1580,30 @@ Return "Invalid Json!" End Try + Dim cnt As Integer = -1 For Each status As TwitterDataModel.Status In items - Dim post As PostClass = CreatePostsFromStatusData(status) - If post Is Nothing Then Continue For '解析失敗 + Dim post As PostClass = Nothing + cnt += 1 + Try + post = CreatePostsFromStatusData(status) + Catch ex As Exception + TraceOut(ex, "CreatePostsFromStatusData:Exceptional Abort." + Environment.NewLine + + "data offset:" + cnt.ToString + Environment.NewLine + + "----------json data----------" + Environment.NewLine + + content + Environment.NewLine + + "----------end of json data----------" + Environment.NewLine) + End Try + + If post Is Nothing Then + TraceOut("CreatePostsFromStatusData:Analyze failed." + Environment.NewLine + + "data offset:" + cnt.ToString + Environment.NewLine + + "----------json data----------" + Environment.NewLine + + content + Environment.NewLine + + "----------end of json data----------" + Environment.NewLine) + Continue For '解析失敗 + End If + If minimumId > post.Id Then minimumId = post.Id '二重取得回避 SyncLock LockObj @@ -2818,7 +2854,8 @@ "unfavorite", "follow", "list_member_added", - "list_member_removed" + "list_member_removed", + "block" } Public ReadOnly Property LastReceivedUserStream As DateTime