mirror of https://github.com/apache/nifi.git
NIFI-3556 Fixed ValidateCsv schema parsing
Fixed schema parsing on comma boundaries. This closes #1570. Signed-off-by: James Wing <jvwing@gmail.com>
This commit is contained in:
parent
27afd2e0cc
commit
37e9c5efc7
|
@ -250,15 +250,17 @@ public class ValidateCsv extends AbstractProcessor {
|
|||
|
||||
private String setProcessor(String remaining, List<CellProcessor> processorsList) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
String inputString = remaining;
|
||||
int i = 0;
|
||||
int opening = 0;
|
||||
int closing = 0;
|
||||
while(buffer.length() != remaining.length()) {
|
||||
while(buffer.length() != inputString.length()) {
|
||||
char c = remaining.charAt(i);
|
||||
i++;
|
||||
|
||||
if(opening == 0 && c == ',') {
|
||||
if(i == 1) {
|
||||
inputString = inputString.substring(1);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -271,4 +271,11 @@ public class TestValidateCsv {
|
|||
runner.assertNotValid();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSchemaCommaBoundary() {
|
||||
final TestRunner runner = TestRunners.newTestRunner(new ValidateCsv());
|
||||
runner.setProperty(ValidateCsv.SCHEMA, "Null(),Null");
|
||||
runner.assertValid();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue