You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ja...@apache.org on 2015/08/19 17:07:09 UTC

sqoop git commit: SQOOP-2501: Sqoop2: Findbugs: Fix smaller-ish warnings in common-test module

Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 242146581 -> 45e1871d2


SQOOP-2501: Sqoop2: Findbugs: Fix smaller-ish warnings in common-test module

(Colin Ma via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/45e1871d
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/45e1871d
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/45e1871d

Branch: refs/heads/sqoop2
Commit: 45e1871d2fa0d45860f7c12f5b4edcdb79e83b1c
Parents: 2421465
Author: Jarek Jarcec Cecho <ja...@apache.org>
Authored: Wed Aug 19 08:06:44 2015 -0700
Committer: Jarek Jarcec Cecho <ja...@apache.org>
Committed: Wed Aug 19 08:06:44 2015 -0700

----------------------------------------------------------------------
 .../common/test/db/types/DefaultTypeList.java   | 10 +--
 .../common/test/db/types/DerbyTypeList.java     | 72 ++++++++++----------
 .../common/test/db/types/MySQLTypeList.java     | 40 +++++------
 .../sqoop/common/test/kafka/KafkaConsumer.java  |  2 +-
 .../common/test/kafka/KafkaRealRunner.java      |  4 +-
 .../sqoop/common/test/utils/NetworkUtils.java   |  2 +-
 6 files changed, 65 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/45e1871d/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java
index 9abf243..f92403d 100644
--- a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java
@@ -28,11 +28,11 @@ public class DefaultTypeList extends DatabaseTypeList {
 
     // Integer type
     add(DatabaseType.builder("INT")
-        .addExample("-32768", new Integer(-32768), "-32768")
-        .addExample("-1", new Integer(-1), "-1")
-        .addExample("0", new Integer(0), "0")
-        .addExample("1", new Integer(1), "1")
-        .addExample("32767", new Integer(32767), "32767")
+        .addExample("-32768", Integer.valueOf(-32768), "-32768")
+        .addExample("-1", Integer.valueOf(-1), "-1")
+        .addExample("0", Integer.valueOf(0), "0")
+        .addExample("1", Integer.valueOf(1), "1")
+        .addExample("32767", Integer.valueOf(32767), "32767")
         .build());
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/45e1871d/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DerbyTypeList.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DerbyTypeList.java b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DerbyTypeList.java
index 1d4445a..642651d 100644
--- a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DerbyTypeList.java
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DerbyTypeList.java
@@ -29,56 +29,56 @@ public class DerbyTypeList extends DatabaseTypeList {
 
     // Numeric types
     add(DatabaseType.builder("SMALLINT")
-      .addExample("-32768", new Integer(-32768), "-32768")
-      .addExample(    "-1",     new Integer(-1),     "-1")
-      .addExample(     "0",      new Integer(0),      "0")
-      .addExample(     "1",      new Integer(1),      "1")
-      .addExample( "32767",  new Integer(32767),  "32767")
+      .addExample("-32768", Integer.valueOf(-32768), "-32768")
+      .addExample(    "-1",     Integer.valueOf(-1),     "-1")
+      .addExample(     "0",      Integer.valueOf(0),      "0")
+      .addExample(     "1",      Integer.valueOf(1),      "1")
+      .addExample( "32767",  Integer.valueOf(32767),  "32767")
       .build());
     add(DatabaseType.builder("INT")
-      .addExample("-2147483648", new Integer(-2147483648), "-2147483648")
-      .addExample(         "-1",          new Integer(-1),          "-1")
-      .addExample(          "0",           new Integer(0),           "0")
-      .addExample(          "1",           new Integer(1),           "1")
-      .addExample( "2147483647",  new Integer(2147483647),  "2147483647")
+      .addExample("-2147483648", Integer.valueOf(-2147483648), "-2147483648")
+      .addExample(         "-1",          Integer.valueOf(-1),          "-1")
+      .addExample(          "0",          Integer.valueOf(0),           "0")
+      .addExample(          "1",          Integer.valueOf(1),           "1")
+      .addExample( "2147483647",  Integer.valueOf(2147483647),  "2147483647")
       .build());
     add(DatabaseType.builder("BIGINT")
-      .addExample("-9223372036854775808", new Long(-9223372036854775808L), "-9223372036854775808")
-      .addExample(                  "-1",                   new Long(-1L),                   "-1")
-      .addExample(                   "0",                    new Long(0L),                    "0")
-      .addExample(                   "1",                    new Long(1L),                    "1")
-      .addExample( "9223372036854775807",  new Long(9223372036854775807L),  "9223372036854775807")
+      .addExample("-9223372036854775808", Long.valueOf(-9223372036854775808L), "-9223372036854775808")
+      .addExample(                  "-1",                   Long.valueOf(-1L),                   "-1")
+      .addExample(                   "0",                    Long.valueOf(0L),                    "0")
+      .addExample(                   "1",                    Long.valueOf(1L),                    "1")
+      .addExample( "9223372036854775807",  Long.valueOf(9223372036854775807L),  "9223372036854775807")
       .build());
 
     // Floating points
     add(DatabaseType.builder("REAL")
-      .addExample("CAST(-3.402E+38 AS REAL)", new Float(-3.402E+38),  "-3.402E38")
-      .addExample( "CAST(3.402E+38 AS REAL)",  new Float(3.402E+38),   "3.402E38")
-      .addExample(                       "0",          new Float(0),        "0.0")
-      .addExample( "CAST(1.175E-37 AS REAL)",  new Float(1.175E-37),  "1.175E-37")
-      .addExample("CAST(-1.175E-37 AS REAL)", new Float(-1.175E-37), "-1.175E-37")
+      .addExample("CAST(-3.402E+38 AS REAL)", Float.valueOf(-3.402E+38f),  "-3.402E38")
+      .addExample( "CAST(3.402E+38 AS REAL)",  Float.valueOf(3.402E+38f),   "3.402E38")
+      .addExample(                       "0",          Float.valueOf(0f),        "0.0")
+      .addExample( "CAST(1.175E-37 AS REAL)",  Float.valueOf(1.175E-37f),  "1.175E-37")
+      .addExample("CAST(-1.175E-37 AS REAL)", Float.valueOf(-1.175E-37f), "-1.175E-37")
       .build());
     add(DatabaseType.builder("DOUBLE")
-      .addExample("-1.79769E+308", new Double(-1.79769E+308), "-1.79769E308")
-      .addExample( "1.79769E+308",  new Double(1.79769E+308),  "1.79769E308")
-      .addExample(            "0",             new Double(0),          "0.0")
-      .addExample(   "2.225E-307",    new Double(2.225E-307),   "2.225E-307")
-      .addExample(  "-2.225E-307",   new Double(-2.225E-307),  "-2.225E-307")
+      .addExample("-1.79769E+308", Double.valueOf(-1.79769E+308), "-1.79769E308")
+      .addExample( "1.79769E+308",  Double.valueOf(1.79769E+308),  "1.79769E308")
+      .addExample(            "0",             Double.valueOf(0),          "0.0")
+      .addExample(   "2.225E-307",    Double.valueOf(2.225E-307),   "2.225E-307")
+      .addExample(  "-2.225E-307",   Double.valueOf(-2.225E-307),  "-2.225E-307")
       .build());
 
     // Fixed point
     add(DatabaseType.builder("DECIMAL(5, 2)")
-      .addExample("-999.99", new BigDecimal(-999.99).setScale(2, RoundingMode.CEILING), "-999.99")
-      .addExample( "-999.9",  new BigDecimal(-999.9).setScale(2,   RoundingMode.FLOOR), "-999.90")
-      .addExample(  "-99.9",   new BigDecimal(-99.9).setScale(2, RoundingMode.CEILING),  "-99.90")
-      .addExample(   "-9.9",    new BigDecimal(-9.9).setScale(2, RoundingMode.CEILING),   "-9.90")
-      .addExample(     "-9",      new BigDecimal(-9).setScale(2, RoundingMode.CEILING),   "-9.00")
-      .addExample(      "0",       new BigDecimal(0).setScale(2, RoundingMode.CEILING),    "0.00")
-      .addExample(      "9",       new BigDecimal(9).setScale(2, RoundingMode.CEILING),    "9.00")
-      .addExample(    "9.9",     new BigDecimal(9.9).setScale(2,   RoundingMode.FLOOR),    "9.90")
-      .addExample(   "99.9",    new BigDecimal(99.9).setScale(2,   RoundingMode.FLOOR),   "99.90")
-      .addExample(  "999.9",   new BigDecimal(999.9).setScale(2, RoundingMode.CEILING),  "999.90")
-      .addExample( "999.99",  new BigDecimal(999.99).setScale(2,   RoundingMode.FLOOR),  "999.99")
+      .addExample("-999.99", BigDecimal.valueOf(-999.99).setScale(2, RoundingMode.CEILING), "-999.99")
+      .addExample( "-999.9",  BigDecimal.valueOf(-999.9).setScale(2,   RoundingMode.FLOOR), "-999.90")
+      .addExample(  "-99.9",   BigDecimal.valueOf(-99.9).setScale(2, RoundingMode.CEILING),  "-99.90")
+      .addExample(   "-9.9",    BigDecimal.valueOf(-9.9).setScale(2, RoundingMode.CEILING),   "-9.90")
+      .addExample(     "-9",      BigDecimal.valueOf(-9).setScale(2, RoundingMode.CEILING),   "-9.00")
+      .addExample(      "0",       BigDecimal.valueOf(0).setScale(2, RoundingMode.CEILING),    "0.00")
+      .addExample(      "9",       BigDecimal.valueOf(9).setScale(2, RoundingMode.CEILING),    "9.00")
+      .addExample(    "9.9",     BigDecimal.valueOf(9.9).setScale(2,   RoundingMode.FLOOR),    "9.90")
+      .addExample(   "99.9",    BigDecimal.valueOf(99.9).setScale(2,   RoundingMode.FLOOR),   "99.90")
+      .addExample(  "999.9",   BigDecimal.valueOf(999.9).setScale(2, RoundingMode.CEILING),  "999.90")
+      .addExample( "999.99",  BigDecimal.valueOf(999.99).setScale(2,   RoundingMode.FLOOR),  "999.99")
       .build());
 
     // Boolean

http://git-wip-us.apache.org/repos/asf/sqoop/blob/45e1871d/common-test/src/main/java/org/apache/sqoop/common/test/db/types/MySQLTypeList.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/MySQLTypeList.java b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/MySQLTypeList.java
index a11872a..a2ac97d 100644
--- a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/MySQLTypeList.java
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/MySQLTypeList.java
@@ -35,34 +35,34 @@ public class MySQLTypeList extends DatabaseTypeList{
 
     // Numeric types
     add(DatabaseType.builder("SMALLINT")
-        .addExample("-32768", new Integer(-32768), "-32768")
-        .addExample("-1", new Integer(-1), "-1")
-        .addExample("0", new Integer(0), "0")
-        .addExample("1", new Integer(1), "1")
-        .addExample("32767", new Integer(32767), "32767")
+        .addExample("-32768", Integer.valueOf(-32768), "-32768")
+        .addExample("-1", Integer.valueOf(-1), "-1")
+        .addExample("0", Integer.valueOf(0), "0")
+        .addExample("1", Integer.valueOf(1), "1")
+        .addExample("32767", Integer.valueOf(32767), "32767")
         .build());
     add(DatabaseType.builder("INT")
-        .addExample("-2147483648", new Integer(-2147483648), "-2147483648")
-        .addExample("-1", new Integer(-1), "-1")
-        .addExample("0", new Integer(0), "0")
-        .addExample("1", new Integer(1), "1")
-        .addExample("2147483647", new Integer(2147483647), "2147483647")
+        .addExample("-2147483648", Integer.valueOf(-2147483648), "-2147483648")
+        .addExample("-1", Integer.valueOf(-1), "-1")
+        .addExample("0", Integer.valueOf(0), "0")
+        .addExample("1", Integer.valueOf(1), "1")
+        .addExample("2147483647", Integer.valueOf(2147483647), "2147483647")
         .build());
     add(DatabaseType.builder("BIGINT")
-        .addExample("-9223372036854775808", new Long(-9223372036854775808L), "-9223372036854775808")
-        .addExample("-1", new Long(-1L), "-1")
-        .addExample("0", new Long(0L), "0")
-        .addExample("1", new Long(1L), "1")
-        .addExample("9223372036854775807", new Long(9223372036854775807L), "9223372036854775807")
+        .addExample("-9223372036854775808", Long.valueOf(-9223372036854775808L), "-9223372036854775808")
+        .addExample("-1", Long.valueOf(-1L), "-1")
+        .addExample("0", Long.valueOf(0L), "0")
+        .addExample("1", Long.valueOf(1L), "1")
+        .addExample("9223372036854775807", Long.valueOf(9223372036854775807L), "9223372036854775807")
         .build());
 
     // Floating points
     add(DatabaseType.builder("DOUBLE")
-        .addExample("-1.79769E+308", new Double(-1.79769E+308), "-1.79769E308")
-        .addExample("1.79769E+308", new Double(1.79769E+308), "1.79769E308")
-        .addExample("0", new Double(0), "0.0")
-        .addExample("2.225E-307", new Double(2.225E-307), "2.225E-307")
-        .addExample("-2.225E-307", new Double(-2.225E-307), "-2.225E-307")
+        .addExample("-1.79769E+308", Double.valueOf(-1.79769E+308), "-1.79769E308")
+        .addExample("1.79769E+308", Double.valueOf(1.79769E+308), "1.79769E308")
+        .addExample("0", Double.valueOf(0), "0.0")
+        .addExample("2.225E-307", Double.valueOf(2.225E-307), "2.225E-307")
+        .addExample("-2.225E-307", Double.valueOf(-2.225E-307), "-2.225E-307")
         .build());
 
     // Boolean

http://git-wip-us.apache.org/repos/asf/sqoop/blob/45e1871d/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaConsumer.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaConsumer.java b/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaConsumer.java
index 78d651b..0b4d309 100644
--- a/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaConsumer.java
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaConsumer.java
@@ -69,7 +69,7 @@ public class KafkaConsumer {
     Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
     for (String topic : topics) {
       // we need only single threaded consumers
-      topicCountMap.put(topic, new Integer(1));
+      topicCountMap.put(topic, Integer.valueOf(1));
     }
     consumerMap = consumer.createMessageStreams(topicCountMap);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/45e1871d/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaRealRunner.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaRealRunner.java b/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaRealRunner.java
index cc9c4fb..b474ca7 100644
--- a/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaRealRunner.java
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/kafka/KafkaRealRunner.java
@@ -32,8 +32,8 @@ public class KafkaRealRunner extends KafkaRunnerBase {
   private static final Logger logger = LoggerFactory.getLogger(KafkaLocalRunner.class);
   private String kafkaServerUrl;
   private String zkConnectionString;
-  private final String KAFKA_SERVER_URL_PROPERTY = "sqoop.kafka.server.url";
-  private final String ZK_CONNECTION_STRING_PROPERTY = "sqoop.kafka.zookeeper.url";
+  private static final String KAFKA_SERVER_URL_PROPERTY = "sqoop.kafka.server.url";
+  private static final String ZK_CONNECTION_STRING_PROPERTY = "sqoop.kafka.zookeeper.url";
 
   public KafkaRealRunner() {
     logger.info("Setting up kafka to point to real cluster");

http://git-wip-us.apache.org/repos/asf/sqoop/blob/45e1871d/common-test/src/main/java/org/apache/sqoop/common/test/utils/NetworkUtils.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/utils/NetworkUtils.java b/common-test/src/main/java/org/apache/sqoop/common/test/utils/NetworkUtils.java
index 7f0f750..e193e50 100644
--- a/common-test/src/main/java/org/apache/sqoop/common/test/utils/NetworkUtils.java
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/utils/NetworkUtils.java
@@ -84,7 +84,7 @@ public class NetworkUtils {
         LOG.debug("Attempt " + (i + 1) + " to access " + hostname + ":" + port);
         new Socket(InetAddress.getByName(hostname), port).close();
         return;
-      } catch (Exception e) {
+      } catch (RuntimeException | IOException e) {
         LOG.debug("Failed to connect to " + hostname + ":" + port, e);
       }