diff --git a/bin/configure-sqoop b/bin/configure-sqoop index fef48e86..3cf71d53 100755 --- a/bin/configure-sqoop +++ b/bin/configure-sqoop @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Licensed to Cloudera, Inc. under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/bin/sqoop b/bin/sqoop index d374d916..02b06e62 100755 --- a/bin/sqoop +++ b/bin/sqoop @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Licensed to Cloudera, Inc. under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/src/java/com/cloudera/sqoop/lib/RecordParser.java b/src/java/com/cloudera/sqoop/lib/RecordParser.java index 2864dd3b..da42be86 100644 --- a/src/java/com/cloudera/sqoop/lib/RecordParser.java +++ b/src/java/com/cloudera/sqoop/lib/RecordParser.java @@ -156,6 +156,8 @@ public List parseRecord(ByteBuffer input) throws ParseError { return parseRecord(input.asCharBuffer()); } + // TODO(aaron): Refactor this method to be much shorter. + // CHECKSTYLE:OFF /** * Return a list of strings representing the fields of the input line. * This list is backed by an internal buffer which is cleared by the @@ -236,6 +238,7 @@ record sep halts processing. state = ParseState.UNENCLOSED_ESCAPE; } else if (fieldDelim == curChar) { // we have a zero-length field. This is a no-op. + continue; } else if (recordDelim == curChar) { // we have a zero-length field, that ends processing. pos = len; @@ -337,6 +340,7 @@ record sep halts processing. return outputs; } + // CHECKSTYLE:ON public boolean isEnclosingRequired() { return delimiters.isEncloseRequired(); diff --git a/src/java/com/cloudera/sqoop/manager/DirectPostgresqlManager.java b/src/java/com/cloudera/sqoop/manager/DirectPostgresqlManager.java index 24aacab4..be766d3f 100644 --- a/src/java/com/cloudera/sqoop/manager/DirectPostgresqlManager.java +++ b/src/java/com/cloudera/sqoop/manager/DirectPostgresqlManager.java @@ -275,6 +275,8 @@ private String writePasswordFile(String password) throws IOException { return tempFile.toString(); } + // TODO(aaron): Refactor this method to be much shorter. + // CHECKSTYLE:OFF @Override /** * Import the table into HDFS by using psql to pull the data out of the db @@ -460,4 +462,5 @@ public void importTable(ImportJobContext context) LOG.info("Transferred " + counters.toString()); } } + // CHECKSTYLE:ON } diff --git a/src/java/com/cloudera/sqoop/manager/OracleManager.java b/src/java/com/cloudera/sqoop/manager/OracleManager.java index c5780aab..46c82f0d 100644 --- a/src/java/com/cloudera/sqoop/manager/OracleManager.java +++ b/src/java/com/cloudera/sqoop/manager/OracleManager.java @@ -275,7 +275,8 @@ private void setSessionTimeZone(Connection conn) throws SQLException { LOG.info("Setting default time zone: GMT"); try { // Per the documentation at: - // http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14225/applocaledata.htm#i637736 + // http://download-west.oracle.com/docs/cd/B19306_01 + // /server.102/b14225/applocaledata.htm#i637736 // The "GMT" timezone is guaranteed to exist in the available timezone // regions, whereas others (e.g., "UTC") are not. method.invoke(conn, "GMT"); diff --git a/src/java/com/cloudera/sqoop/mapreduce/DataDrivenImportJob.java b/src/java/com/cloudera/sqoop/mapreduce/DataDrivenImportJob.java index 3d0bb48a..24e6748b 100644 --- a/src/java/com/cloudera/sqoop/mapreduce/DataDrivenImportJob.java +++ b/src/java/com/cloudera/sqoop/mapreduce/DataDrivenImportJob.java @@ -78,7 +78,8 @@ protected void configureMapper(Job job, String tableName, protected Class getMapperClass() { if (options.getFileLayout() == SqoopOptions.FileLayout.TextFile) { return TextImportMapper.class; - } else if (options.getFileLayout() == SqoopOptions.FileLayout.SequenceFile) { + } else if (options.getFileLayout() + == SqoopOptions.FileLayout.SequenceFile) { return SequenceFileImportMapper.class; } @@ -91,7 +92,8 @@ protected Class getOutputFormatClass() if (options.getFileLayout() == SqoopOptions.FileLayout.TextFile) { return (Class) ShimLoader.getShimClass( "com.cloudera.sqoop.mapreduce.RawKeyTextOutputFormat"); - } else if (options.getFileLayout() == SqoopOptions.FileLayout.SequenceFile) { + } else if (options.getFileLayout() + == SqoopOptions.FileLayout.SequenceFile) { return SequenceFileOutputFormat.class; } diff --git a/src/java/com/cloudera/sqoop/mapreduce/MySQLDumpMapper.java b/src/java/com/cloudera/sqoop/mapreduce/MySQLDumpMapper.java index a158388c..4a5321d4 100644 --- a/src/java/com/cloudera/sqoop/mapreduce/MySQLDumpMapper.java +++ b/src/java/com/cloudera/sqoop/mapreduce/MySQLDumpMapper.java @@ -305,6 +305,8 @@ public void run() { } } + // TODO(aaron): Refactor this method to be much shorter. + // CHECKSTYLE:OFF /** * Import the table into HDFS by using mysqldump to pull out the data from * the database and upload the files directly to HDFS. @@ -483,6 +485,7 @@ public void map(String splitConditions, NullWritable val, Context context) LOG.info("Transferred " + counters.toString()); } } + // CHECKSTYLE:ON @Override protected void setup(Context context) { diff --git a/src/test/checkstyle.xml b/src/test/checkstyle.xml index ad174a80..aa5eae7c 100644 --- a/src/test/checkstyle.xml +++ b/src/test/checkstyle.xml @@ -205,5 +205,10 @@ --> + + + + + diff --git a/src/test/com/cloudera/sqoop/manager/OracleManagerTest.java b/src/test/com/cloudera/sqoop/manager/OracleManagerTest.java index 09efff2a..96f4e1b2 100644 --- a/src/test/com/cloudera/sqoop/manager/OracleManagerTest.java +++ b/src/test/com/cloudera/sqoop/manager/OracleManagerTest.java @@ -245,7 +245,8 @@ public void testOracleImport() throws IOException { // columns as DATE in Oracle, they may still contain time information, so // the JDBC drivers lie to us and will never tell us we have a strict DATE // type. Thus we include HH:MM:SS.mmmmm below. - // See http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html#08_01 + // See http://www.oracle.com + // /technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html#08_01 String [] expectedResults = { "1,Aaron,2009-05-14 00:00:00.0,1000000,engineering," + "2009-12-29 12:00:00.0,2009-12-29 12:00:00.0", diff --git a/src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java b/src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java index a47d8f57..1237b35e 100644 --- a/src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java +++ b/src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java @@ -62,10 +62,10 @@ */ public abstract class ManagerCompatTestCase extends ImportJobTestCase { - public Log LOG; + private Log log; public ManagerCompatTestCase() { - this.LOG = LogFactory.getLog(ManagerCompatTestCase.class.getName()); + this.log = LogFactory.getLog(ManagerCompatTestCase.class.getName()); } /** @@ -94,7 +94,7 @@ protected boolean useHsqldbTestServer() { @Override public void setUp() { - LOG = getLogger(); + log = getLogger(); skipped = false; super.setUp(); } @@ -105,7 +105,7 @@ public void tearDown() { // Clean up the database on our way out. dropTableIfExists(getTableName()); } catch (SQLException e) { - LOG.warn("Error trying to drop table '" + getTableName() + log.warn("Error trying to drop table '" + getTableName() + "' on tearDown: " + e); } super.tearDown(); @@ -615,7 +615,7 @@ public void testNullInt() { @Test public void testBoolean() { if (!supportsBoolean()) { - LOG.info("Skipping boolean test (unsupported)"); + log.info("Skipping boolean test (unsupported)"); skipped = true; return; } @@ -625,7 +625,7 @@ public void testBoolean() { @Test public void testBoolean2() { if (!supportsBoolean()) { - LOG.info("Skipping boolean test (unsupported)"); + log.info("Skipping boolean test (unsupported)"); skipped = true; return; } @@ -635,7 +635,7 @@ public void testBoolean2() { @Test public void testBoolean3() { if (!supportsBoolean()) { - LOG.info("Skipping boolean test (unsupported)"); + log.info("Skipping boolean test (unsupported)"); skipped = true; return; } @@ -646,7 +646,7 @@ public void testBoolean3() { @Test public void testTinyInt1() { if (!supportsTinyInt()) { - LOG.info("Skipping tinyint test (unsupported)"); + log.info("Skipping tinyint test (unsupported)"); skipped = true; return; } @@ -656,7 +656,7 @@ public void testTinyInt1() { @Test public void testTinyInt2() { if (!supportsTinyInt()) { - LOG.info("Skipping tinyint test (unsupported)"); + log.info("Skipping tinyint test (unsupported)"); skipped = true; return; } @@ -676,7 +676,7 @@ public void testSmallInt2() { @Test public void testBigInt1() { if (!supportsBigInt()) { - LOG.info("Skipping bigint test (unsupported)"); + log.info("Skipping bigint test (unsupported)"); skipped = true; return; } @@ -743,7 +743,7 @@ public void testDate3() { @Test public void testTime1() { if (!supportsTime()) { - LOG.info("Skipping time test (unsupported)"); + log.info("Skipping time test (unsupported)"); skipped = true; return; } @@ -753,7 +753,7 @@ public void testTime1() { @Test public void testTime2() { if (!supportsTime()) { - LOG.info("Skipping time test (unsupported)"); + log.info("Skipping time test (unsupported)"); skipped = true; return; } @@ -763,7 +763,7 @@ public void testTime2() { @Test public void testTime3() { if (!supportsTime()) { - LOG.info("Skipping time test (unsupported)"); + log.info("Skipping time test (unsupported)"); skipped = true; return; } @@ -773,7 +773,7 @@ public void testTime3() { @Test public void testTime4() { if (!supportsTime()) { - LOG.info("Skipping time test (unsupported)"); + log.info("Skipping time test (unsupported)"); skipped = true; return; } @@ -791,23 +791,23 @@ public void testTimestamp1() { @Test public void testTimestamp2() { try { - LOG.debug("Beginning testTimestamp2"); + log.debug("Beginning testTimestamp2"); verifyType(getTimestampType(), getTimestampInsertStr("'2009-04-24 18:24:00.0002'"), getTimestampDbOutput("2009-04-24 18:24:00.0002"), getTimestampSeqOutput("2009-04-24 18:24:00.0002")); } finally { - LOG.debug("End testTimestamp2"); + log.debug("End testTimestamp2"); } } @Test public void testTimestamp3() { try { - LOG.debug("Beginning testTimestamp3"); + log.debug("Beginning testTimestamp3"); verifyType(getTimestampType(), "null", null); } finally { - LOG.debug("End testTimestamp3"); + log.debug("End testTimestamp3"); } } @@ -905,7 +905,7 @@ public void testDecimal6() { @Test public void testLongVarChar() { if (!supportsLongVarChar()) { - LOG.info("Skipping long varchar test (unsupported)"); + log.info("Skipping long varchar test (unsupported)"); skipped = true; return; } @@ -942,7 +942,7 @@ protected void verifyBlob(String insertVal, byte [] returnVal, assertTrue("Expected at least one row returned", results.next()); Blob blob = results.getBlob(2); byte [] databaseBytes = blob.getBytes(1, (int) blob.length()); - LOG.info("Verifying readback of bytes from " + getTableName()); + log.info("Verifying readback of bytes from " + getTableName()); assertEquals("byte arrays differ in size", returnVal.length, databaseBytes.length); @@ -977,7 +977,7 @@ protected void verifyBlob(String insertVal, byte [] returnVal, @Test public void testClob1() { if (!supportsClob()) { - LOG.info("Skipping CLOB test; database does not support CLOB"); + log.info("Skipping CLOB test; database does not support CLOB"); return; } @@ -989,7 +989,7 @@ public void testClob1() { @Test public void testBlob1() { if (!supportsBlob()) { - LOG.info("Skipping BLOB test; database does not support BLOB"); + log.info("Skipping BLOB test; database does not support BLOB"); return; }