5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-16 17:00:53 +08:00

SQOOP-2499: Sqoop2: Findbugs: Fix the problem of URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD for ExampleValue

(Colin Ma via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2015-08-18 09:38:12 -07:00
parent 7ce9f67f71
commit 242146581e
3 changed files with 19 additions and 7 deletions

View File

@ -89,7 +89,7 @@ public String toString() {
String [] ret = new String[values.size()]; String [] ret = new String[values.size()];
int i = 0; int i = 0;
for(ExampleValue value : values) { for(ExampleValue value : values) {
ret[i++] = value.escapedStringValue; ret[i++] = value.getEscapedStringValue();
} }
return ret; return ret;
} }

View File

@ -24,21 +24,33 @@ public class ExampleValue {
/** /**
* Properly escaped value so that it can be used in INSERT statement. * Properly escaped value so that it can be used in INSERT statement.
*/ */
public final String insertStatement; private String insertStatement;
/** /**
* Object value that should be returned from JDBC driver getObject(). * Object value that should be returned from JDBC driver getObject().
*/ */
public final Object objectValue; private Object objectValue;
/** /**
* Escaped string value that will be stored by HDFS connector. * Escaped string value that will be stored by HDFS connector.
*/ */
public final String escapedStringValue; private String escapedStringValue;
public ExampleValue(String insertStatement, Object objectValue, String escapedStringValue) { public ExampleValue(String insertStatement, Object objectValue, String escapedStringValue) {
this.insertStatement = insertStatement; this.insertStatement = insertStatement;
this.objectValue = objectValue; this.objectValue = objectValue;
this.escapedStringValue = escapedStringValue; this.escapedStringValue = escapedStringValue;
} }
public String getInsertStatement() {
return insertStatement;
}
public Object getObjectValue() {
return objectValue;
}
public String getEscapedStringValue() {
return escapedStringValue;
}
} }

View File

@ -78,7 +78,7 @@ public void testFrom() throws Exception {
int i = 1; int i = 1;
for(ExampleValue value: type.values) { for(ExampleValue value: type.values) {
insertRow(false, Integer.toString(i++), value.insertStatement); insertRow(false, Integer.toString(i++), value.getInsertStatement());
} }
// RDBMS link // RDBMS link
@ -152,9 +152,9 @@ public void testTo() throws Exception {
assertEquals(type.values.size(), rowCount()); assertEquals(type.values.size(), rowCount());
for(ExampleValue value : type.values) { for(ExampleValue value : type.values) {
assertRow( assertRow(
new Object[] {"value", value.insertStatement}, new Object[] {"value", value.getInsertStatement()},
false, false,
value.objectValue); value.getObjectValue());
} }
// Clean up testing table // Clean up testing table