beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [18/50] [abbrv] incubator-beam git commit: Static import Preconditions.checkX everywhere
Date Wed, 06 Jul 2016 17:20:24 GMT
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/InstanceBuilder.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/InstanceBuilder.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/InstanceBuilder.java
index e5d9916..08e07ce 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/InstanceBuilder.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/InstanceBuilder.java
@@ -17,10 +17,12 @@
  */
 package org.apache.beam.sdk.util;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+
 import org.apache.beam.sdk.values.TypeDescriptor;
 
 import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -80,8 +82,7 @@ public class InstanceBuilder<T> {
    */
   public InstanceBuilder<T> fromClassName(String name)
       throws ClassNotFoundException {
-    Preconditions.checkArgument(factoryClass == null,
-        "Class name may only be specified once");
+    checkArgument(factoryClass == null, "Class name may only be specified once");
     if (name.indexOf('.') == -1) {
       name = type.getPackage().getName() + "." + name;
     }
@@ -114,7 +115,7 @@ public class InstanceBuilder<T> {
    * <p>Modifies and returns the {@code InstanceBuilder} for chaining.
    */
   public InstanceBuilder<T> fromFactoryMethod(String methodName) {
-    Preconditions.checkArgument(this.methodName == null,
+    checkArgument(this.methodName == null,
         "Factory method name may only be specified once");
     this.methodName = methodName;
     return this;
@@ -201,18 +202,18 @@ public class InstanceBuilder<T> {
   }
 
   private T buildFromMethod(Class<?>[] types) {
-    Preconditions.checkState(factoryClass != null);
-    Preconditions.checkState(methodName != null);
+    checkState(factoryClass != null);
+    checkState(methodName != null);
 
     try {
       Method method = factoryClass.getDeclaredMethod(methodName, types);
 
-      Preconditions.checkState(Modifier.isStatic(method.getModifiers()),
+      checkState(Modifier.isStatic(method.getModifiers()),
           "Factory method must be a static method for "
               + factoryClass.getName() + "#" + method.getName()
       );
 
-      Preconditions.checkState(type.isAssignableFrom(method.getReturnType()),
+      checkState(type.isAssignableFrom(method.getReturnType()),
           "Return type for " + factoryClass.getName() + "#" + method.getName()
               + " must be assignable to " + type.getSimpleName());
 
@@ -241,12 +242,12 @@ public class InstanceBuilder<T> {
   }
 
   private T buildFromConstructor(Class<?>[] types) {
-    Preconditions.checkState(factoryClass != null);
+    checkState(factoryClass != null);
 
     try {
       Constructor<?> constructor = factoryClass.getDeclaredConstructor(types);
 
-      Preconditions.checkState(type.isAssignableFrom(factoryClass),
+      checkState(type.isAssignableFrom(factoryClass),
           "Instance type " + factoryClass.getName()
               + " must be assignable to " + type.getSimpleName());
 

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/IntervalBoundedExponentialBackOff.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/IntervalBoundedExponentialBackOff.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/IntervalBoundedExponentialBackOff.java
index 92ff2f0..519776a 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/IntervalBoundedExponentialBackOff.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/IntervalBoundedExponentialBackOff.java
@@ -17,8 +17,10 @@
  */
 package org.apache.beam.sdk.util;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.api.client.util.BackOff;
-import com.google.common.base.Preconditions;
+
 
 /**
  * Implementation of {@link BackOff} that increases the back off period for each retry attempt
@@ -55,10 +57,8 @@ public class IntervalBoundedExponentialBackOff implements BackOff {
   private int currentAttempt;
 
   public IntervalBoundedExponentialBackOff(long maximumIntervalMillis, long initialIntervalMillis)
{
-    Preconditions.checkArgument(
-        maximumIntervalMillis > 0, "Maximum interval must be greater than zero.");
-    Preconditions.checkArgument(
-        initialIntervalMillis > 0, "Initial interval must be greater than zero.");
+    checkArgument(maximumIntervalMillis > 0, "Maximum interval must be greater than zero.");
+    checkArgument(initialIntervalMillis > 0, "Initial interval must be greater than zero.");
     this.maximumIntervalMillis = maximumIntervalMillis;
     this.initialIntervalMillis = initialIntervalMillis;
     reset();

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/MergingActiveWindowSet.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/MergingActiveWindowSet.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/MergingActiveWindowSet.java
index 07e47aa..4702fe2 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/MergingActiveWindowSet.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/MergingActiveWindowSet.java
@@ -17,6 +17,9 @@
  */
 package org.apache.beam.sdk.util;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
 import org.apache.beam.sdk.coders.MapCoder;
 import org.apache.beam.sdk.coders.SetCoder;
 import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
@@ -28,7 +31,6 @@ import org.apache.beam.sdk.util.state.StateTags;
 import org.apache.beam.sdk.util.state.ValueState;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Sets;
 
@@ -142,7 +144,7 @@ public class MergingActiveWindowSet<W extends BoundedWindow> implements
ActiveWi
   @Override
   public void ensureWindowIsActive(W window) {
     Set<W> stateAddressWindows = activeWindowToStateAddressWindows.get(window);
-    Preconditions.checkState(stateAddressWindows != null,
+    checkState(stateAddressWindows != null,
                              "Cannot ensure window %s is active since it is neither ACTIVE
nor NEW",
                              window);
     if (stateAddressWindows.isEmpty()) {
@@ -196,25 +198,22 @@ public class MergingActiveWindowSet<W extends BoundedWindow> implements
ActiveWi
     @Override
     public void merge(Collection<W> toBeMerged, W mergeResult) throws Exception {
       // The arguments have come from userland.
-      Preconditions.checkNotNull(toBeMerged);
-      Preconditions.checkNotNull(mergeResult);
+      checkNotNull(toBeMerged);
+      checkNotNull(mergeResult);
       List<W> copyOfToBeMerged = new ArrayList<>(toBeMerged.size());
       boolean includesMergeResult = false;
       for (W window : toBeMerged) {
-        Preconditions.checkNotNull(window);
-        Preconditions.checkState(
-            isActiveOrNew(window), "Expecting merge window %s to be ACTIVE or NEW", window);
+        checkNotNull(window);
+        checkState(isActiveOrNew(window), "Expecting merge window %s to be ACTIVE or NEW",
window);
         if (window.equals(mergeResult)) {
           includesMergeResult = true;
         }
         boolean notDup = seen.add(window);
-        Preconditions.checkState(
-            notDup, "Expecting merge window %s to appear in at most one merge set", window);
+        checkState(notDup, "Expecting merge window %s to appear in at most one merge set",
window);
         copyOfToBeMerged.add(window);
       }
       if (!includesMergeResult) {
-        Preconditions.checkState(
-            !isActive(mergeResult), "Expecting result window %s to be NEW", mergeResult);
+        checkState(!isActive(mergeResult), "Expecting result window %s to be NEW", mergeResult);
       }
       allToBeMerged.add(copyOfToBeMerged);
       allMergeResults.add(mergeResult);
@@ -267,7 +266,7 @@ public class MergingActiveWindowSet<W extends BoundedWindow> implements
ActiveWi
 
     for (W other : toBeMerged) {
       Set<W> otherStateAddressWindows = activeWindowToStateAddressWindows.get(other);
-      Preconditions.checkState(otherStateAddressWindows != null,
+      checkState(otherStateAddressWindows != null,
                                "Window %s is not ACTIVE or NEW", other);
 
       for (W otherStateAddressWindow : otherStateAddressWindows) {
@@ -295,7 +294,7 @@ public class MergingActiveWindowSet<W extends BoundedWindow> implements
ActiveWi
   public void merged(W window) {
     // Take just the first state address window.
     Set<W> stateAddressWindows = activeWindowToStateAddressWindows.get(window);
-    Preconditions.checkState(stateAddressWindows != null, "Window %s is not ACTIVE", window);
+    checkState(stateAddressWindows != null, "Window %s is not ACTIVE", window);
     W first = Iterables.getFirst(stateAddressWindows, null);
     stateAddressWindows.clear();
     stateAddressWindows.add(first);
@@ -308,7 +307,7 @@ public class MergingActiveWindowSet<W extends BoundedWindow> implements
ActiveWi
   @Override
   public Set<W> readStateAddresses(W window) {
     Set<W> stateAddressWindows = activeWindowToStateAddressWindows.get(window);
-    Preconditions.checkState(stateAddressWindows != null, "Window %s is not ACTIVE", window);
+    checkState(stateAddressWindows != null, "Window %s is not ACTIVE", window);
     return stateAddressWindows;
   }
 
@@ -319,9 +318,9 @@ public class MergingActiveWindowSet<W extends BoundedWindow> implements
ActiveWi
   @Override
   public W writeStateAddress(W window) {
     Set<W> stateAddressWindows = activeWindowToStateAddressWindows.get(window);
-    Preconditions.checkState(stateAddressWindows != null, "Window %s is not ACTIVE", window);
+    checkState(stateAddressWindows != null, "Window %s is not ACTIVE", window);
     W result = Iterables.getFirst(stateAddressWindows, null);
-    Preconditions.checkState(result != null, "Window %s is still NEW", window);
+    checkState(result != null, "Window %s is still NEW", window);
     return result;
   }
 
@@ -345,11 +344,11 @@ public class MergingActiveWindowSet<W extends BoundedWindow> implements
ActiveWi
     Set<W> knownStateAddressWindows = new HashSet<>();
     for (Map.Entry<W, Set<W>> entry : activeWindowToStateAddressWindows.entrySet())
{
       W active = entry.getKey();
-      Preconditions.checkState(!entry.getValue().isEmpty(),
+      checkState(!entry.getValue().isEmpty(),
                                "Unexpected empty state address window set for ACTIVE window
%s",
                                active);
       for (W stateAddressWindow : entry.getValue()) {
-        Preconditions.checkState(knownStateAddressWindows.add(stateAddressWindow),
+        checkState(knownStateAddressWindows.add(stateAddressWindow),
                                  "%s is in more than one state address window set",
                                  stateAddressWindow);
       }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/SerializableUtils.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/SerializableUtils.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/SerializableUtils.java
index 06b5bb2..45f6c4a 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/SerializableUtils.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/SerializableUtils.java
@@ -20,11 +20,11 @@ package org.apache.beam.sdk.util;
 import static org.apache.beam.sdk.util.CoderUtils.decodeFromByteArray;
 import static org.apache.beam.sdk.util.CoderUtils.encodeToByteArray;
 
+import static com.google.common.base.Preconditions.checkState;
+
 import org.apache.beam.sdk.coders.Coder;
 import org.apache.beam.sdk.coders.CoderException;
 
-import com.google.common.base.Preconditions;
-
 import org.xerial.snappy.SnappyInputStream;
 import org.xerial.snappy.SnappyOutputStream;
 
@@ -120,11 +120,10 @@ public class SerializableUtils {
               + "See Coder for details.", coder), e
       );
     }
-    Preconditions.checkState(coder.equals(decoded),
-        String.format("Coder not equal to original after serialization, "
-            + "indicating that the Coder may not implement serialization "
-            + "correctly.  Before: %s, after: %s, cloud encoding: %s",
-            coder, decoded, cloudObject));
+    checkState(coder.equals(decoded),
+        "Coder not equal to original after serialization, indicating that the Coder may not
"
+        + "implement serialization correctly.  Before: %s, after: %s, cloud encoding: %s",
+        coder, decoded, cloudObject);
 
     return cloudObject;
   }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/StringUtils.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/StringUtils.java
index 428b350..53201a4 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/StringUtils.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/StringUtils.java
@@ -17,10 +17,12 @@
  */
 package org.apache.beam.sdk.util;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import org.apache.beam.sdk.transforms.PTransform;
 
 import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -148,7 +150,7 @@ public class StringUtils {
    * </ul>
    */
   public static String approximatePTransformName(Class<?> clazz) {
-    Preconditions.checkArgument(PTransform.class.isAssignableFrom(clazz));
+    checkArgument(PTransform.class.isAssignableFrom(clazz));
     return approximateSimpleName(clazz, /* dropOuterClassNames */ false)
         .replaceFirst("\\.Bound$", "");
   }
@@ -160,8 +162,8 @@ public class StringUtils {
    * (i.e. insertions, deletions or substitutions) required to change one string into the
other.
    */
   public static int getLevenshteinDistance(final String s, final String t) {
-    Preconditions.checkNotNull(s);
-    Preconditions.checkNotNull(t);
+    checkNotNull(s);
+    checkNotNull(t);
 
     // base cases
     if (s.equals(t)) {
@@ -206,7 +208,7 @@ public class StringUtils {
   }
 
   private static String approximateSimpleName(Class<?> clazz, boolean dropOuterClassNames)
{
-    Preconditions.checkArgument(!clazz.isAnonymousClass(),
+    checkArgument(!clazz.isAnonymousClass(),
         "Attempted to get simple name of anonymous class");
 
     String fullName = clazz.getName();

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/TimerInternals.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/TimerInternals.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/TimerInternals.java
index 5f67131..c03ab4d 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/TimerInternals.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/TimerInternals.java
@@ -17,6 +17,7 @@
  */
 package org.apache.beam.sdk.util;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import org.apache.beam.sdk.coders.Coder;
@@ -29,7 +30,6 @@ import org.apache.beam.sdk.util.state.StateNamespace;
 import org.apache.beam.sdk.util.state.StateNamespaces;
 
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -229,8 +229,7 @@ public interface TimerInternals {
     public static TimerDataCoder of(
         @JsonProperty(PropertyNames.COMPONENT_ENCODINGS)
         List<Coder<?>> components) {
-      Preconditions.checkArgument(components.size() == 1,
-          "Expecting 1 components, got " + components.size());
+      checkArgument(components.size() == 1, "Expecting 1 components, got %s", components.size());
       return of((Coder<? extends BoundedWindow>) components.get(0));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ValueWithRecordId.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ValueWithRecordId.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ValueWithRecordId.java
index 80dfcae..e724349 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ValueWithRecordId.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ValueWithRecordId.java
@@ -17,13 +17,14 @@
  */
 package org.apache.beam.sdk.util;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import org.apache.beam.sdk.coders.ByteArrayCoder;
 import org.apache.beam.sdk.coders.Coder;
 import org.apache.beam.sdk.coders.StandardCoder;
 import org.apache.beam.sdk.transforms.DoFn;
 
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -96,8 +97,7 @@ public class ValueWithRecordId<ValueT> {
     public static <ValueT> ValueWithRecordIdCoder<ValueT> of(
          @JsonProperty(PropertyNames.COMPONENT_ENCODINGS)
         List<Coder<ValueT>> components) {
-      Preconditions.checkArgument(components.size() == 1,
-          "Expecting 1 component, got " + components.size());
+      checkArgument(components.size() == 1, "Expecting 1 component, got %s", components.size());
       return of(components.get(0));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
index 1bbdbd9..d78da41 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
@@ -34,7 +34,6 @@ import org.apache.beam.sdk.transforms.windowing.PaneInfo.PaneInfoCoder;
 import org.apache.beam.sdk.util.common.ElementByteSizeObserver;
 
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
@@ -72,7 +71,7 @@ public abstract class WindowedValue<T> {
       Instant timestamp,
       Collection<? extends BoundedWindow> windows,
       PaneInfo pane) {
-    Preconditions.checkNotNull(pane);
+    checkNotNull(pane);
 
     if (windows.size() == 0 && BoundedWindow.TIMESTAMP_MIN_VALUE.equals(timestamp))
{
       return valueInEmptyWindows(value, pane);
@@ -91,7 +90,7 @@ public abstract class WindowedValue<T> {
       Instant timestamp,
       BoundedWindow window,
       PaneInfo pane) {
-    Preconditions.checkNotNull(pane);
+    checkNotNull(pane);
 
     boolean isGlobal = GlobalWindow.INSTANCE.equals(window);
     if (isGlobal && BoundedWindow.TIMESTAMP_MIN_VALUE.equals(timestamp)) {

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/common/ReflectHelpers.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/common/ReflectHelpers.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/common/ReflectHelpers.java
index 3201271..2b6f6bc 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/common/ReflectHelpers.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/common/ReflectHelpers.java
@@ -17,11 +17,12 @@
  */
 package org.apache.beam.sdk.util.common;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
 import static java.util.Arrays.asList;
 
 import com.google.common.base.Function;
 import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Queues;
@@ -158,7 +159,7 @@ public class ReflectHelpers {
    * @return
    */
   public static FluentIterable<Class<?>> getClosureOfInterfaces(Class<?>
clazz) {
-    Preconditions.checkNotNull(clazz);
+    checkNotNull(clazz);
     Queue<Class<?>> interfacesToProcess = Queues.newArrayDeque();
     Collections.addAll(interfacesToProcess, clazz.getInterfaces());
 
@@ -196,8 +197,8 @@ public class ReflectHelpers {
    * @return An iterable of {@link Method}s which {@code iface} exposes.
    */
   public static Iterable<Method> getClosureOfMethodsOnInterface(Class<?> iface)
{
-    Preconditions.checkNotNull(iface);
-    Preconditions.checkArgument(iface.isInterface());
+    checkNotNull(iface);
+    checkArgument(iface.isInterface());
     ImmutableSet.Builder<Method> builder = ImmutableSet.builder();
     Queue<Class<?>> interfacesToProcess = Queues.newArrayDeque();
     interfacesToProcess.add(iface);

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/gcsfs/GcsPath.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/gcsfs/GcsPath.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/gcsfs/GcsPath.java
index 3e4b791..e629d64 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/gcsfs/GcsPath.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/gcsfs/GcsPath.java
@@ -17,9 +17,10 @@
  */
 package org.apache.beam.sdk.util.gcsfs;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Strings.isNullOrEmpty;
+
 import com.google.api.services.storage.model.StorageObject;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
 
 import java.io.File;
 import java.io.IOException;
@@ -80,18 +81,17 @@ public class GcsPath implements Path {
    * contain a port, user info, a query, or a fragment.
    */
   public static GcsPath fromUri(URI uri) {
-    Preconditions.checkArgument(uri.getScheme().equalsIgnoreCase(SCHEME),
-        "URI: %s is not a GCS URI", uri);
-    Preconditions.checkArgument(uri.getPort() == -1,
+    checkArgument(uri.getScheme().equalsIgnoreCase(SCHEME), "URI: %s is not a GCS URI", uri);
+    checkArgument(uri.getPort() == -1,
         "GCS URI may not specify port: %s (%i)", uri, uri.getPort());
-    Preconditions.checkArgument(
-        Strings.isNullOrEmpty(uri.getUserInfo()),
+    checkArgument(
+        isNullOrEmpty(uri.getUserInfo()),
         "GCS URI may not specify userInfo: %s (%s)", uri, uri.getUserInfo());
-    Preconditions.checkArgument(
-        Strings.isNullOrEmpty(uri.getQuery()),
+    checkArgument(
+        isNullOrEmpty(uri.getQuery()),
         "GCS URI may not specify query: %s (%s)", uri, uri.getQuery());
-    Preconditions.checkArgument(
-        Strings.isNullOrEmpty(uri.getFragment()),
+    checkArgument(
+        isNullOrEmpty(uri.getFragment()),
         "GCS URI may not specify fragment: %s (%s)", uri, uri.getFragment());
 
     return fromUri(uri.toString());
@@ -114,9 +114,9 @@ public class GcsPath implements Path {
    */
   public static GcsPath fromUri(String uri) {
     Matcher m = GCS_URI.matcher(uri);
-    Preconditions.checkArgument(m.matches(), "Invalid GCS URI: %s", uri);
+    checkArgument(m.matches(), "Invalid GCS URI: %s", uri);
 
-    Preconditions.checkArgument(m.group("SCHEME").equalsIgnoreCase(SCHEME),
+    checkArgument(m.group("SCHEME").equalsIgnoreCase(SCHEME),
         "URI: %s is not a GCS URI", uri);
     return new GcsPath(null, m.group("BUCKET"), m.group("OBJECT"));
   }
@@ -132,7 +132,7 @@ public class GcsPath implements Path {
    */
   public static GcsPath fromResourceName(String name) {
     Matcher m = GCS_RESOURCE_NAME.matcher(name);
-    Preconditions.checkArgument(m.matches(), "Invalid GCS resource name: %s", name);
+    checkArgument(m.matches(), "Invalid GCS resource name: %s", name);
 
     return new GcsPath(null, m.group("BUCKET"), m.group("OBJECT"));
   }
@@ -202,10 +202,9 @@ public class GcsPath implements Path {
     if (bucket == null) {
       bucket = "";
     }
-    Preconditions.checkArgument(!bucket.contains("/"),
+    checkArgument(!bucket.contains("/"),
         "GCS bucket may not contain a slash");
-    Preconditions
-        .checkArgument(bucket.isEmpty()
+    checkArgument(bucket.isEmpty()
                 || bucket.matches("[a-z0-9][-_a-z0-9.]+[a-z0-9]"),
             "GCS bucket names must contain only lowercase letters, numbers, "
                 + "dashes (-), underscores (_), and dots (.). Bucket names "
@@ -216,7 +215,7 @@ public class GcsPath implements Path {
     if (object == null) {
       object = "";
     }
-    Preconditions.checkArgument(
+    checkArgument(
         object.indexOf('\n') < 0 && object.indexOf('\r') < 0,
         "GCS object names must not contain Carriage Return or "
             + "Line Feed characters.");
@@ -318,32 +317,32 @@ public class GcsPath implements Path {
 
   @Override
   public GcsPath getName(int count) {
-    Preconditions.checkArgument(count >= 0);
+    checkArgument(count >= 0);
 
     Iterator<Path> iterator = iterator();
     for (int i = 0; i < count; ++i) {
-      Preconditions.checkArgument(iterator.hasNext());
+      checkArgument(iterator.hasNext());
       iterator.next();
     }
 
-    Preconditions.checkArgument(iterator.hasNext());
+    checkArgument(iterator.hasNext());
     return (GcsPath) iterator.next();
   }
 
   @Override
   public GcsPath subpath(int beginIndex, int endIndex) {
-    Preconditions.checkArgument(beginIndex >= 0);
-    Preconditions.checkArgument(endIndex > beginIndex);
+    checkArgument(beginIndex >= 0);
+    checkArgument(endIndex > beginIndex);
 
     Iterator<Path> iterator = iterator();
     for (int i = 0; i < beginIndex; ++i) {
-      Preconditions.checkArgument(iterator.hasNext());
+      checkArgument(iterator.hasNext());
       iterator.next();
     }
 
     GcsPath path = null;
     while (beginIndex < endIndex) {
-      Preconditions.checkArgument(iterator.hasNext());
+      checkArgument(iterator.hasNext());
       if (path == null) {
         path = (GcsPath) iterator.next();
       } else {
@@ -492,7 +491,7 @@ public class GcsPath implements Path {
 
     @Override
     public boolean hasNext() {
-      return !Strings.isNullOrEmpty(name);
+      return !isNullOrEmpty(name);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateMerging.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateMerging.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateMerging.java
index b02f01d..843933f 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateMerging.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateMerging.java
@@ -17,9 +17,9 @@
  */
 package org.apache.beam.sdk.util.state;
 
-import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import static com.google.common.base.Preconditions.checkState;
 
-import com.google.common.base.Preconditions;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
 
 import org.joda.time.Instant;
 
@@ -228,7 +228,7 @@ public class StateMerging {
       // Update directly from window-derived hold.
       Instant hold = result.getOutputTimeFn().assignOutputTime(
           BoundedWindow.TIMESTAMP_MIN_VALUE, resultWindow);
-      Preconditions.checkState(hold.isAfter(BoundedWindow.TIMESTAMP_MIN_VALUE));
+      checkState(hold.isAfter(BoundedWindow.TIMESTAMP_MIN_VALUE));
       result.add(hold);
     } else {
       // Prefetch.

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
index b0ca70b..6f6c4a1 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
@@ -21,7 +21,10 @@ import static org.apache.beam.sdk.TestUtils.checkCombineFn;
 import static org.apache.beam.sdk.transforms.display.DisplayDataMatchers.hasDisplayItem;
 import static org.apache.beam.sdk.transforms.display.DisplayDataMatchers.hasNamespace;
 import static org.apache.beam.sdk.transforms.display.DisplayDataMatchers.includesDisplayDataFrom;
+
+import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
 import static org.hamcrest.Matchers.hasItem;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
@@ -62,7 +65,6 @@ import org.apache.beam.sdk.values.PCollection;
 import org.apache.beam.sdk.values.PCollectionView;
 
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
 
@@ -766,8 +768,7 @@ public class CombineTest implements Serializable {
     public static SetCoder<?> of(
         @JsonProperty(PropertyNames.COMPONENT_ENCODINGS)
         List<Coder<?>> components) {
-      Preconditions.checkArgument(components.size() == 1,
-          "Expecting 1 component, got " + components.size());
+      checkArgument(components.size() == 1, "Expecting 1 component, got %s", components.size());
       return of((Coder<?>) components.get(0));
     }
 
@@ -1094,8 +1095,8 @@ public class CombineTest implements Serializable {
 
       @Override
       public void addInput(Integer element) {
-        Preconditions.checkState(merges == 0);
-        Preconditions.checkState(outputs == 0);
+        checkState(merges == 0);
+        checkState(outputs == 0);
 
         inputs++;
         sum += element;
@@ -1103,8 +1104,8 @@ public class CombineTest implements Serializable {
 
       @Override
       public void mergeAccumulator(Counter accumulator) {
-        Preconditions.checkState(outputs == 0);
-        Preconditions.checkArgument(accumulator.outputs == 0);
+        checkState(outputs == 0);
+        checkArgument(accumulator.outputs == 0);
 
         merges += accumulator.merges + 1;
         inputs += accumulator.inputs;
@@ -1113,7 +1114,7 @@ public class CombineTest implements Serializable {
 
       @Override
       public Iterable<Long> extractOutput() {
-        Preconditions.checkState(outputs == 0);
+        checkState(outputs == 0);
 
         return Arrays.asList(sum, inputs, merges, outputs);
       }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoTest.java
index db32fa6..868270c 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoTest.java
@@ -25,6 +25,7 @@ import static org.apache.beam.sdk.util.SerializableUtils.serializeToByteArray;
 import static org.apache.beam.sdk.util.StringUtils.byteArrayToJsonString;
 import static org.apache.beam.sdk.util.StringUtils.jsonStringToByteArray;
 
+import static com.google.common.base.Preconditions.checkNotNull;
 import static org.hamcrest.Matchers.allOf;
 import static org.hamcrest.Matchers.anyOf;
 import static org.hamcrest.Matchers.equalTo;
@@ -57,8 +58,6 @@ import org.apache.beam.sdk.values.TimestampedValue;
 import org.apache.beam.sdk.values.TupleTag;
 import org.apache.beam.sdk.values.TupleTagList;
 
-import com.google.common.base.Preconditions;
-
 import com.fasterxml.jackson.annotation.JsonCreator;
 
 import org.joda.time.Duration;
@@ -292,7 +291,7 @@ public class ParDoTest implements Serializable {
     @Override
     public void processElement(ProcessContext c) {
       Instant timestamp = c.timestamp();
-      Preconditions.checkNotNull(timestamp);
+      checkNotNull(timestamp);
       Integer value = c.element();
       c.outputWithTimestamp(value, timestamp.plus(durationToShift));
     }
@@ -301,7 +300,7 @@ public class ParDoTest implements Serializable {
   static class TestFormatTimestampDoFn extends DoFn<Integer, String> {
     @Override
     public void processElement(ProcessContext c) {
-      Preconditions.checkNotNull(c.timestamp());
+      checkNotNull(c.timestamp());
       c.output("processing: " + c.element() + ", timestamp: " + c.timestamp().getMillis());
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java
index 4cc0c9b..fe02573 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java
@@ -20,6 +20,8 @@ package org.apache.beam.sdk.transforms;
 import static org.apache.beam.sdk.TestUtils.LINES;
 import static org.apache.beam.sdk.TestUtils.NO_LINES;
 import static org.apache.beam.sdk.transforms.display.DisplayDataMatchers.hasDisplayItem;
+
+import static com.google.common.base.Preconditions.checkArgument;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -35,7 +37,6 @@ import org.apache.beam.sdk.transforms.display.DisplayData;
 import org.apache.beam.sdk.values.PCollection;
 
 import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
 
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -219,8 +220,7 @@ public class SampleTest {
   }
 
   void runPickAnyTest(final List<String> lines, int limit) {
-    Preconditions.checkArgument(new HashSet<String>(lines).size() == lines.size(),
-        "Duplicates are unsupported.");
+    checkArgument(new HashSet<String>(lines).size() == lines.size(), "Duplicates are
unsupported.");
     Pipeline p = TestPipeline.create();
 
     PCollection<String> input = p.apply(Create.of(lines)

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ViewTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ViewTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ViewTest.java
index 5e6e6a3..738b492 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ViewTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ViewTest.java
@@ -17,6 +17,7 @@
  */
 package org.apache.beam.sdk.transforms;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static org.hamcrest.Matchers.isA;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -49,7 +50,6 @@ import org.apache.beam.sdk.values.PCollectionView;
 import org.apache.beam.sdk.values.TimestampedValue;
 import org.apache.beam.sdk.values.TypeDescriptor;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
 import org.hamcrest.Matchers;
@@ -204,8 +204,8 @@ public class ViewTest implements Serializable {
             .apply("OutputSideInputs", ParDo.withSideInputs(view).of(new DoFn<Integer,
Integer>() {
               @Override
               public void processElement(ProcessContext c) {
-                Preconditions.checkArgument(c.sideInput(view).size() == 4);
-                Preconditions.checkArgument(c.sideInput(view).get(0) == c.sideInput(view).get(0));
+                checkArgument(c.sideInput(view).size() == 4);
+                checkArgument(c.sideInput(view).get(0) == c.sideInput(view).get(0));
                 for (Integer i : c.sideInput(view)) {
                   c.output(i);
                 }
@@ -243,8 +243,8 @@ public class ViewTest implements Serializable {
             .apply("OutputSideInputs", ParDo.withSideInputs(view).of(new DoFn<Integer,
Integer>() {
               @Override
               public void processElement(ProcessContext c) {
-                Preconditions.checkArgument(c.sideInput(view).size() == 4);
-                Preconditions.checkArgument(c.sideInput(view).get(0) == c.sideInput(view).get(0));
+                checkArgument(c.sideInput(view).size() == 4);
+                checkArgument(c.sideInput(view).get(0) == c.sideInput(view).get(0));
                 for (Integer i : c.sideInput(view)) {
                   c.output(i);
                 }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/core/src/test/java/org/apache/beam/sdk/util/TriggerTester.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/util/TriggerTester.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/util/TriggerTester.java
index 715d3ef..b321c8f 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/util/TriggerTester.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/util/TriggerTester.java
@@ -42,7 +42,6 @@ import org.apache.beam.sdk.util.state.WatermarkHoldState;
 import org.apache.beam.sdk.values.TimestampedValue;
 
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
@@ -487,7 +486,7 @@ public class TriggerTester<InputT, W extends BoundedWindow> {
 
     @Override
     public Instant currentInputWatermarkTime() {
-      return Preconditions.checkNotNull(inputWatermarkTime);
+      return checkNotNull(inputWatermarkTime);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/extensions/join-library/src/main/java/org/apache/beam/sdk/extensions/joinlibrary/Join.java
----------------------------------------------------------------------
diff --git a/sdks/java/extensions/join-library/src/main/java/org/apache/beam/sdk/extensions/joinlibrary/Join.java
b/sdks/java/extensions/join-library/src/main/java/org/apache/beam/sdk/extensions/joinlibrary/Join.java
index 968a613..72abaea 100644
--- a/sdks/java/extensions/join-library/src/main/java/org/apache/beam/sdk/extensions/joinlibrary/Join.java
+++ b/sdks/java/extensions/join-library/src/main/java/org/apache/beam/sdk/extensions/joinlibrary/Join.java
@@ -17,6 +17,8 @@
  */
 package org.apache.beam.sdk.extensions.joinlibrary;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import org.apache.beam.sdk.coders.KvCoder;
 import org.apache.beam.sdk.transforms.DoFn;
 import org.apache.beam.sdk.transforms.ParDo;
@@ -26,7 +28,6 @@ import org.apache.beam.sdk.transforms.join.KeyedPCollectionTuple;
 import org.apache.beam.sdk.values.KV;
 import org.apache.beam.sdk.values.PCollection;
 import org.apache.beam.sdk.values.TupleTag;
-import com.google.common.base.Preconditions;
 
 /**
  * Utility class with different versions of joins. All methods join two collections of
@@ -46,8 +47,8 @@ public class Join {
    */
   public static <K, V1, V2> PCollection<KV<K, KV<V1, V2>>> innerJoin(
     final PCollection<KV<K, V1>> leftCollection, final PCollection<KV<K,
V2>> rightCollection) {
-    Preconditions.checkNotNull(leftCollection);
-    Preconditions.checkNotNull(rightCollection);
+    checkNotNull(leftCollection);
+    checkNotNull(rightCollection);
 
     final TupleTag<V1> v1Tuple = new TupleTag<>();
     final TupleTag<V2> v2Tuple = new TupleTag<>();
@@ -94,9 +95,9 @@ public class Join {
     final PCollection<KV<K, V1>> leftCollection,
     final PCollection<KV<K, V2>> rightCollection,
     final V2 nullValue) {
-    Preconditions.checkNotNull(leftCollection);
-    Preconditions.checkNotNull(rightCollection);
-    Preconditions.checkNotNull(nullValue);
+    checkNotNull(leftCollection);
+    checkNotNull(rightCollection);
+    checkNotNull(nullValue);
 
     final TupleTag<V1> v1Tuple = new TupleTag<>();
     final TupleTag<V2> v2Tuple = new TupleTag<>();
@@ -147,9 +148,9 @@ public class Join {
     final PCollection<KV<K, V1>> leftCollection,
     final PCollection<KV<K, V2>> rightCollection,
     final V1 nullValue) {
-    Preconditions.checkNotNull(leftCollection);
-    Preconditions.checkNotNull(rightCollection);
-    Preconditions.checkNotNull(nullValue);
+    checkNotNull(leftCollection);
+    checkNotNull(rightCollection);
+    checkNotNull(nullValue);
 
     final TupleTag<V1> v1Tuple = new TupleTag<>();
     final TupleTag<V2> v2Tuple = new TupleTag<>();

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8b8615ea/sdks/java/io/hdfs/src/main/java/org/apache/beam/sdk/io/hdfs/HDFSFileSource.java
----------------------------------------------------------------------
diff --git a/sdks/java/io/hdfs/src/main/java/org/apache/beam/sdk/io/hdfs/HDFSFileSource.java
b/sdks/java/io/hdfs/src/main/java/org/apache/beam/sdk/io/hdfs/HDFSFileSource.java
index 41a271c..7a0545d 100644
--- a/sdks/java/io/hdfs/src/main/java/org/apache/beam/sdk/io/hdfs/HDFSFileSource.java
+++ b/sdks/java/io/hdfs/src/main/java/org/apache/beam/sdk/io/hdfs/HDFSFileSource.java
@@ -17,6 +17,9 @@
  */
 package org.apache.beam.sdk.io.hdfs;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import org.apache.beam.sdk.coders.Coder;
 import org.apache.beam.sdk.coders.KvCoder;
 import org.apache.beam.sdk.coders.VoidCoder;
@@ -24,10 +27,11 @@ import org.apache.beam.sdk.io.BoundedSource;
 import org.apache.beam.sdk.io.Read;
 import org.apache.beam.sdk.options.PipelineOptions;
 import org.apache.beam.sdk.values.KV;
+
 import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.Path;
@@ -41,6 +45,7 @@ import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.TaskAttemptID;
 import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
 import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
+
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -50,6 +55,7 @@ import java.lang.reflect.Method;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
+
 import javax.annotation.Nullable;
 
 /**
@@ -165,14 +171,10 @@ public class HDFSFileSource<K, V> extends BoundedSource<KV<K,
V>> {
 
   @Override
   public void validate() {
-    Preconditions.checkNotNull(filepattern,
-        "need to set the filepattern of a HDFSFileSource");
-    Preconditions.checkNotNull(formatClass,
-        "need to set the format class of a HDFSFileSource");
-    Preconditions.checkNotNull(keyClass,
-        "need to set the key class of a HDFSFileSource");
-    Preconditions.checkNotNull(valueClass,
-        "need to set the value class of a HDFSFileSource");
+    checkNotNull(filepattern, "need to set the filepattern of a HDFSFileSource");
+    checkNotNull(formatClass, "need to set the format class of a HDFSFileSource");
+    checkNotNull(keyClass, "need to set the key class of a HDFSFileSource");
+    checkNotNull(valueClass, "need to set the value class of a HDFSFileSource");
   }
 
   @Override
@@ -467,8 +469,7 @@ public class HDFSFileSource<K, V> extends BoundedSource<KV<K,
V>> {
     }
 
     public SerializableSplit(InputSplit split) {
-      Preconditions.checkArgument(split instanceof Writable, "Split is not writable: "
-          + split);
+      checkArgument(split instanceof Writable, "Split is not writable: %s", split);
       this.split = split;
     }
 



Mime
View raw message