5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-02 18:11:13 +08:00

Eliminate checkstyle warnings.

From: Aaron Kimball <aaron@cloudera.com>

git-svn-id: https://svn.apache.org/repos/asf/incubator/sqoop/trunk@1149909 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Bayer 2011-07-22 20:03:55 +00:00
parent 8db82cd9d1
commit 383e46201c
10 changed files with 47 additions and 28 deletions

View File

@ -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

View File

@ -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

View File

@ -156,6 +156,8 @@ public List<String> 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();

View File

@ -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
}

View File

@ -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");

View File

@ -78,7 +78,8 @@ protected void configureMapper(Job job, String tableName,
protected Class<? extends Mapper> 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<? extends OutputFormat> getOutputFormatClass()
if (options.getFileLayout() == SqoopOptions.FileLayout.TextFile) {
return (Class<? extends OutputFormat>) ShimLoader.getShimClass(
"com.cloudera.sqoop.mapreduce.RawKeyTextOutputFormat");
} else if (options.getFileLayout() == SqoopOptions.FileLayout.SequenceFile) {
} else if (options.getFileLayout()
== SqoopOptions.FileLayout.SequenceFile) {
return SequenceFileOutputFormat.class;
}

View File

@ -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) {

View File

@ -205,5 +205,10 @@
-->
<!-- module name="TodoComment"/ -->
<module name="UpperEll"/>
<module name="FileContentsHolder" />
</module>
<!-- allow warnings to be suppressed -->
<module name="SuppressionCommentFilter" />
</module>

View File

@ -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",

View File

@ -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;
}