Skip to content

Commit

Permalink
Fixing new FindBugs warnings, and setting Travis build to fail if new…
Browse files Browse the repository at this point in the history
… FindBugs warnings are added
  • Loading branch information
Sahil Takiar committed May 12, 2016
1 parent 5cd9d96 commit 137d435
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package gobblin.data.management.convertion.hive;

import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;

import com.google.gson.Gson;
Expand All @@ -24,11 +25,13 @@
*/
@Getter
@AllArgsConstructor
@EqualsAndHashCode
public class LongWatermark implements Watermark, Comparable<LongWatermark> {

private static final Gson GSON = new Gson();

private long value;

@Override
public JsonElement toJson() {
return GSON.toJsonTree(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ public Iterator<HiveDataset> getDatasetsIterator()
@Nullable
@Override
public HiveDataset apply(@Nullable DbAndTable dbAndTable) {
if (dbAndTable == null) {
return null;
}
try (AutoReturnableObject<IMetaStoreClient> client = clientPool.getClient()) {
Table table = client.get().getTable(dbAndTable.getDb(), dbAndTable.getTable());
return createHiveDataset(table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import java.util.Map;
import java.util.Set;

import javax.annotation.Nullable;

import org.apache.commons.lang3.reflect.ConstructorUtils;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.metastore.IMetaStoreClient;
Expand All @@ -31,6 +34,7 @@
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.JobConfigurable;

import org.apache.thrift.TException;

import com.google.common.base.Function;
Expand All @@ -56,7 +60,10 @@ public static Map<List<String>, Partition> getPartitionsMap(IMetaStoreClient cli
Optional<String> filter) throws IOException {
return Maps.uniqueIndex(getPartitions(client, table, filter), new Function<Partition, List<String>>() {
@Override
public List<String> apply(Partition partition) {
public List<String> apply(@Nullable Partition partition) {
if (partition == null) {
return null;
}
return partition.getValues();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public boolean acceptDb(String db) {
* @return Whether the input table is accepted by this {@link WhitelistBlacklist}.
*/
public boolean acceptTable(String db, String table) {
return accept(db, Optional.of(table));
return accept(db, Optional.fromNullable(table));
}

private boolean accept(String db, Optional<String> table) {
Expand Down
2 changes: 1 addition & 1 deletion ligradle/findbugs/findbugsExclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</Match>
<!-- Ignored until https://github.com/linkedin/gobblin/issues/969 has been resolved -->
<Match>
<Class name="gobblin.metastore.DatabaseJobHistoryStore" />
<Class name="~gobblin\.metastore\.database\.DatabaseJobHistoryStoreV.*" />
<Bug pattern="SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING" />
</Match>
<!-- Ignored until https://github.com/linkedin/gobblin/issues/976 has been resolved -->
Expand Down
2 changes: 1 addition & 1 deletion travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
#!/bin/bash
set -e

./gradlew clean assemble -Dorg.gradle.parallel=false
./gradlew clean build -x test -Dorg.gradle.parallel=false

0 comments on commit 137d435

Please sign in to comment.