diff --git a/common/src/main/java/org/apache/omid/NetworkUtils.java b/common/src/main/java/org/apache/omid/NetworkUtils.java index d6e1920bb..d25139acc 100644 --- a/common/src/main/java/org/apache/omid/NetworkUtils.java +++ b/common/src/main/java/org/apache/omid/NetworkUtils.java @@ -15,8 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.omid; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.net.DatagramSocket; import java.net.InetAddress; import java.net.NetworkInterface; @@ -24,9 +28,6 @@ import java.util.Collections; import java.util.Enumeration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class NetworkUtils { private static final Logger LOG = LoggerFactory.getLogger(NetworkUtils.class); @@ -36,7 +37,7 @@ public class NetworkUtils { public static String getDefaultNetworkInterface() { - try (DatagramSocket s=new DatagramSocket()) { + try (DatagramSocket s = new DatagramSocket()) { s.connect(InetAddress.getByAddress(new byte[]{1,1,1,1}), 0); return NetworkInterface.getByInetAddress(s.getLocalAddress()).getName(); } catch (Exception e) { @@ -51,13 +52,14 @@ public static String getDefaultNetworkInterface() { NetworkInterface nextElement = networkInterfaces.nextElement(); String name = nextElement.getDisplayName(); LOG.info("Iterating over network interfaces, found '{}'", name); - boolean hasInet = Collections.list(nextElement.getInetAddresses()).size() > 1; // Checking that inet exists, to avoid taking iBridge + // Checking that inet exists, to avoid taking iBridge + boolean hasInet = Collections.list(nextElement.getInetAddresses()).size() > 1; if (hasInet && fallBackName == null) { fallBackName = name; } - if ((name.startsWith(MAC_TSO_NET_IFACE_PREFIX) && hasInet ) || - name.startsWith(LINUX_TSO_NET_IFACE_PREFIX)) { - return name; + if ((name.startsWith(MAC_TSO_NET_IFACE_PREFIX) && hasInet ) + || name.startsWith(LINUX_TSO_NET_IFACE_PREFIX)) { + return name; } } if (fallBackName != null) { diff --git a/common/src/main/java/org/apache/omid/ReflectionHelper.java b/common/src/main/java/org/apache/omid/ReflectionHelper.java index bd1b158fe..3392843ff 100644 --- a/common/src/main/java/org/apache/omid/ReflectionHelper.java +++ b/common/src/main/java/org/apache/omid/ReflectionHelper.java @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.omid; import java.lang.reflect.InvocationTargetException; @@ -22,7 +23,7 @@ public class ReflectionHelper { - static public Object invokeParameterlessMethod(T theObject, String methodName) + public static Object invokeParameterlessMethod(T theObject, String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Method method = theObject.getClass().getDeclaredMethod(methodName, null); diff --git a/common/src/main/java/org/apache/omid/YAMLUtils.java b/common/src/main/java/org/apache/omid/YAMLUtils.java index 7d0522be2..b4dfb0e5a 100644 --- a/common/src/main/java/org/apache/omid/YAMLUtils.java +++ b/common/src/main/java/org/apache/omid/YAMLUtils.java @@ -15,11 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.omid; +import org.apache.commons.beanutils.BeanUtils; import org.apache.phoenix.thirdparty.com.google.common.base.Preconditions; import org.apache.phoenix.thirdparty.com.google.common.io.Resources; -import org.apache.commons.beanutils.BeanUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; @@ -56,7 +57,8 @@ public void loadSettings(String resourcePath, Object bean) { @SuppressWarnings("unchecked") public Map loadSettings(String resourcePath, String defaultResourcePath) throws IOException { Map defaultSetting = loadAsMap(defaultResourcePath); - Preconditions.checkState(defaultSetting.size() > 0, String.format("Failed to load file '%s' from classpath", defaultResourcePath)); + Preconditions.checkState(defaultSetting.size() > 0, + String.format("Failed to load file '%s' from classpath", defaultResourcePath)); if (resourcePath != null) { Map userSetting = loadAsMap(resourcePath); defaultSetting.putAll(userSetting); diff --git a/common/src/main/java/org/apache/omid/zk/ZKUtils.java b/common/src/main/java/org/apache/omid/zk/ZKUtils.java index 9e3d3b4a0..6c4bd71bd 100644 --- a/common/src/main/java/org/apache/omid/zk/ZKUtils.java +++ b/common/src/main/java/org/apache/omid/zk/ZKUtils.java @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.omid.zk; import org.apache.curator.RetryPolicy; diff --git a/common/src/test/java/org/apache/omid/TestReflectionHelper.java b/common/src/test/java/org/apache/omid/TestReflectionHelper.java index 51febad94..eca8ff658 100644 --- a/common/src/test/java/org/apache/omid/TestReflectionHelper.java +++ b/common/src/test/java/org/apache/omid/TestReflectionHelper.java @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.omid; import org.testng.annotations.Test; @@ -27,8 +28,8 @@ public static class TestClass { private final int theNumber; - public TestClass(int aNumber) { - this.theNumber = aNumber; + public TestClass(int number) { + this.theNumber = number; } private int getTheNumber() { diff --git a/common/src/test/java/org/apache/omid/YAMLUtilsTest.java b/common/src/test/java/org/apache/omid/YAMLUtilsTest.java index 73054063a..ecbe05d5e 100644 --- a/common/src/test/java/org/apache/omid/YAMLUtilsTest.java +++ b/common/src/test/java/org/apache/omid/YAMLUtilsTest.java @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.omid; import org.testng.Assert; @@ -26,7 +27,7 @@ public class YAMLUtilsTest { @Test(timeOut = 10_000) - public void testLoadDefaultSettings_setToBean() throws Exception { + public void testLoadDefaultSettings_setToBean() { Map map = new HashMap(); new YAMLUtils().loadSettings("test.yml", "default-test.yml", map); Assert.assertNotNull(map); @@ -36,7 +37,7 @@ public void testLoadDefaultSettings_setToBean() throws Exception { } @Test(timeOut = 10_000) - public void testLoadDefaultSettings_setToBean2() throws Exception { + public void testLoadDefaultSettings_setToBean2() { Map map = new HashMap(); new YAMLUtils().loadSettings("test.yml", map); Assert.assertNotNull(map);