File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
Filter options
src/main/java/org/kohsuke/github Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
Original file line number Diff line number Diff line change @@ -59,23 +59,38 @@ public String getType() {
59
59
return subject .type ;
60
60
}
61
61
62
+ /**
63
+ * If this thread is about an issue, return that issue.
64
+ *
65
+ * @return null if this thread is not about an issue.
66
+ */
62
67
public GHIssue getBoundIssue () throws IOException {
63
- if (!"Issue" .equals (subject .type ))
64
- throw new IllegalStateException ( "Notification doesn't point to Issue" ) ;
68
+ if (!"Issue" .equals (subject .type ) && "PullRequest" . equals ( subject . type ) )
69
+ return null ;
65
70
return repository .getIssue (
66
71
Integer .parseInt (subject .url .substring (subject .url .lastIndexOf ('/' ) + 1 )));
67
72
}
68
73
74
+ /**
75
+ * If this thread is about a pull request, return that pull request.
76
+ *
77
+ * @return null if this thread is not about a pull request.
78
+ */
69
79
public GHPullRequest getBoundPullRequest () throws IOException {
70
80
if (!"PullRequest" .equals (subject .type ))
71
- throw new IllegalStateException ( "Notification doesn't point to PullRequest" ) ;
81
+ return null ;
72
82
return repository .getPullRequest (
73
83
Integer .parseInt (subject .url .substring (subject .url .lastIndexOf ('/' ) + 1 )));
74
84
}
75
85
86
+ /**
87
+ * If this thread is about a commit, return that commit.
88
+ *
89
+ * @return null if this thread is not about a commit.
90
+ */
76
91
public GHCommit getBoundCommit () throws IOException {
77
92
if (!"Commit" .equals (subject .type ))
78
- throw new IllegalStateException ( "Notification doesn't point to Commit" ) ;
93
+ return null ;
79
94
return repository .getCommit (subject .url .substring (subject .url .lastIndexOf ('/' ) + 1 ));
80
95
}
81
96
You can’t perform that action at this time.
0 commit comments