Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ target
.gradle
build


#eclipse
.classpath
.project
.settings
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>twitter-api-java-sdk</artifactId>
<packaging>jar</packaging>
<name>twitter-api-java-sdk</name>
<version>2.0.1</version>
<version>2.0.1-nrv</version>
<url>https://github.com/twitterdev/twitter-api-java-sdk</url>
<description>Twitter API v2 available endpoints</description>
<scm>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/twitter/clientlib/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,14 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj.get("profile_image_url") != null && !jsonObj.get("profile_image_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `profile_image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("profile_image_url").toString()));
}

// Patch issue #30
if (jsonObj.get("profile_image_url") != null) {
if (jsonObj.get("profile_image_url").getAsString().isBlank()) {
jsonObj.remove("profile_image_url");
}
}

// validate the optional field `public_metrics`
if (jsonObj.getAsJsonObject("public_metrics") != null) {
UserPublicMetrics.validateJsonObject(jsonObj.getAsJsonObject("public_metrics"));
Expand Down