Skip to content

Commit fa16261

Browse files
committed
position of pr comment can be null and original_position is not parsed
position of pr comment is null when comment is outdated (ie. not located in diff patch anymore)
1 parent 15991fd commit fa16261

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import java.io.IOException;
2727
import java.net.URL;
28+
import javax.annotation.CheckForNull;
2829

2930
import static org.kohsuke.github.Previews.*;
3031

@@ -41,8 +42,8 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
4142
private String body;
4243
private GHUser user;
4344
private String path;
44-
private int position;
45-
private int originalPosition;
45+
private int position = -1;
46+
private int original_position = -1;
4647

4748
public static GHPullRequestReviewComment draft(String body, String path, int position) {
4849
GHPullRequestReviewComment result = new GHPullRequestReviewComment();
@@ -82,12 +83,14 @@ public String getPath() {
8283
return path;
8384
}
8485

85-
public int getPosition() {
86-
return position;
86+
@CheckForNull
87+
public Integer getPosition() {
88+
return position == -1 ? null : position;
8789
}
8890

91+
@CheckForNull
8992
public int getOriginalPosition() {
90-
return originalPosition;
93+
return original_position == -1 ? null : original_position;
9194
}
9295

9396
@Override

0 commit comments

Comments
 (0)