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)
This commit is contained in:
Sébastien Lesaint
2017-11-30 14:39:16 +01:00
parent 15991fd2f7
commit fa16261d7a

View File

@@ -25,6 +25,7 @@ package org.kohsuke.github;
import java.io.IOException;
import java.net.URL;
import javax.annotation.CheckForNull;
import static org.kohsuke.github.Previews.*;
@@ -41,8 +42,8 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
private String body;
private GHUser user;
private String path;
private int position;
private int originalPosition;
private int position = -1;
private int original_position = -1;
public static GHPullRequestReviewComment draft(String body, String path, int position) {
GHPullRequestReviewComment result = new GHPullRequestReviewComment();
@@ -82,12 +83,14 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
return path;
}
public int getPosition() {
return position;
@CheckForNull
public Integer getPosition() {
return position == -1 ? null : position;
}
@CheckForNull
public int getOriginalPosition() {
return originalPosition;
return original_position == -1 ? null : original_position;
}
@Override