Skip to content

Commit

Permalink
position of pr comment can be null and original_position is not parsed
Browse files Browse the repository at this point in the history
position of pr comment is null when comment is outdated (ie. not located in diff patch anymore)
  • Loading branch information
sns-seb committed Jan 9, 2018
1 parent 15991fd commit fa16261
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.IOException;
import java.net.URL;
import javax.annotation.CheckForNull;

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

Expand All @@ -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();
Expand Down Expand Up @@ -82,12 +83,14 @@ public String getPath() {
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;

This comment has been minimized.

Copy link
@henryju

henryju Feb 16, 2018

Contributor

@sns-seb @kohsuke Seems there is a problem here. This may return null but return type is int.

}

@Override
Expand Down

0 comments on commit fa16261

Please sign in to comment.