Skip to content

Commit 731635e

Browse files
committed
OMID-171 Fix checkstyle warnings of common module
1 parent 79c2a4a commit 731635e

4 files changed

Lines changed: 17 additions & 11 deletions

File tree

common/src/main/java/org/apache/omid/NetworkUtils.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18+
1819
package org.apache.omid;
1920

21+
import org.slf4j.Logger;
22+
import org.slf4j.LoggerFactory;
23+
2024
import java.net.DatagramSocket;
2125
import java.net.InetAddress;
2226
import java.net.NetworkInterface;
2327
import java.net.SocketException;
2428
import java.util.Collections;
2529
import java.util.Enumeration;
2630

27-
import org.slf4j.Logger;
28-
import org.slf4j.LoggerFactory;
29-
3031
public class NetworkUtils {
3132

3233
private static final Logger LOG = LoggerFactory.getLogger(NetworkUtils.class);
@@ -36,7 +37,7 @@ public class NetworkUtils {
3637

3738
public static String getDefaultNetworkInterface() {
3839

39-
try (DatagramSocket s=new DatagramSocket()) {
40+
try (DatagramSocket s = new DatagramSocket()) {
4041
s.connect(InetAddress.getByAddress(new byte[]{1,1,1,1}), 0);
4142
return NetworkInterface.getByInetAddress(s.getLocalAddress()).getName();
4243
} catch (Exception e) {
@@ -51,13 +52,14 @@ public static String getDefaultNetworkInterface() {
5152
NetworkInterface nextElement = networkInterfaces.nextElement();
5253
String name = nextElement.getDisplayName();
5354
LOG.info("Iterating over network interfaces, found '{}'", name);
54-
boolean hasInet = Collections.list(nextElement.getInetAddresses()).size() > 1; // Checking that inet exists, to avoid taking iBridge
55+
// Checking that inet exists, to avoid taking iBridge
56+
boolean hasInet = Collections.list(nextElement.getInetAddresses()).size() > 1;
5557
if (hasInet && fallBackName == null) {
5658
fallBackName = name;
5759
}
58-
if ((name.startsWith(MAC_TSO_NET_IFACE_PREFIX) && hasInet ) ||
59-
name.startsWith(LINUX_TSO_NET_IFACE_PREFIX)) {
60-
return name;
60+
if ((name.startsWith(MAC_TSO_NET_IFACE_PREFIX) && hasInet )
61+
|| name.startsWith(LINUX_TSO_NET_IFACE_PREFIX)) {
62+
return name;
6163
}
6264
}
6365
if (fallBackName != null) {

common/src/main/java/org/apache/omid/ReflectionHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18+
1819
package org.apache.omid;
1920

2021
import java.lang.reflect.InvocationTargetException;
2122
import java.lang.reflect.Method;
2223

2324
public class ReflectionHelper {
2425

25-
static public <T> Object invokeParameterlessMethod(T theObject, String methodName)
26+
public static <T> Object invokeParameterlessMethod(T theObject, String methodName)
2627
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
2728

2829
Method method = theObject.getClass().getDeclaredMethod(methodName, null);

common/src/main/java/org/apache/omid/YAMLUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18+
1819
package org.apache.omid;
1920

21+
import org.apache.commons.beanutils.BeanUtils;
2022
import org.apache.phoenix.thirdparty.com.google.common.base.Preconditions;
2123
import org.apache.phoenix.thirdparty.com.google.common.io.Resources;
22-
import org.apache.commons.beanutils.BeanUtils;
2324
import org.slf4j.Logger;
2425
import org.slf4j.LoggerFactory;
2526
import org.yaml.snakeyaml.Yaml;
@@ -56,7 +57,8 @@ public void loadSettings(String resourcePath, Object bean) {
5657
@SuppressWarnings("unchecked")
5758
public Map loadSettings(String resourcePath, String defaultResourcePath) throws IOException {
5859
Map defaultSetting = loadAsMap(defaultResourcePath);
59-
Preconditions.checkState(defaultSetting.size() > 0, String.format("Failed to load file '%s' from classpath", defaultResourcePath));
60+
Preconditions.checkState(defaultSetting.size() > 0,
61+
String.format("Failed to load file '%s' from classpath", defaultResourcePath));
6062
if (resourcePath != null) {
6163
Map userSetting = loadAsMap(resourcePath);
6264
defaultSetting.putAll(userSetting);

common/src/main/java/org/apache/omid/zk/ZKUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18+
1819
package org.apache.omid.zk;
1920

2021
import org.apache.curator.RetryPolicy;

0 commit comments

Comments
 (0)