Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs issue #5 Some classes are not supported anymore in Apache Flink v1.4 and were … #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
import org.apache.flink.hadoop.shaded.com.google.common.base.Strings;

import java.io.Serializable;

Expand Down Expand Up @@ -199,10 +198,10 @@ public T setReadTimeout(int readTimeout) {
* Validates mandatory arguments.
*/
protected void validate() {
if (Strings.isNullOrEmpty(restURI)) {
if (restURI.isEmpty() || restURI == null) {
Copy link
Owner

@s1ck s1ck Apr 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the restURI == null check should be in front. If it's null, the .isEmpty() call will throw a NPE. That's why the helper method is called nullOrEmpty ;)

also see here https://github.com/google/guava/blob/master/guava/src/com/google/common/base/Platform.java#L58-L60

throw new IllegalArgumentException("No Rest URI was supplied.");
}
if (Strings.isNullOrEmpty(query)) {
if (query.isEmpty() || query == null) {
throw new IllegalArgumentException("No Cypher statement was supplied.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
import org.apache.flink.api.common.io.OutputFormat;
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.hadoop.shaded.com.google.common.base.Strings;
import org.apache.flink.hadoop.shaded.com.google.common.collect.Lists;
import org.codehaus.jackson.node.JsonNodeFactory;
import org.codehaus.jackson.node.ObjectNode;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -242,7 +241,7 @@ public static Builder buildNeo4jOutputFormat() {
*/
public static class Builder extends Neo4jFormatBase.Builder<Builder> {

private List<String> elementKeys = Lists.newArrayList();
private List<String> elementKeys = new ArrayList<>();

private int batchSize;

Expand Down Expand Up @@ -276,7 +275,7 @@ public Builder addParameterKey(String key) {
* @return builder
*/
public Builder addParameterKey(int position, String key) {
checkArgument(!Strings.isNullOrEmpty(key), "Key must not be null or empty.");
checkArgument(!(key.isEmpty() || key == null), "Key must not be null or empty.");
elementKeys.add(position, key);
return getThis();
}
Expand Down