Merge pull request #1162 from Stypox/fix-comment-description-npe
Make getCommentText @Nonnull
This commit is contained in:
commit
ad71864b23
|
@ -13,7 +13,8 @@ import java.util.List;
|
||||||
public class CommentsInfoItem extends InfoItem {
|
public class CommentsInfoItem extends InfoItem {
|
||||||
|
|
||||||
private String commentId;
|
private String commentId;
|
||||||
private Description commentText;
|
@Nonnull
|
||||||
|
private Description commentText = Description.EMPTY_DESCRIPTION;
|
||||||
private String uploaderName;
|
private String uploaderName;
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private List<Image> uploaderAvatars = List.of();
|
private List<Image> uploaderAvatars = List.of();
|
||||||
|
@ -50,11 +51,12 @@ public class CommentsInfoItem extends InfoItem {
|
||||||
this.commentId = commentId;
|
this.commentId = commentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
public Description getCommentText() {
|
public Description getCommentText() {
|
||||||
return commentText;
|
return commentText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommentText(final Description commentText) {
|
public void setCommentText(@Nonnull final Description commentText) {
|
||||||
this.commentText = commentText;
|
this.commentText = commentText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ public interface CommentsInfoItemExtractor extends InfoItemExtractor {
|
||||||
/**
|
/**
|
||||||
* The text of the comment
|
* The text of the comment
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
default Description getCommentText() throws ParsingException {
|
default Description getCommentText() throws ParsingException {
|
||||||
return Description.EMPTY_DESCRIPTION;
|
return Description.EMPTY_DESCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class BandcampCommentsInfoItemExtractor implements CommentsInfoItemExtrac
|
||||||
return getUploaderAvatars();
|
return getUploaderAvatars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Description getCommentText() throws ParsingException {
|
public Description getCommentText() throws ParsingException {
|
||||||
return new Description(review.getString("why"), Description.PLAIN_TEXT);
|
return new Description(review.getString("why"), Description.PLAIN_TEXT);
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class PeertubeCommentsInfoItemExtractor implements CommentsInfoItemExtrac
|
||||||
return new DateWrapper(parseDateFrom(textualUploadDate));
|
return new DateWrapper(parseDateFrom(textualUploadDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Description getCommentText() throws ParsingException {
|
public Description getCommentText() throws ParsingException {
|
||||||
final String htmlText = JsonUtils.getString(item, "text");
|
final String htmlText = JsonUtils.getString(item, "text");
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class SoundcloudCommentsInfoItemExtractor implements CommentsInfoItemExtr
|
||||||
return Objects.toString(json.getLong("id"), null);
|
return Objects.toString(json.getLong("id"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Description getCommentText() {
|
public Description getCommentText() {
|
||||||
return new Description(json.getString("body"), Description.PLAIN_TEXT);
|
return new Description(json.getString("body"), Description.PLAIN_TEXT);
|
||||||
|
|
|
@ -184,6 +184,7 @@ public class YoutubeCommentsInfoItemExtractor implements CommentsInfoItemExtract
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Description getCommentText() throws ParsingException {
|
public Description getCommentText() throws ParsingException {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue