5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-06 18:41:23 +08:00

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

(Colin Ma via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2015-08-19 08:06:44 -07:00
parent 242146581e
commit 45e1871d2f
6 changed files with 65 additions and 65 deletions

View File

@ -28,11 +28,11 @@ public DefaultTypeList() {
// Integer type // Integer type
add(DatabaseType.builder("INT") add(DatabaseType.builder("INT")
.addExample("-32768", new Integer(-32768), "-32768") .addExample("-32768", Integer.valueOf(-32768), "-32768")
.addExample("-1", new Integer(-1), "-1") .addExample("-1", Integer.valueOf(-1), "-1")
.addExample("0", new Integer(0), "0") .addExample("0", Integer.valueOf(0), "0")
.addExample("1", new Integer(1), "1") .addExample("1", Integer.valueOf(1), "1")
.addExample("32767", new Integer(32767), "32767") .addExample("32767", Integer.valueOf(32767), "32767")
.build()); .build());
} }
} }

View File

@ -29,56 +29,56 @@ public DerbyTypeList() {
// Numeric types // Numeric types
add(DatabaseType.builder("SMALLINT") add(DatabaseType.builder("SMALLINT")
.addExample("-32768", new Integer(-32768), "-32768") .addExample("-32768", Integer.valueOf(-32768), "-32768")
.addExample( "-1", new Integer(-1), "-1") .addExample( "-1", Integer.valueOf(-1), "-1")
.addExample( "0", new Integer(0), "0") .addExample( "0", Integer.valueOf(0), "0")
.addExample( "1", new Integer(1), "1") .addExample( "1", Integer.valueOf(1), "1")
.addExample( "32767", new Integer(32767), "32767") .addExample( "32767", Integer.valueOf(32767), "32767")
.build()); .build());
add(DatabaseType.builder("INT") add(DatabaseType.builder("INT")
.addExample("-2147483648", new Integer(-2147483648), "-2147483648") .addExample("-2147483648", Integer.valueOf(-2147483648), "-2147483648")
.addExample( "-1", new Integer(-1), "-1") .addExample( "-1", Integer.valueOf(-1), "-1")
.addExample( "0", new Integer(0), "0") .addExample( "0", Integer.valueOf(0), "0")
.addExample( "1", new Integer(1), "1") .addExample( "1", Integer.valueOf(1), "1")
.addExample( "2147483647", new Integer(2147483647), "2147483647") .addExample( "2147483647", Integer.valueOf(2147483647), "2147483647")
.build()); .build());
add(DatabaseType.builder("BIGINT") add(DatabaseType.builder("BIGINT")
.addExample("-9223372036854775808", new Long(-9223372036854775808L), "-9223372036854775808") .addExample("-9223372036854775808", Long.valueOf(-9223372036854775808L), "-9223372036854775808")
.addExample( "-1", new Long(-1L), "-1") .addExample( "-1", Long.valueOf(-1L), "-1")
.addExample( "0", new Long(0L), "0") .addExample( "0", Long.valueOf(0L), "0")
.addExample( "1", new Long(1L), "1") .addExample( "1", Long.valueOf(1L), "1")
.addExample( "9223372036854775807", new Long(9223372036854775807L), "9223372036854775807") .addExample( "9223372036854775807", Long.valueOf(9223372036854775807L), "9223372036854775807")
.build()); .build());
// Floating points // Floating points
add(DatabaseType.builder("REAL") 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)", Float.valueOf(-3.402E+38f), "-3.402E38")
.addExample( "CAST(3.402E+38 AS REAL)", new Float(3.402E+38), "3.402E38") .addExample( "CAST(3.402E+38 AS REAL)", Float.valueOf(3.402E+38f), "3.402E38")
.addExample( "0", new Float(0), "0.0") .addExample( "0", Float.valueOf(0f), "0.0")
.addExample( "CAST(1.175E-37 AS REAL)", new Float(1.175E-37), "1.175E-37") .addExample( "CAST(1.175E-37 AS REAL)", Float.valueOf(1.175E-37f), "1.175E-37")
.addExample("CAST(-1.175E-37 AS REAL)", new Float(-1.175E-37), "-1.175E-37") .addExample("CAST(-1.175E-37 AS REAL)", Float.valueOf(-1.175E-37f), "-1.175E-37")
.build()); .build());
add(DatabaseType.builder("DOUBLE") add(DatabaseType.builder("DOUBLE")
.addExample("-1.79769E+308", new Double(-1.79769E+308), "-1.79769E308") .addExample("-1.79769E+308", Double.valueOf(-1.79769E+308), "-1.79769E308")
.addExample( "1.79769E+308", new Double(1.79769E+308), "1.79769E308") .addExample( "1.79769E+308", Double.valueOf(1.79769E+308), "1.79769E308")
.addExample( "0", new Double(0), "0.0") .addExample( "0", Double.valueOf(0), "0.0")
.addExample( "2.225E-307", new Double(2.225E-307), "2.225E-307") .addExample( "2.225E-307", Double.valueOf(2.225E-307), "2.225E-307")
.addExample( "-2.225E-307", new Double(-2.225E-307), "-2.225E-307") .addExample( "-2.225E-307", Double.valueOf(-2.225E-307), "-2.225E-307")
.build()); .build());
// Fixed point // Fixed point
add(DatabaseType.builder("DECIMAL(5, 2)") add(DatabaseType.builder("DECIMAL(5, 2)")
.addExample("-999.99", new BigDecimal(-999.99).setScale(2, RoundingMode.CEILING), "-999.99") .addExample("-999.99", BigDecimal.valueOf(-999.99).setScale(2, RoundingMode.CEILING), "-999.99")
.addExample( "-999.9", new BigDecimal(-999.9).setScale(2, RoundingMode.FLOOR), "-999.90") .addExample( "-999.9", BigDecimal.valueOf(-999.9).setScale(2, RoundingMode.FLOOR), "-999.90")
.addExample( "-99.9", new BigDecimal(-99.9).setScale(2, RoundingMode.CEILING), "-99.90") .addExample( "-99.9", BigDecimal.valueOf(-99.9).setScale(2, RoundingMode.CEILING), "-99.90")
.addExample( "-9.9", new BigDecimal(-9.9).setScale(2, RoundingMode.CEILING), "-9.90") .addExample( "-9.9", BigDecimal.valueOf(-9.9).setScale(2, RoundingMode.CEILING), "-9.90")
.addExample( "-9", new BigDecimal(-9).setScale(2, RoundingMode.CEILING), "-9.00") .addExample( "-9", BigDecimal.valueOf(-9).setScale(2, RoundingMode.CEILING), "-9.00")
.addExample( "0", new BigDecimal(0).setScale(2, RoundingMode.CEILING), "0.00") .addExample( "0", BigDecimal.valueOf(0).setScale(2, RoundingMode.CEILING), "0.00")
.addExample( "9", new BigDecimal(9).setScale(2, RoundingMode.CEILING), "9.00") .addExample( "9", BigDecimal.valueOf(9).setScale(2, RoundingMode.CEILING), "9.00")
.addExample( "9.9", new BigDecimal(9.9).setScale(2, RoundingMode.FLOOR), "9.90") .addExample( "9.9", BigDecimal.valueOf(9.9).setScale(2, RoundingMode.FLOOR), "9.90")
.addExample( "99.9", new BigDecimal(99.9).setScale(2, RoundingMode.FLOOR), "99.90") .addExample( "99.9", BigDecimal.valueOf(99.9).setScale(2, RoundingMode.FLOOR), "99.90")
.addExample( "999.9", new BigDecimal(999.9).setScale(2, RoundingMode.CEILING), "999.90") .addExample( "999.9", BigDecimal.valueOf(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.FLOOR), "999.99")
.build()); .build());
// Boolean // Boolean

View File

@ -35,34 +35,34 @@ public MySQLTypeList() {
// Numeric types // Numeric types
add(DatabaseType.builder("SMALLINT") add(DatabaseType.builder("SMALLINT")
.addExample("-32768", new Integer(-32768), "-32768") .addExample("-32768", Integer.valueOf(-32768), "-32768")
.addExample("-1", new Integer(-1), "-1") .addExample("-1", Integer.valueOf(-1), "-1")
.addExample("0", new Integer(0), "0") .addExample("0", Integer.valueOf(0), "0")
.addExample("1", new Integer(1), "1") .addExample("1", Integer.valueOf(1), "1")
.addExample("32767", new Integer(32767), "32767") .addExample("32767", Integer.valueOf(32767), "32767")
.build()); .build());
add(DatabaseType.builder("INT") add(DatabaseType.builder("INT")
.addExample("-2147483648", new Integer(-2147483648), "-2147483648") .addExample("-2147483648", Integer.valueOf(-2147483648), "-2147483648")
.addExample("-1", new Integer(-1), "-1") .addExample("-1", Integer.valueOf(-1), "-1")
.addExample("0", new Integer(0), "0") .addExample("0", Integer.valueOf(0), "0")
.addExample("1", new Integer(1), "1") .addExample("1", Integer.valueOf(1), "1")
.addExample("2147483647", new Integer(2147483647), "2147483647") .addExample("2147483647", Integer.valueOf(2147483647), "2147483647")
.build()); .build());
add(DatabaseType.builder("BIGINT") add(DatabaseType.builder("BIGINT")
.addExample("-9223372036854775808", new Long(-9223372036854775808L), "-9223372036854775808") .addExample("-9223372036854775808", Long.valueOf(-9223372036854775808L), "-9223372036854775808")
.addExample("-1", new Long(-1L), "-1") .addExample("-1", Long.valueOf(-1L), "-1")
.addExample("0", new Long(0L), "0") .addExample("0", Long.valueOf(0L), "0")
.addExample("1", new Long(1L), "1") .addExample("1", Long.valueOf(1L), "1")
.addExample("9223372036854775807", new Long(9223372036854775807L), "9223372036854775807") .addExample("9223372036854775807", Long.valueOf(9223372036854775807L), "9223372036854775807")
.build()); .build());
// Floating points // Floating points
add(DatabaseType.builder("DOUBLE") add(DatabaseType.builder("DOUBLE")
.addExample("-1.79769E+308", new Double(-1.79769E+308), "-1.79769E308") .addExample("-1.79769E+308", Double.valueOf(-1.79769E+308), "-1.79769E308")
.addExample("1.79769E+308", new Double(1.79769E+308), "1.79769E308") .addExample("1.79769E+308", Double.valueOf(1.79769E+308), "1.79769E308")
.addExample("0", new Double(0), "0.0") .addExample("0", Double.valueOf(0), "0.0")
.addExample("2.225E-307", new Double(2.225E-307), "2.225E-307") .addExample("2.225E-307", Double.valueOf(2.225E-307), "2.225E-307")
.addExample("-2.225E-307", new Double(-2.225E-307), "-2.225E-307") .addExample("-2.225E-307", Double.valueOf(-2.225E-307), "-2.225E-307")
.build()); .build());
// Boolean // Boolean

View File

@ -69,7 +69,7 @@ public void initTopicList(List<String> topics) {
Map<String, Integer> topicCountMap = new HashMap<String, Integer>(); Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
for (String topic : topics) { for (String topic : topics) {
// we need only single threaded consumers // we need only single threaded consumers
topicCountMap.put(topic, new Integer(1)); topicCountMap.put(topic, Integer.valueOf(1));
} }
consumerMap = consumer.createMessageStreams(topicCountMap); consumerMap = consumer.createMessageStreams(topicCountMap);
} }

View File

@ -32,8 +32,8 @@ public class KafkaRealRunner extends KafkaRunnerBase {
private static final Logger logger = LoggerFactory.getLogger(KafkaLocalRunner.class); private static final Logger logger = LoggerFactory.getLogger(KafkaLocalRunner.class);
private String kafkaServerUrl; private String kafkaServerUrl;
private String zkConnectionString; private String zkConnectionString;
private final String KAFKA_SERVER_URL_PROPERTY = "sqoop.kafka.server.url"; private static 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 ZK_CONNECTION_STRING_PROPERTY = "sqoop.kafka.zookeeper.url";
public KafkaRealRunner() { public KafkaRealRunner() {
logger.info("Setting up kafka to point to real cluster"); logger.info("Setting up kafka to point to real cluster");

View File

@ -84,7 +84,7 @@ public static void waitForStartUp(String hostname, int port, int numberOfAttempt
LOG.debug("Attempt " + (i + 1) + " to access " + hostname + ":" + port); LOG.debug("Attempt " + (i + 1) + " to access " + hostname + ":" + port);
new Socket(InetAddress.getByName(hostname), port).close(); new Socket(InetAddress.getByName(hostname), port).close();
return; return;
} catch (Exception e) { } catch (RuntimeException | IOException e) {
LOG.debug("Failed to connect to " + hostname + ":" + port, e); LOG.debug("Failed to connect to " + hostname + ":" + port, e);
} }