From 5eed335804ccbbb15316e80fb5fb09b36897c69f Mon Sep 17 00:00:00 2001 From: joewitt Date: Thu, 4 Jun 2015 15:34:58 -0400 Subject: [PATCH] NIFI-551 checkstyle mods to provided patch. Main issue was extraneous imports. No biggie. --- .../nifi/processors/kite/AbstractKiteProcessor.java | 3 +-- .../nifi/processors/kite/ConvertJSONToAvro.java | 8 ++++---- .../processors/kite/TestJSONToAvroProcessor.java | 12 +++--------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/AbstractKiteProcessor.java b/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/AbstractKiteProcessor.java index fec823918e..da1c046725 100644 --- a/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/AbstractKiteProcessor.java +++ b/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/AbstractKiteProcessor.java @@ -106,8 +106,7 @@ abstract class AbstractKiteProcessor extends AbstractProcessor { }; /** - * Resolves a {@link Schema} for the given string, either a URI or a JSON - * literal. + * Resolves a {@link Schema} for the given string, either a URI or a JSON literal. */ protected static Schema getSchema(String uriOrLiteral, Configuration conf) { URI uri; diff --git a/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertJSONToAvro.java b/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertJSONToAvro.java index d4cc760354..7969a8f2d3 100644 --- a/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertJSONToAvro.java +++ b/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertJSONToAvro.java @@ -122,7 +122,7 @@ public class ConvertJSONToAvro extends AbstractKiteProcessor { writer.setCodec(CodecFactory.snappyCodec()); try { - successfulRecords = session.write(successfulRecords, new StreamCallback() { + successfulRecords = session.write(successfulRecords, new StreamCallback() { @Override public void process(InputStream in, OutputStream out) throws IOException { FlowFile failedRecords = session.create(); @@ -143,8 +143,8 @@ public class ConvertJSONToAvro extends AbstractKiteProcessor { failedRecords = session.append(failedRecords, new OutputStreamCallback() { @Override public void process(OutputStream out) throws IOException { - out.write((e.getMessage() + " [" + - e.getCause().getMessage() + "]\n").getBytes()); + out.write((e.getMessage() + " [" + + e.getCause().getMessage() + "]\n").getBytes()); } }); errors += 1; @@ -154,7 +154,7 @@ public class ConvertJSONToAvro extends AbstractKiteProcessor { session.adjustCounter("Converted records", written, false /* update only if file transfer is successful */); session.adjustCounter("Conversion errors", errors, - false /* update only if file transfer is successful */); + false /* update only if file transfer is successful */); if (errors > 0L) { getLogger().warn("Failed to convert " + errors + '/' + total + " records from JSON to Avro"); diff --git a/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/test/java/org/apache/nifi/processors/kite/TestJSONToAvroProcessor.java b/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/test/java/org/apache/nifi/processors/kite/TestJSONToAvroProcessor.java index 0b53bc75ef..704d998519 100644 --- a/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/test/java/org/apache/nifi/processors/kite/TestJSONToAvroProcessor.java +++ b/nifi/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/test/java/org/apache/nifi/processors/kite/TestJSONToAvroProcessor.java @@ -18,17 +18,11 @@ */ package org.apache.nifi.processors.kite; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Path; -import java.util.List; import org.apache.avro.Schema; import org.apache.avro.SchemaBuilder; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; import org.junit.Assert; @@ -50,8 +44,8 @@ public class TestJSONToAvroProcessor { + "{\"id\": 10, \"color\": 15.23}\n" + // invalid, color as double "{\"id\": 2, \"color\": \"grey\", \"price\": 12.95 }"; - public static final String FAILURE_CONTENT = "Cannot convert field id [Cannot convert to long: \"120V\"]\n" + - "Cannot convert field color [Cannot convert to string: 15.23]\n"; + public static final String FAILURE_CONTENT = "Cannot convert field id [Cannot convert to long: \"120V\"]\n" + + "Cannot convert field color [Cannot convert to string: 15.23]\n"; @Test public void testBasicConversion() throws IOException { @@ -72,7 +66,7 @@ public class TestJSONToAvroProcessor { runner.assertTransferCount("failure", 1); String failureContent = Bytes.toString(runner.getContentAsByteArray( - runner.getFlowFilesForRelationship("failure").get(0))); + runner.getFlowFilesForRelationship("failure").get(0))); Assert.assertEquals("Should reject an invalid string and double", FAILURE_CONTENT, failureContent); } }