diff --git a/cdap-api-common/src/main/java/io/cdap/cdap/api/common/Bytes.java b/cdap-api-common/src/main/java/io/cdap/cdap/api/common/Bytes.java index 1ed6ff48dde0..6a13642edf0c 100644 --- a/cdap-api-common/src/main/java/io/cdap/cdap/api/common/Bytes.java +++ b/cdap-api-common/src/main/java/io/cdap/cdap/api/common/Bytes.java @@ -325,8 +325,8 @@ public static String toStringBinary(final byte[] b, int off, int len) { private static boolean isHexDigit(char c) { return - (c >= 'A' && c <= 'F') || - (c >= '0' && c <= '9'); + (c >= 'A' && c <= 'F') + || (c >= '0' && c <= '9'); } /** @@ -362,8 +362,8 @@ public static byte[] toBytesBinary(String in) { char hd2 = in.charAt(i + 3); // they need to be A-F0-9: - if (!isHexDigit(hd1) || - !isHexDigit(hd2)) { + if (!isHexDigit(hd1) + || !isHexDigit(hd2)) { // bogus escape code, ignore: continue; } @@ -828,8 +828,8 @@ public static BigDecimal toBigDecimal(byte[] bytes) { * @return the char value */ public static BigDecimal toBigDecimal(byte[] bytes, int offset, final int length) { - if (bytes == null || length < SIZEOF_INT + 1 || - (offset + length > bytes.length)) { + if (bytes == null || length < SIZEOF_INT + 1 + || (offset + length > bytes.length)) { return null; } @@ -1073,9 +1073,9 @@ enum PureJavaComparer implements Comparer { public int compareTo(byte[] buffer1, int offset1, int length1, byte[] buffer2, int offset2, int length2) { // Short circuit equal case - if (buffer1 == buffer2 && - offset1 == offset2 && - length1 == length2) { + if (buffer1 == buffer2 + && offset1 == offset2 + && length1 == length2) { return 0; } // Bring WritableComparator code local @@ -1140,9 +1140,9 @@ public static boolean equals(@Nullable byte[] left, @Nullable byte[] right) { public static boolean equals(final byte[] left, int leftOffset, int leftLen, final byte[] right, int rightOffset, int rightLen) { // short circuit case - if (left == right && - leftOffset == rightOffset && - leftLen == rightLen) { + if (left == right + && leftOffset == rightOffset + && leftLen == rightLen) { return true; } // different lengths fast check @@ -1169,10 +1169,10 @@ public static boolean equals(final byte[] left, int leftOffset, int leftLen, * Return true if the byte array on the right is a prefix of the byte array on the left. */ public static boolean startsWith(byte[] bytes, byte[] prefix) { - return bytes != null && prefix != null && - bytes.length >= prefix.length && - LexicographicalComparerHolder.BEST_COMPARER. - compareTo(bytes, 0, prefix.length, prefix, 0, prefix.length) == 0; + return bytes != null && prefix != null + && bytes.length >= prefix.length + && LexicographicalComparerHolder.BEST_COMPARER. + compareTo(bytes, 0, prefix.length, prefix, 0, prefix.length) == 0; } /** @@ -1557,8 +1557,8 @@ public static byte[] incrementBytes(byte[] value, long amount) { val.length); val = newvalue; } else if (val.length > SIZEOF_LONG) { - throw new IllegalArgumentException("Increment Bytes - value too big: " + - val.length); + throw new IllegalArgumentException("Increment Bytes - value too big: " + + val.length); } if (amount == 0) { return val; @@ -1630,8 +1630,8 @@ public static void writeStringFixedSize(final DataOutput out, String s, int size) throws IOException { byte[] b = toBytes(s); if (b.length > size) { - throw new IOException("Trying to write " + b.length + " bytes (" + - toStringBinary(b) + ") into a field of length " + size); + throw new IOException("Trying to write " + b.length + " bytes (" + + toStringBinary(b) + ") into a field of length " + size); } out.writeBytes(s); diff --git a/cdap-api-common/src/main/java/io/cdap/cdap/api/data/format/FormatSpecification.java b/cdap-api-common/src/main/java/io/cdap/cdap/api/data/format/FormatSpecification.java index af5cdcc5192b..e828b5485280 100644 --- a/cdap-api-common/src/main/java/io/cdap/cdap/api/data/format/FormatSpecification.java +++ b/cdap-api-common/src/main/java/io/cdap/cdap/api/data/format/FormatSpecification.java @@ -75,9 +75,9 @@ public boolean equals(Object o) { FormatSpecification that = (FormatSpecification) o; - return Objects.equals(name, that.name) && - Objects.equals(schema, that.schema) && - Objects.equals(settings, that.settings); + return Objects.equals(name, that.name) + && Objects.equals(schema, that.schema) + && Objects.equals(settings, that.settings); } @Override diff --git a/cdap-api-common/src/main/java/io/cdap/cdap/internal/io/SQLSchemaParser.java b/cdap-api-common/src/main/java/io/cdap/cdap/internal/io/SQLSchemaParser.java index d706a7494653..72fb5fdd6f9d 100644 --- a/cdap-api-common/src/main/java/io/cdap/cdap/internal/io/SQLSchemaParser.java +++ b/cdap-api-common/src/main/java/io/cdap/cdap/internal/io/SQLSchemaParser.java @@ -196,8 +196,8 @@ private void skipWhitespace() { private String nextToken() { char currChar = schema.charAt(pos); int endPos = pos; - while (!(Character.isWhitespace(currChar) || - currChar == ':' || currChar == ',' || currChar == '<' || currChar == '>')) { + while (!(Character.isWhitespace(currChar) + || currChar == ':' || currChar == ',' || currChar == '<' || currChar == '>')) { endPos++; if (endPos == end) { break; diff --git a/cdap-api-common/src/test/java/io/cdap/cdap/api/data/schema/SchemaWalkerTest.java b/cdap-api-common/src/test/java/io/cdap/cdap/api/data/schema/SchemaWalkerTest.java index 8c6e1799039d..2e127ab542de 100644 --- a/cdap-api-common/src/test/java/io/cdap/cdap/api/data/schema/SchemaWalkerTest.java +++ b/cdap-api-common/src/test/java/io/cdap/cdap/api/data/schema/SchemaWalkerTest.java @@ -105,8 +105,8 @@ public boolean equals(Object o) { return false; } Pair pair = (Pair) o; - return Objects.equals(field, pair.field) && - Objects.equals(schema, pair.schema); + return Objects.equals(field, pair.field) + && Objects.equals(schema, pair.schema); } @Override diff --git a/cdap-api-spark-base/src/main/java/io/cdap/cdap/api/spark/AbstractExtendedSpark.java b/cdap-api-spark-base/src/main/java/io/cdap/cdap/api/spark/AbstractExtendedSpark.java index 32043de0795e..75277954a219 100644 --- a/cdap-api-spark-base/src/main/java/io/cdap/cdap/api/spark/AbstractExtendedSpark.java +++ b/cdap-api-spark-base/src/main/java/io/cdap/cdap/api/spark/AbstractExtendedSpark.java @@ -35,8 +35,8 @@ protected ExtendedSparkConfigurer getConfigurer() { if (!(configurer instanceof ExtendedSparkConfigurer)) { // This shouldn't happen, unless there is bug in app-fabric throw new IllegalStateException( - "Expected the configurer is an instance of " + ExtendedSparkConfigurer.class.getName() + - ", but get " + configurer.getClass().getName() + " instead."); + "Expected the configurer is an instance of " + ExtendedSparkConfigurer.class.getName() + + ", but get " + configurer.getClass().getName() + " instead."); } return (ExtendedSparkConfigurer) configurer; } diff --git a/cdap-api-spark-base/src/main/java/io/cdap/cdap/api/spark/sql/DataFrames.java b/cdap-api-spark-base/src/main/java/io/cdap/cdap/api/spark/sql/DataFrames.java index 7ea251e294c3..7136c5fe9a44 100644 --- a/cdap-api-spark-base/src/main/java/io/cdap/cdap/api/spark/sql/DataFrames.java +++ b/cdap-api-spark-base/src/main/java/io/cdap/cdap/api/spark/sql/DataFrames.java @@ -301,8 +301,8 @@ private static Object toRowValue(@Nullable Object value, DataType dataType, Stri collection = Arrays.asList((Object[]) value); } else { throw new IllegalArgumentException( - "Value type " + value.getClass() + - " is not supported as array type value. It must either be a Collection or an array"); + "Value type " + value.getClass() + + " is not supported as array type value. It must either be a Collection or an array"); } List result = new ArrayList<>(collection.size()); diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/NamespaceSummary.java b/cdap-api/src/main/java/io/cdap/cdap/api/NamespaceSummary.java index 63ed4b74ce93..d203b8fd654c 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/NamespaceSummary.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/NamespaceSummary.java @@ -67,9 +67,9 @@ public boolean equals(Object o) { return false; } NamespaceSummary that = (NamespaceSummary) o; - return generation == that.generation && - Objects.equals(name, that.name) && - Objects.equals(description, that.description); + return generation == that.generation + && Objects.equals(name, that.name) + && Objects.equals(description, that.description); } @Override @@ -79,10 +79,10 @@ public int hashCode() { @Override public String toString() { - return "NamespaceSummary{" + - "name='" + name + '\'' + - ", description='" + description + '\'' + - ", generation=" + generation + - '}'; + return "NamespaceSummary{" + + "name='" + name + '\'' + + ", description='" + description + '\'' + + ", generation=" + generation + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/Resources.java b/cdap-api/src/main/java/io/cdap/cdap/api/Resources.java index f2e15779fff1..14258a32ce20 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/Resources.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/Resources.java @@ -91,9 +91,9 @@ public int hashCode() { @Override public String toString() { - return "Resources{" + - "virtualCores=" + virtualCores + - ", memoryMB=" + memoryMB + - '}'; + return "Resources{" + + "virtualCores=" + virtualCores + + ", memoryMB=" + memoryMB + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ApplicationClass.java b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ApplicationClass.java index 966b05e12518..a76bbc1b322c 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ApplicationClass.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ApplicationClass.java @@ -91,10 +91,10 @@ public boolean equals(Object o) { ApplicationClass that = (ApplicationClass) o; - return Objects.equals(description, that.description) && - Objects.equals(className, that.className) && - Objects.equals(configSchema, that.configSchema) && - Objects.equals(requirements, that.requirements); + return Objects.equals(description, that.description) + && Objects.equals(className, that.className) + && Objects.equals(configSchema, that.configSchema) + && Objects.equals(requirements, that.requirements); } @Override @@ -104,11 +104,11 @@ public int hashCode() { @Override public String toString() { - return "ApplicationClass{" + - "className='" + className + '\'' + - ", description='" + description + '\'' + - ", configSchema=" + configSchema + - ", requirements=" + requirements + - '}'; + return "ApplicationClass{" + + "className='" + className + '\'' + + ", description='" + description + '\'' + + ", configSchema=" + configSchema + + ", requirements=" + requirements + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactClasses.java b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactClasses.java index 7e64334160d2..f64cc717b13c 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactClasses.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactClasses.java @@ -65,8 +65,8 @@ public boolean equals(Object o) { } ArtifactClasses that = (ArtifactClasses) o; - return Objects.equals(apps, that.apps) && - Objects.equals(plugins, that.plugins); + return Objects.equals(apps, that.apps) + && Objects.equals(plugins, that.plugins); } @Override @@ -76,10 +76,10 @@ public int hashCode() { @Override public String toString() { - return "ArtifactClasses{" + - "apps=" + apps + - ", plugins=" + plugins + - '}'; + return "ArtifactClasses{" + + "apps=" + apps + + ", plugins=" + plugins + + '}'; } public static Builder builder() { diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactId.java b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactId.java index e597aeecf28f..66818849e959 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactId.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactId.java @@ -64,11 +64,11 @@ public ArtifactScope getScope() { @Override public String toString() { - return "ArtifactId{" + - "name='" + name + '\'' + - ", version=" + version + - ", scope='" + scope + '\'' + - '}'; + return "ArtifactId{" + + "name='" + name + '\'' + + ", version=" + version + + ", scope='" + scope + '\'' + + '}'; } @Override @@ -81,9 +81,9 @@ public boolean equals(Object o) { } ArtifactId that = (ArtifactId) o; - return Objects.equals(name, that.name) && - Objects.equals(version, that.version) && - Objects.equals(scope, that.scope); + return Objects.equals(name, that.name) + && Objects.equals(version, that.version) + && Objects.equals(scope, that.scope); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactInfo.java b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactInfo.java index 35959a002791..d4f110660e77 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactInfo.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactInfo.java @@ -79,9 +79,9 @@ public boolean equals(Object o) { ArtifactInfo that = (ArtifactInfo) o; - return super.equals(that) && - Objects.equals(classes, that.classes) && - Objects.equals(properties, that.properties); + return super.equals(that) + && Objects.equals(classes, that.classes) + && Objects.equals(properties, that.properties); } @Override @@ -91,12 +91,12 @@ public int hashCode() { @Override public String toString() { - return "ArtifactInfo{" + - "name='" + name + '\'' + - ", version='" + version + '\'' + - ", scope=" + scope + - ", classes=" + classes + - ", properties=" + properties + - '}'; + return "ArtifactInfo{" + + "name='" + name + '\'' + + ", version='" + version + '\'' + + ", scope=" + scope + + ", classes=" + classes + + ", properties=" + properties + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactRange.java b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactRange.java index 48ad881f4bcf..7daded63ea99 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactRange.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactRange.java @@ -73,12 +73,12 @@ public boolean equals(Object o) { ArtifactRange that = (ArtifactRange) o; - return Objects.equals(namespace, that.namespace) && - Objects.equals(name, that.name) && - Objects.equals(lower, that.lower) && - Objects.equals(upper, that.upper) && - isLowerInclusive == that.isLowerInclusive && - isUpperInclusive == that.isUpperInclusive; + return Objects.equals(namespace, that.namespace) + && Objects.equals(name, that.name) + && Objects.equals(lower, that.lower) + && Objects.equals(upper, that.upper) + && isLowerInclusive == that.isLowerInclusive + && isUpperInclusive == that.isUpperInclusive; } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactSummary.java b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactSummary.java index cc671876f472..a61442f69d26 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactSummary.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactSummary.java @@ -102,9 +102,9 @@ public boolean equals(Object o) { ArtifactSummary that = (ArtifactSummary) o; - return Objects.equals(name, that.name) && - Objects.equals(version, that.version) && - Objects.equals(scope, that.scope); + return Objects.equals(name, that.name) + && Objects.equals(version, that.version) + && Objects.equals(scope, that.scope); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactVersionRange.java b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactVersionRange.java index 8dc41a4c529b..0ea1b82d7902 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactVersionRange.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/artifact/ArtifactVersionRange.java @@ -72,11 +72,11 @@ public String getVersionString() { if (isExactVersion()) { return lower.getVersion(); } else { - return (isLowerInclusive ? '[' : '(') + - lower.getVersion() + - ',' + - upper.getVersion() + - (isUpperInclusive ? ']' : ')'); + return (isLowerInclusive ? '[' : '(') + + lower.getVersion() + + ',' + + upper.getVersion() + + (isUpperInclusive ? ']' : ')'); } } @@ -141,8 +141,8 @@ public static ArtifactVersionRange parse(String artifactVersionStr) } else if (comp == 0 && isLowerInclusive && !isUpperInclusive) { // if lower and upper are equal, but lower is inclusive and upper is exclusive, this is also invalid throw new InvalidArtifactRangeException(String.format( - "Invalid version range %s. Lower and upper versions %s are equal, " + - "but lower is inclusive and upper is exclusive.", + "Invalid version range %s. Lower and upper versions %s are equal, " + + "but lower is inclusive and upper is exclusive.", artifactVersionStr, lowerStr)); } return new ArtifactVersionRange(lower, isLowerInclusive, upper, isUpperInclusive); diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/common/RuntimeArguments.java b/cdap-api/src/main/java/io/cdap/cdap/api/common/RuntimeArguments.java index 685da93b5758..9ad1b1b8435c 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/common/RuntimeArguments.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/common/RuntimeArguments.java @@ -101,8 +101,8 @@ public static Map extractScope(Scope scope, String name, * Identifies arguments with a given scope prefix and adds them back without the scope prefix. * * 1. An argument can be prefixed by "<scope>.<name>.". e.g. mapreduce.myMapReduce.read.timeout=30. - * In this case the MapReduce program named 'myMapReduce' will receive two arguments - - * mapreduce.myMapReduce.read.timeout=30 and read.timeout=30. However MapReduce programs other + * In this case the MapReduce program named 'myMapReduce' will receive two arguments + - * mapreduce.myMapReduce.read.timeout=30 and read.timeout=30. However MapReduce programs other * than 'myMapReduce' will receive only one argument - mapreduce.myMapReduce.read.timeout=30 2. An * argument can be prefixed by "<scope>.*.". e.g. mapreduce.*.read.timeout=30. In this case all * the underlying MapReduce programs will receive the arguments mapreduce.*.read.timeout=30 and diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetContext.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetContext.java index f497a9e56da1..dd72db85adfb 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetContext.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetContext.java @@ -41,9 +41,9 @@ public String getNamespaceId() { @Override public String toString() { - return "DatasetContext{" + - "namespaceId='" + namespaceId + '\'' + - '}'; + return "DatasetContext{" + + "namespaceId='" + namespaceId + '\'' + + '}'; } /** diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetProperties.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetProperties.java index 0559c8fdbd71..be207c6b4ace 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetProperties.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetProperties.java @@ -69,10 +69,10 @@ public Map getProperties() { @Override public String toString() { - return "DatasetProperties{" + - "description='" + description + '\'' + - ", properties=" + properties + - '}'; + return "DatasetProperties{" + + "description='" + description + '\'' + + ", properties=" + properties + + '}'; } /** diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetSpecification.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetSpecification.java index 2e4730590f4f..3b118dcb95bd 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetSpecification.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/DatasetSpecification.java @@ -239,12 +239,12 @@ public boolean equals(Object o) { return false; } DatasetSpecification that = (DatasetSpecification) o; - return Objects.equals(name, that.name) && - Objects.equals(type, that.type) && - Objects.equals(description, that.description) && - Objects.equals(originalProperties, that.originalProperties) && - Objects.equals(properties, that.properties) && - Objects.equals(datasetSpecs, that.datasetSpecs); + return Objects.equals(name, that.name) + && Objects.equals(type, that.type) + && Objects.equals(description, that.description) + && Objects.equals(originalProperties, that.originalProperties) + && Objects.equals(properties, that.properties) + && Objects.equals(datasetSpecs, that.datasetSpecs); } @Override @@ -281,14 +281,14 @@ private boolean isParent(String datasetName, DatasetSpecification specification) @Override public String toString() { - return "DatasetSpecification{" + - "name='" + name + '\'' + - ", type='" + type + '\'' + - ", description='" + description + '\'' + - ", originalProperties=" + originalProperties + - ", properties=" + properties + - ", datasetSpecs=" + datasetSpecs + - '}'; + return "DatasetSpecification{" + + "name='" + name + '\'' + + ", type='" + type + '\'' + + ", description='" + description + '\'' + + ", originalProperties=" + originalProperties + + ", properties=" + properties + + ", datasetSpecs=" + datasetSpecs + + '}'; } /** diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/IndexedTable.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/IndexedTable.java index 72671c242f38..afee7c95c35e 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/IndexedTable.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/IndexedTable.java @@ -440,8 +440,8 @@ public boolean compareAndSwap(byte[] row, byte[] column, byte[] expected, byte[] // the index is not affected - just execute the swap. // also, if the swap is on the index column, but the old value // is the same as the new value, then the index is not affected either. - if (!indexedColumns.contains(column) || - Arrays.equals(expected, newValue)) { + if (!indexedColumns.contains(column) + || Arrays.equals(expected, newValue)) { return table.compareAndSwap(row, column, expected, newValue); } @@ -518,9 +518,9 @@ public Row incrementAndGet(byte[] row, byte[][] columns, long[] amounts) { if (existingBytes != null) { if (existingBytes.length != Bytes.SIZEOF_LONG) { throw new NumberFormatException( - "Attempted to increment a value that is not convertible to long," + - " row: " + Bytes.toStringBinary(row) + - " column: " + Bytes.toStringBinary(columns[i])); + "Attempted to increment a value that is not convertible to long," + + " row: " + Bytes.toStringBinary(row) + + " column: " + Bytes.toStringBinary(columns[i])); } existingValue = Bytes.toLong(existingBytes); if (indexedColumns.contains(columns[i])) { diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionFilter.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionFilter.java index e6e031baeb32..5eb2ac43f305 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionFilter.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionFilter.java @@ -269,8 +269,8 @@ public boolean match(V value) { // this should never happen because we make sure that partition keys and filters // match the field types declared for the partitioning. But just to be sure: throw new IllegalArgumentException( - "Incompatible partition filter: condition for field '" + fieldName + - "' is on " + determineClass() + " but partition key value '" + value + "Incompatible partition filter: condition for field '" + fieldName + + "' is on " + determineClass() + " but partition key value '" + value + "' is of " + value.getClass()); } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionKey.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionKey.java index ae229a304be0..56200c1c8605 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionKey.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionKey.java @@ -57,9 +57,9 @@ public String toString() { @Override public boolean equals(Object other) { - return this == other || - (other != null && getClass() == other.getClass() - && getFields().equals(((PartitionKey) other).getFields())); // fields is never null + return this == other + || (other != null && getClass() == other.getClass() + && getFields().equals(((PartitionKey) other).getFields())); // fields is never null } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionedFileSetArguments.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionedFileSetArguments.java index fea34ee718d9..d82495c0f912 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionedFileSetArguments.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/PartitionedFileSetArguments.java @@ -350,8 +350,8 @@ public static boolean isDynamicPartitionerConcurrencyAllowed(Map private static void ensureDynamicPartitionerConfigured(Map args) { if (getDynamicPartitioner(args) == null) { throw new IllegalArgumentException( - "Cannot get or set a setting of DynamicPartitioner, without first setting " + - "a DynamicPartitioner."); + "Cannot get or set a setting of DynamicPartitioner, without first setting " + + "a DynamicPartitioner."); } } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/TimeseriesDataset.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/TimeseriesDataset.java index 0dfab0e11285..8997dd8c78f8 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/TimeseriesDataset.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/TimeseriesDataset.java @@ -184,8 +184,8 @@ private static byte[] createColumnNameFirstPart(final long timestamp) { static long getTimeIntervalsCount(final long startTime, final long endTime, final long rowPartitionIntervalSize) { - return (getRowKeyTimestampPart(endTime, rowPartitionIntervalSize) - - getRowKeyTimestampPart(startTime, rowPartitionIntervalSize) + 1); + return (getRowKeyTimestampPart(endTime, rowPartitionIntervalSize) + - getRowKeyTimestampPart(startTime, rowPartitionIntervalSize) + 1); } static byte[] getRowOfKthInterval(final byte[] key, diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/TimeseriesTable.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/TimeseriesTable.java index 03cc069c324d..7f5408dc848e 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/TimeseriesTable.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/TimeseriesTable.java @@ -301,10 +301,10 @@ public boolean equals(Object o) { return false; } InputSplit that = (InputSplit) o; - return startTime == that.startTime && - endTime == that.endTime && - Arrays.equals(key, that.key) && - Arrays.equals(tags, that.tags); + return startTime == that.startTime + && endTime == that.endTime + && Arrays.equals(key, that.key) + && Arrays.equals(tags, that.tags); } @Override @@ -348,10 +348,10 @@ public List getInputSplits(int splitsCount, byte[] key, long startTime, l @Override public List getSplits() { throw new UnsupportedOperationException( - "Cannot use TimeSeriesTable as input for Batch directly. " + - "Use getInput(...) and call " + - "MapReduceContext.setInput(tsTable, splits) in the " + - "initialize(MapReduceContext context) method of the MapReduce app."); + "Cannot use TimeSeriesTable as input for Batch directly. " + + "Use getInput(...) and call " + + "MapReduceContext.setInput(tsTable, splits) in the " + + "initialize(MapReduceContext context) method of the MapReduce app."); } @ReadOnly diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/cube/TimeSeries.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/cube/TimeSeries.java index bd0ee57418dc..a6cb466f4bea 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/cube/TimeSeries.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/lib/cube/TimeSeries.java @@ -63,9 +63,9 @@ public boolean equals(Object o) { TimeSeries that = (TimeSeries) o; - return Objects.equals(measureName, that.measureName) && - Objects.equals(dimensionValues, that.dimensionValues) && - Objects.equals(timeValues, that.timeValues); + return Objects.equals(measureName, that.measureName) + && Objects.equals(dimensionValues, that.dimensionValues) + && Objects.equals(timeValues, that.timeValues); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/table/Scan.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/table/Scan.java index 3b87f3ac91c9..e6de07c198d2 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/table/Scan.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/table/Scan.java @@ -95,11 +95,11 @@ public Map getProperties() { @Override public String toString() { - return "Scan{" + - "startRow=" + Bytes.toStringBinary(startRow) + - ", stopRow=" + Bytes.toStringBinary(stopRow) + - ", filter=" + filter + - ", properties=" + properties + - '}'; + return "Scan{" + + "startRow=" + Bytes.toStringBinary(startRow) + + ", stopRow=" + Bytes.toStringBinary(stopRow) + + ", filter=" + filter + + ", properties=" + properties + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/table/TableSplit.java b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/table/TableSplit.java index be2eda9688d3..a33d790cf4a6 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/dataset/table/TableSplit.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/dataset/table/TableSplit.java @@ -53,10 +53,10 @@ public byte[] getStop() { @Override public String toString() { - return "TableSplit{" + - "start=" + Bytes.toStringBinary(start) + - ", stop=" + Bytes.toStringBinary(stop) + - '}'; + return "TableSplit{" + + "start=" + Bytes.toStringBinary(start) + + ", stop=" + Bytes.toStringBinary(stop) + + '}'; } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/EndPoint.java b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/EndPoint.java index df4a6669171b..c01024a5523e 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/EndPoint.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/EndPoint.java @@ -132,10 +132,10 @@ public int hashCode() { @Override public String toString() { - return "EndPoint{" + - "namespace='" + namespace + '\'' + - ", name='" + name + '\'' + - ", properties='" + properties + '\'' + - '}'; + return "EndPoint{" + + "namespace='" + namespace + '\'' + + ", name='" + name + '\'' + + ", properties='" + properties + '\'' + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/InputField.java b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/InputField.java index b8372fc54b2b..098ec4073579 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/InputField.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/InputField.java @@ -66,8 +66,8 @@ public boolean equals(Object o) { return false; } InputField that = (InputField) o; - return Objects.equals(origin, that.origin) && - Objects.equals(name, that.name); + return Objects.equals(origin, that.origin) + && Objects.equals(name, that.name); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/Operation.java b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/Operation.java index 012ebda3c08e..6d497071b6f9 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/Operation.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/Operation.java @@ -68,9 +68,9 @@ public boolean equals(Object o) { } Operation operation = (Operation) o; - return Objects.equals(name, operation.name) && - type == operation.type && - Objects.equals(description, operation.description); + return Objects.equals(name, operation.name) + && type == operation.type + && Objects.equals(description, operation.description); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/ReadOperation.java b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/ReadOperation.java index 1e87d48e84c5..75cb157cd79c 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/ReadOperation.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/ReadOperation.java @@ -82,8 +82,8 @@ public boolean equals(Object o) { return false; } ReadOperation that = (ReadOperation) o; - return Objects.equals(source, that.source) && - Objects.equals(outputs, that.outputs); + return Objects.equals(source, that.source) + && Objects.equals(outputs, that.outputs); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/TransformOperation.java b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/TransformOperation.java index f2d20edc7e5a..46c6845b25c3 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/TransformOperation.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/TransformOperation.java @@ -83,8 +83,8 @@ public boolean equals(Object o) { return false; } TransformOperation that = (TransformOperation) o; - return Objects.equals(inputs, that.inputs) && - Objects.equals(outputs, that.outputs); + return Objects.equals(inputs, that.inputs) + && Objects.equals(outputs, that.outputs); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/WriteOperation.java b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/WriteOperation.java index 62c6a294975c..cef28613f805 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/WriteOperation.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/lineage/field/WriteOperation.java @@ -81,8 +81,8 @@ public boolean equals(Object o) { return false; } WriteOperation that = (WriteOperation) o; - return Objects.equals(inputs, that.inputs) && - Objects.equals(destination, that.destination); + return Objects.equals(inputs, that.inputs) + && Objects.equals(destination, that.destination); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/macro/MacroFunction.java b/cdap-api/src/main/java/io/cdap/cdap/api/macro/MacroFunction.java index 27a037ffa4ff..1bad9df88976 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/macro/MacroFunction.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/macro/MacroFunction.java @@ -72,9 +72,9 @@ public int hashCode() { @Override public String toString() { - return "MacroFunction{" + - "functionName='" + functionName + '\'' + - ", arguments=" + arguments + - '}'; + return "MacroFunction{" + + "functionName='" + functionName + '\'' + + ", arguments=" + arguments + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/macro/Macros.java b/cdap-api/src/main/java/io/cdap/cdap/api/macro/Macros.java index 9d544b181404..21ef13b4e1c6 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/macro/Macros.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/macro/Macros.java @@ -59,8 +59,8 @@ public boolean equals(Object o) { Macros macros = (Macros) o; - return Objects.equals(lookupProperties, macros.lookupProperties) && - Objects.equals(macroFunctions, macros.macroFunctions); + return Objects.equals(lookupProperties, macros.lookupProperties) + && Objects.equals(macroFunctions, macros.macroFunctions); } @Override @@ -70,9 +70,9 @@ public int hashCode() { @Override public String toString() { - return "Macros{" + - "lookupProperties=" + lookupProperties + - ", macroFunctions=" + macroFunctions + - '}'; + return "Macros{" + + "lookupProperties=" + lookupProperties + + ", macroFunctions=" + macroFunctions + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/metadata/Metadata.java b/cdap-api/src/main/java/io/cdap/cdap/api/metadata/Metadata.java index 4666699a0dd5..ccbe4397aaa8 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/metadata/Metadata.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/metadata/Metadata.java @@ -54,8 +54,8 @@ public boolean equals(Object o) { return false; } Metadata that = (Metadata) o; - return Objects.equals(properties, that.properties) && - Objects.equals(tags, that.tags); + return Objects.equals(properties, that.properties) + && Objects.equals(tags, that.tags); } @Override @@ -65,9 +65,9 @@ public int hashCode() { @Override public String toString() { - return "Metadata{" + - "properties=" + properties + - ", tags=" + tags + - '}'; + return "Metadata{" + + "properties=" + properties + + ", tags=" + tags + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/metadata/MetadataEntity.java b/cdap-api/src/main/java/io/cdap/cdap/api/metadata/MetadataEntity.java index 0258ac974b2d..a37acdf44026 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/metadata/MetadataEntity.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/metadata/MetadataEntity.java @@ -203,14 +203,14 @@ private void validateHierarchy() { } } throw new IllegalArgumentException( - String.format("Failed to build MetadataEntity of type '%s' from '%s'. " + - "Type '%s' is a CDAP entity type and must follow one of " + - "the following key hierarchies '%s'." + - "If you want to represent a CDAP Entity please follow the " + - "correct hierarchy. If you are trying to represent a " + - "custom resource please use a different type name. " + - "Note: if a type name is not specified, the last key is " + - "considered as the type.", + String.format("Failed to build MetadataEntity of type '%s' from '%s'. " + + "Type '%s' is a CDAP entity type and must follow one of " + + "the following key hierarchies '%s'." + + "If you want to represent a CDAP Entity please follow the " + + "correct hierarchy. If you are trying to represent a " + + "custom resource please use a different type name. " + + "Note: if a type name is not specified, the last key is " + + "considered as the type.", type, parts, type, Arrays.deepToString(validSequences))); } } @@ -408,10 +408,10 @@ public Iterator iterator() { @Override public String toString() { - return "MetadataEntity{" + - "details=" + details + - ", type='" + type + '\'' + - '}'; + return "MetadataEntity{" + + "details=" + details + + ", type='" + type + '\'' + + '}'; } @Override @@ -423,8 +423,8 @@ public boolean equals(Object o) { return false; } MetadataEntity that = (MetadataEntity) o; - return Objects.equals(details, that.details) && - Objects.equals(type, that.type); + return Objects.equals(details, that.details) + && Objects.equals(type, that.type); } @Override @@ -462,8 +462,8 @@ public boolean equals(Object o) { return false; } KeyValue keyValue = (KeyValue) o; - return Objects.equals(key, keyValue.key) && - Objects.equals(value, keyValue.value); + return Objects.equals(key, keyValue.key) + && Objects.equals(value, keyValue.value); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/InvalidPluginProperty.java b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/InvalidPluginProperty.java index 7a350a39db5a..1bddf46e3d1e 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/InvalidPluginProperty.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/InvalidPluginProperty.java @@ -66,8 +66,8 @@ public boolean equals(Object o) { InvalidPluginProperty that = (InvalidPluginProperty) o; - return Objects.equals(name, that.name) && Objects.equals(errorMessage, that.errorMessage) && - Objects.equals(cause, that.cause); + return Objects.equals(name, that.name) && Objects.equals(errorMessage, that.errorMessage) + && Objects.equals(cause, that.cause); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/Plugin.java b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/Plugin.java index c8fd177c2cd9..3cc87ff5b699 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/Plugin.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/Plugin.java @@ -108,11 +108,11 @@ public int hashCode() { @Override public String toString() { - return "Plugin{" + - "parents=" + getParents() + - ", artifactId=" + artifactId + - ", pluginClass=" + pluginClass + - ", properties=" + properties + - '}'; + return "Plugin{" + + "parents=" + getParents() + + ", artifactId=" + artifactId + + ", pluginClass=" + pluginClass + + ", properties=" + properties + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/PluginClass.java b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/PluginClass.java index ebf42fa62b2e..bd446165509b 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/PluginClass.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/PluginClass.java @@ -204,16 +204,16 @@ public int hashCode() { @Override public String toString() { - return "PluginClass{" + - "type='" + type + '\'' + - ", name='" + name + '\'' + - ", category='" + category + '\'' + - ", description='" + description + '\'' + - ", className='" + className + '\'' + - ", configFieldName='" + configFieldName + '\'' + - ", properties=" + properties + - ", requirements=" + requirements + - '}'; + return "PluginClass{" + + "type='" + type + '\'' + + ", name='" + name + '\'' + + ", category='" + category + '\'' + + ", description='" + description + '\'' + + ", className='" + className + '\'' + + ", configFieldName='" + configFieldName + '\'' + + ", properties=" + properties + + ", requirements=" + requirements + + '}'; } /** diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/PluginProperties.java b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/PluginProperties.java index 8323b2d478ac..54c184b7094e 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/PluginProperties.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/PluginProperties.java @@ -84,10 +84,10 @@ public boolean equals(Object o) { @Override public String toString() { - return "PluginProperties{" + - "properties=" + properties + - ", macros=" + macros + - '}'; + return "PluginProperties{" + + "properties=" + properties + + ", macros=" + macros + + '}'; } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/Requirements.java b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/Requirements.java index 12a59d005ef6..deffed24a485 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/plugin/Requirements.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/plugin/Requirements.java @@ -91,10 +91,10 @@ public int hashCode() { @Override public String toString() { - return "Requirements{" + - "datasetTypes=" + datasetTypes + - "capabilities=" + capabilities + - '}'; + return "Requirements{" + + "datasetTypes=" + datasetTypes + + "capabilities=" + capabilities + + '}'; } public boolean isEmpty() { diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/security/store/SecureStoreMetadata.java b/cdap-api/src/main/java/io/cdap/cdap/api/security/store/SecureStoreMetadata.java index ed874f124b13..e48741ca8a87 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/security/store/SecureStoreMetadata.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/security/store/SecureStoreMetadata.java @@ -68,11 +68,11 @@ public String getDescription() { @Override public String toString() { - return "SecureStoreMetadata{" + - "name='" + name + '\'' + - ", description='" + description + '\'' + - ", createdEpochMs=" + createdEpochMs + - '}'; + return "SecureStoreMetadata{" + + "name='" + name + '\'' + + ", description='" + description + '\'' + + ", createdEpochMs=" + createdEpochMs + + '}'; } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/api/workflow/WorkflowSpecification.java b/cdap-api/src/main/java/io/cdap/cdap/api/workflow/WorkflowSpecification.java index db0f3dedf5e4..efa6f0d69edd 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/api/workflow/WorkflowSpecification.java +++ b/cdap-api/src/main/java/io/cdap/cdap/api/workflow/WorkflowSpecification.java @@ -115,15 +115,15 @@ public Map getLocalDatasetSpecs() { @Override public String toString() { - return "WorkflowSpecification{" + - "className='" + getClassName() + '\'' + - ", name='" + getName() + '\'' + - ", description='" + getDescription() + '\'' + - ", plugins=" + getPlugins() + - ", properties=" + properties + - ", nodes=" + nodes + - ", nodeIdMap=" + nodeIdMap + - ", localDatasetSpecs=" + localDatasetSpecs + - '}'; + return "WorkflowSpecification{" + + "className='" + getClassName() + '\'' + + ", name='" + getName() + '\'' + + ", description='" + getDescription() + '\'' + + ", plugins=" + getPlugins() + + ", properties=" + properties + + ", nodes=" + nodes + + ", nodeIdMap=" + nodeIdMap + + ", localDatasetSpecs=" + localDatasetSpecs + + '}'; } } diff --git a/cdap-api/src/main/java/io/cdap/cdap/internal/api/DefaultDatasetConfigurer.java b/cdap-api/src/main/java/io/cdap/cdap/internal/api/DefaultDatasetConfigurer.java index c544a50cac37..c2dfccd73b7c 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/internal/api/DefaultDatasetConfigurer.java +++ b/cdap-api/src/main/java/io/cdap/cdap/internal/api/DefaultDatasetConfigurer.java @@ -79,8 +79,8 @@ public void addDatasetModule(String moduleName, Class m String existingModuleClass = datasetModules.get(moduleName); if (existingModuleClass != null && !existingModuleClass.equals(moduleClass.getName())) { throw new IllegalArgumentException( - String.format("Module '%s' added multiple times with different classes " + - "'%s' and '%s'. Please resolve the conflict.", moduleName, existingModuleClass, + String.format("Module '%s' added multiple times with different classes " + + "'%s' and '%s'. Please resolve the conflict.", moduleName, existingModuleClass, moduleClassName)); } datasetModules.put(moduleName, moduleClassName); @@ -94,8 +94,8 @@ public void addDatasetType(Class datasetClass) { String existingClassName = datasetModules.get(datasetClass.getName()); if (existingClassName != null && !existingClassName.equals(className)) { throw new IllegalArgumentException( - String.format("Dataset class '%s' was added already as a module with class " + - "'%s'. Please resolve the conflict so there is only one class.", className, + String.format("Dataset class '%s' was added already as a module with class " + + "'%s'. Please resolve the conflict so there is only one class.", className, existingClassName)); } datasetModules.put(datasetClass.getName(), className); @@ -126,10 +126,10 @@ public void createDataset(String datasetInstanceName, String typeName, DatasetCreationSpec existingSpec = datasetSpecs.get(datasetInstanceName); if (existingSpec != null && !existingSpec.equals(spec)) { throw new IllegalArgumentException( - String.format("DatasetInstance '%s' was added multiple times with " + - "different specifications. Please resolve the conflict so that there is only one specification for " - + - "the dataset instance.", datasetInstanceName)); + String.format("DatasetInstance '%s' was added multiple times with " + + "different specifications. Please resolve the conflict so that there is only one specification for " + + + "the dataset instance.", datasetInstanceName)); } datasetSpecs.put(datasetInstanceName, spec); } diff --git a/cdap-api/src/main/java/io/cdap/cdap/internal/dataset/DatasetCreationSpec.java b/cdap-api/src/main/java/io/cdap/cdap/internal/dataset/DatasetCreationSpec.java index a4c80cf787c2..cbf073f4caa5 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/internal/dataset/DatasetCreationSpec.java +++ b/cdap-api/src/main/java/io/cdap/cdap/internal/dataset/DatasetCreationSpec.java @@ -57,9 +57,9 @@ public boolean equals(Object o) { DatasetCreationSpec that = (DatasetCreationSpec) o; - return Objects.equals(instanceName, that.instanceName) && - Objects.equals(typeName, that.typeName) && - Objects.equals(props.getProperties(), that.props.getProperties()); + return Objects.equals(instanceName, that.instanceName) + && Objects.equals(typeName, that.typeName) + && Objects.equals(props.getProperties(), that.props.getProperties()); } @Override diff --git a/cdap-api/src/main/java/io/cdap/cdap/internal/guava/reflect/TypeToken.java b/cdap-api/src/main/java/io/cdap/cdap/internal/guava/reflect/TypeToken.java index c3037bef9427..bd715eeae025 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/internal/guava/reflect/TypeToken.java +++ b/cdap-api/src/main/java/io/cdap/cdap/internal/guava/reflect/TypeToken.java @@ -101,11 +101,11 @@ public abstract class TypeToken extends TypeCapture implements Serializabl protected TypeToken() { this.runtimeType = capture(); Preconditions.checkState(!(runtimeType instanceof TypeVariable), - "Cannot construct a TypeToken for a type variable.\n" + - "You probably meant to call new TypeToken<%s>(getClass()) " + - "that can resolve the type variable for you.\n" + - "If you do need to create a TypeToken of a type variable, " + - "please use TypeToken.of() instead.", runtimeType); + "Cannot construct a TypeToken for a type variable.\n" + + "You probably meant to call new TypeToken<%s>(getClass()) " + + "that can resolve the type variable for you.\n" + + "If you do need to create a TypeToken of a type variable, " + + "please use TypeToken.of() instead.", runtimeType); } /** diff --git a/cdap-api/src/main/java/io/cdap/cdap/internal/io/AbstractSchemaGenerator.java b/cdap-api/src/main/java/io/cdap/cdap/internal/io/AbstractSchemaGenerator.java index ebea2e6b49d0..a76566eb6d38 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/internal/io/AbstractSchemaGenerator.java +++ b/cdap-api/src/main/java/io/cdap/cdap/internal/io/AbstractSchemaGenerator.java @@ -131,8 +131,8 @@ protected final Schema doGenerate(TypeToken typeToken, Set knownRecor } if (!(type instanceof Class || type instanceof ParameterizedType)) { - throw new UnsupportedTypeException("Type " + type + " is not supported. " + - "Only Class or ParameterizedType are supported."); + throw new UnsupportedTypeException("Type " + type + " is not supported. " + + "Only Class or ParameterizedType are supported."); } // Any parameterized Collection class would be represented by ARRAY schema. diff --git a/cdap-api/src/main/java/io/cdap/cdap/internal/io/ReflectionSchemaGenerator.java b/cdap-api/src/main/java/io/cdap/cdap/internal/io/ReflectionSchemaGenerator.java index 88c32056e5ea..decbc4ac2041 100644 --- a/cdap-api/src/main/java/io/cdap/cdap/internal/io/ReflectionSchemaGenerator.java +++ b/cdap-api/src/main/java/io/cdap/cdap/internal/io/ReflectionSchemaGenerator.java @@ -66,8 +66,8 @@ protected Schema generateRecord(TypeToken typeToken, Set knowRecords, throws UnsupportedTypeException { String recordName = typeToken.getRawType().getName(); Map> recordFieldTypes = - typeToken.getRawType().isInterface() ? - collectByMethods(typeToken, new TreeMap<>()) : + typeToken.getRawType().isInterface() + ? collectByMethods(typeToken, new TreeMap<>()) : collectByFields(typeToken, new TreeMap<>()); // Recursively generate field type schema. @@ -131,8 +131,8 @@ private Map> collectByMethods(TypeToken typeToken, // Ignore not getter methods continue; } - String fieldName = methodName.startsWith("get") ? - methodName.substring("get".length()) : methodName.substring("is".length()); + String fieldName = methodName.startsWith("get") + ? methodName.substring("get".length()) : methodName.substring("is".length()); if (fieldName.isEmpty()) { continue; } diff --git a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/WorkflowTokenTestPutApp.java b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/WorkflowTokenTestPutApp.java index 0f582e0fd88a..6e16c53c43ee 100644 --- a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/WorkflowTokenTestPutApp.java +++ b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/WorkflowTokenTestPutApp.java @@ -56,8 +56,8 @@ public class WorkflowTokenTestPutApp extends AbstractApplication { @Override public void configure() { setName(NAME); - setDescription("Application to test the put operation on the Workflow in initialize, " + - "destroy, map, and reduce methods of the MapReduce program."); + setDescription("Application to test the put operation on the Workflow in initialize, " + + "destroy, map, and reduce methods of the MapReduce program."); addMapReduce(new RecordCounter()); addSpark(new SparkTestApp()); addWorkflow(new WorkflowTokenTestPut()); diff --git a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/runtime/batch/DynamicPartitionerWithAvroTest.java b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/runtime/batch/DynamicPartitionerWithAvroTest.java index 33dfd6b4b076..09fb6d707a1a 100644 --- a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/runtime/batch/DynamicPartitionerWithAvroTest.java +++ b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/runtime/batch/DynamicPartitionerWithAvroTest.java @@ -204,12 +204,13 @@ public void apply() throws IOException { partitions.put(partition.getPartitionKey(), partition); // check that the mapreduce wrote the output partition metadata to all the output partitions Assert.assertEquals(getExpectedMetadata(precreatePartitions, partitionWriteOption), - partition.getMetadata().asMap()); + partition.getMetadata().asMap()); // if files were precreated, and the option is to append, expect the empty file to exist // if partition write option is configured to overwrite, then the file is expected to not exist Location preexistingFile = partition.getLocation().append("file"); - if (precreatePartitions && - partitionWriteOption == DynamicPartitioner.PartitionWriteOption.CREATE_OR_APPEND) { + if (precreatePartitions + && partitionWriteOption + == DynamicPartitioner.PartitionWriteOption.CREATE_OR_APPEND) { Assert.assertTrue(preexistingFile.exists()); try (InputStream inputStream = preexistingFile.getInputStream()) { Assert.assertEquals(-1, inputStream.read()); diff --git a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowHttpHandlerTest.java b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowHttpHandlerTest.java index 0a7cc09fbfcb..14428f6c0770 100644 --- a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowHttpHandlerTest.java +++ b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowHttpHandlerTest.java @@ -548,8 +548,10 @@ public void testWorkflowForkApp() throws Exception { // Get the runId for the currently running Workflow String newRunId = getRunIdOfRunningProgram(programId); Assert.assertTrue( - String.format("Expected a new runId to be generated after starting the workflow for the second time, but " + - "found old runId '%s' = new runId '%s'", runId, newRunId), !runId.equals(newRunId)); + String.format( + "Expected a new runId to be generated after starting the workflow for the second time, but " + + "found old runId '%s' = new runId '%s'", runId, newRunId), + !runId.equals(newRunId)); // Store the new RunId runId = newRunId; @@ -680,25 +682,32 @@ public void testWorkflowScopedArguments() throws Exception { String workflowRunId = workflowHistoryRuns.get(0).getPid(); // Making this version specific for correct version in the expected error message string below - ProgramId mr1ProgramId = Ids.namespace(TEST_NAMESPACE2).app(WorkflowAppWithScopedParameters.APP_NAME, - applicationDetail.getAppVersion()) - .mr(WorkflowAppWithScopedParameters.ONE_MR); + ProgramId mr1ProgramId = Ids.namespace(TEST_NAMESPACE2) + .app(WorkflowAppWithScopedParameters.APP_NAME, + applicationDetail.getAppVersion()) + .mr(WorkflowAppWithScopedParameters.ONE_MR); verifyProgramRuns(Id.Program.fromEntityId(mr1ProgramId), ProgramRunStatus.RUNNING); - List oneMRHistoryRuns = getProgramRuns(Id.Program.fromEntityId(mr1ProgramId), ProgramRunStatus.ALL); + List oneMRHistoryRuns = getProgramRuns(Id.Program.fromEntityId(mr1ProgramId), + ProgramRunStatus.ALL); - String expectedMessage = String.format("Cannot stop the program run '%s' started by the Workflow run '%s'. " + - "Please stop the Workflow.", - mr1ProgramId.run(oneMRHistoryRuns.get(0).getPid()), workflowRunId); - stopProgram(Id.Program.fromEntityId(mr1ProgramId), oneMRHistoryRuns.get(0).getPid(), 400, expectedMessage); + String expectedMessage = String.format( + "Cannot stop the program run '%s' started by the Workflow run '%s'. " + + "Please stop the Workflow.", + mr1ProgramId.run(oneMRHistoryRuns.get(0).getPid()), workflowRunId); + stopProgram(Id.Program.fromEntityId(mr1ProgramId), oneMRHistoryRuns.get(0).getPid(), 400, + expectedMessage); verifyProgramRuns(Id.Program.fromEntityId(programId), ProgramRunStatus.COMPLETED); - workflowHistoryRuns = getProgramRuns(Id.Program.fromEntityId(programId), ProgramRunStatus.COMPLETED); + workflowHistoryRuns = getProgramRuns(Id.Program.fromEntityId(programId), + ProgramRunStatus.COMPLETED); - oneMRHistoryRuns = getProgramRuns(Id.Program.fromEntityId(mr1ProgramId), ProgramRunStatus.COMPLETED); + oneMRHistoryRuns = getProgramRuns(Id.Program.fromEntityId(mr1ProgramId), + ProgramRunStatus.COMPLETED); - Id.Program mr2ProgramId = Id.Program.from(TEST_NAMESPACE2, WorkflowAppWithScopedParameters.APP_NAME, + Id.Program mr2ProgramId = Id.Program.from(TEST_NAMESPACE2, + WorkflowAppWithScopedParameters.APP_NAME, ProgramType.MAPREDUCE, WorkflowAppWithScopedParameters.ANOTHER_MR); List anotherMRHistoryRuns = getProgramRuns(mr2ProgramId, ProgramRunStatus.COMPLETED); @@ -869,8 +878,9 @@ public void testWorkflowSchedules() throws Exception { // check that there were at least 1 previous runs List previousRuntimes = getScheduledRunTimes(programId.toEntityId(), false); int numRuns = previousRuntimes.size(); - Assert.assertTrue(String.format("After sleeping for two seconds, the schedule should have at least triggered " + - "once, but found %s previous runs", numRuns), numRuns >= 1); + Assert.assertTrue( + String.format("After sleeping for two seconds, the schedule should have at least triggered " + + "once, but found %s previous runs", numRuns), numRuns >= 1); // Verify no program running verifyNoRunWithStatus(programId, ProgramRunStatus.RUNNING); @@ -1046,7 +1056,8 @@ public void testWorkflowCondition() throws Exception { // create input data in which number of good records are lesser than the number of bad records runtimeArguments.put("inputPath", createConditionInput("ConditionProgramInput", 2, 12)); - runtimeArguments.put("outputPath", new File(tmpFolder.newFolder(), "ConditionProgramOutput").getAbsolutePath()); + runtimeArguments.put("outputPath", + new File(tmpFolder.newFolder(), "ConditionProgramOutput").getAbsolutePath()); setAndTestRuntimeArgs(programId, runtimeArguments); // Start the workflow @@ -1055,9 +1066,9 @@ public void testWorkflowCondition() throws Exception { // Since the number of good records are lesser than the number of bad records, // 'else' branch of the condition will get executed. // Wait until the execution of the fork on the else branch starts - while (!(elseForkOneActionFile.exists() && - elseForkAnotherActionFile.exists() && - elseForkThirdActionFile.exists())) { + while (!(elseForkOneActionFile.exists() + && elseForkAnotherActionFile.exists() + && elseForkThirdActionFile.exists())) { TimeUnit.MILLISECONDS.sleep(50); } diff --git a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowStatsSLAHttpHandlerTest.java b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowStatsSLAHttpHandlerTest.java index 0f94f4274726..63ed82df2720 100644 --- a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowStatsSLAHttpHandlerTest.java +++ b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/WorkflowStatsSLAHttpHandlerTest.java @@ -157,57 +157,63 @@ public void testStatistics() throws Exception { outlierRunId = workflowRunId.getId(); } - store.setStop(workflowProgram.run(workflowRunId.getId()), workflowStopTime, ProgramRunStatus.COMPLETED, - AppFabricTestHelper.createSourceId(++sourceId)); + store.setStop(workflowProgram.run(workflowRunId.getId()), workflowStopTime, + ProgramRunStatus.COMPLETED, + AppFabricTestHelper.createSourceId(++sourceId)); } - String request = String.format("%s/namespaces/%s/apps/%s/workflows/%s/statistics?start=%s&end=%s" + - "&percentile=%s", - Constants.Gateway.API_VERSION_3, Id.Namespace.DEFAULT.getId(), - WorkflowApp.class.getSimpleName(), workflowProgram.getProgram(), - TimeUnit.MILLISECONDS.toSeconds(startTime), - TimeUnit.MILLISECONDS.toSeconds(currentTimeMillis) + TimeUnit.MINUTES.toSeconds(2), - "99"); + String request = String.format( + "%s/namespaces/%s/apps/%s/workflows/%s/statistics?start=%s&end=%s" + + "&percentile=%s", + Constants.Gateway.API_VERSION_3, Id.Namespace.DEFAULT.getId(), + WorkflowApp.class.getSimpleName(), workflowProgram.getProgram(), + TimeUnit.MILLISECONDS.toSeconds(startTime), + TimeUnit.MILLISECONDS.toSeconds(currentTimeMillis) + TimeUnit.MINUTES.toSeconds(2), + "99"); HttpResponse response = doGet(request); WorkflowStatistics workflowStatistics = - readResponse(response, new TypeToken() { }.getType()); - PercentileInformation percentileInformation = workflowStatistics.getPercentileInformationList().get(0); + readResponse(response, new TypeToken() { + }.getType()); + PercentileInformation percentileInformation = workflowStatistics.getPercentileInformationList() + .get(0); Assert.assertEquals(1, percentileInformation.getRunIdsOverPercentile().size()); Assert.assertEquals(outlierRunId, percentileInformation.getRunIdsOverPercentile().get(0)); Assert.assertEquals("5", workflowStatistics.getNodes().get(sparkName).get("runs")); - request = String.format("%s/namespaces/%s/apps/%s/workflows/%s/statistics?start=%s&end=%s" + - "&percentile=%s&percentile=%s", - Constants.Gateway.API_VERSION_3, Id.Namespace.DEFAULT.getId(), - WorkflowApp.class.getSimpleName(), workflowProgram.getProgram(), "now", "0", "90", "95"); + request = String.format("%s/namespaces/%s/apps/%s/workflows/%s/statistics?start=%s&end=%s" + + "&percentile=%s&percentile=%s", + Constants.Gateway.API_VERSION_3, Id.Namespace.DEFAULT.getId(), + WorkflowApp.class.getSimpleName(), workflowProgram.getProgram(), "now", "0", "90", "95"); response = doGet(request); Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.code(), - response.getResponseCode()); + response.getResponseCode()); - request = String.format("%s/namespaces/%s/apps/%s/workflows/%s/statistics?start=%s&end=%s" + - "&percentile=%s&percentile=%s", - Constants.Gateway.API_VERSION_3, Id.Namespace.DEFAULT.getId(), - WorkflowApp.class.getSimpleName(), workflowProgram.getProgram(), "now", "0", "90.0", "950"); + request = String.format("%s/namespaces/%s/apps/%s/workflows/%s/statistics?start=%s&end=%s" + + "&percentile=%s&percentile=%s", + Constants.Gateway.API_VERSION_3, Id.Namespace.DEFAULT.getId(), + WorkflowApp.class.getSimpleName(), workflowProgram.getProgram(), "now", "0", "90.0", "950"); response = doGet(request); Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.code(), - response.getResponseCode()); - Id.Application appId = new Id.Application(Id.Namespace.DEFAULT, WorkflowApp.class.getSimpleName()); + response.getResponseCode()); + Id.Application appId = new Id.Application(Id.Namespace.DEFAULT, + WorkflowApp.class.getSimpleName()); deleteApp(appId, HttpResponseStatus.OK.code()); - request = String.format("%s/namespaces/%s/apps/%s/workflows/%s/statistics?start=%s&end=%s" + - "&percentile=%s", - Constants.Gateway.API_VERSION_3, Id.Namespace.DEFAULT.getId(), - WorkflowApp.class.getSimpleName(), workflowProgram, - 0, - System.currentTimeMillis(), - "99"); + request = String.format("%s/namespaces/%s/apps/%s/workflows/%s/statistics?start=%s&end=%s" + + "&percentile=%s", + Constants.Gateway.API_VERSION_3, Id.Namespace.DEFAULT.getId(), + WorkflowApp.class.getSimpleName(), workflowProgram, + 0, + System.currentTimeMillis(), + "99"); response = doGet(request); Assert.assertEquals(HttpResponseStatus.OK.code(), response.getResponseCode()); Assert.assertTrue( - response.getResponseBodyAsString().startsWith("There are no statistics associated with this workflow : ")); + response.getResponseBodyAsString() + .startsWith("There are no statistics associated with this workflow : ")); } diff --git a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/runtime/WorkflowTest.java b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/runtime/WorkflowTest.java index f878dffb8566..1eb58f0e36d4 100644 --- a/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/runtime/WorkflowTest.java +++ b/cdap-app-fabric-tests/src/test/java/io/cdap/cdap/runtime/WorkflowTest.java @@ -183,9 +183,11 @@ public void testBadInputInWorkflow() throws Exception { // try deploying app containing workflow with non-unique programs try { - AppFabricTestHelper.deployApplicationWithManager(NonUniqueProgramsInWorkflowApp.class, TEMP_FOLDER_SUPPLIER); - Assert.fail("Should have thrown Exception because 'NoOpMR' added multiple times in the workflow " + - "'NonUniqueProgramsInWorkflow'."); + AppFabricTestHelper.deployApplicationWithManager(NonUniqueProgramsInWorkflowApp.class, + TEMP_FOLDER_SUPPLIER); + Assert.fail( + "Should have thrown Exception because 'NoOpMR' added multiple times in the workflow " + + "'NonUniqueProgramsInWorkflow'."); } catch (Exception ex) { Assert.assertEquals("Node 'NoOpMR' already exists in workflow 'NonUniqueProgramsInWorkflow'.", ex.getCause().getMessage()); @@ -194,9 +196,10 @@ public void testBadInputInWorkflow() throws Exception { // try deploying app containing workflow fork with non-unique programs try { AppFabricTestHelper.deployApplicationWithManager(NonUniqueProgramsInWorkflowWithForkApp.class, - TEMP_FOLDER_SUPPLIER); - Assert.fail("Should have thrown Exception because 'MyTestPredicate' added multiple times in the workflow " + - "'NonUniqueProgramsInWorkflowWithFork'"); + TEMP_FOLDER_SUPPLIER); + Assert.fail( + "Should have thrown Exception because 'MyTestPredicate' added multiple times in the workflow " + + "'NonUniqueProgramsInWorkflowWithFork'"); } catch (Exception ex) { Assert.assertEquals("Node 'MyTestPredicate' already exists in workflow 'NonUniqueProgramsInWorkflowWithFork'.", ex.getCause().getMessage()); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/DefaultProgramRunnerFactory.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/DefaultProgramRunnerFactory.java index d1876c43a78a..f43ca2c6e321 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/DefaultProgramRunnerFactory.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/DefaultProgramRunnerFactory.java @@ -164,8 +164,8 @@ private StatePublishProgramRunnerControllerCreator(ProgramRunner runner, ProgramStateWriter programStateWriter) { super(runner, programStateWriter); if (!(runner instanceof ProgramControllerCreator)) { - throw new IllegalArgumentException("ProgramRunner " + runner + - " does not implement " + ProgramControllerCreator.class); + throw new IllegalArgumentException("ProgramRunner " + runner + + " does not implement " + ProgramControllerCreator.class); } this.controllerCreator = (ProgramControllerCreator) runner; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/ImpersonatedTwillRunnerService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/ImpersonatedTwillRunnerService.java index b17da0107bf1..c5a93a3f3c2c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/ImpersonatedTwillRunnerService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/ImpersonatedTwillRunnerService.java @@ -132,8 +132,8 @@ public Iterable getControllers() { @Override public Cancellable scheduleSecureStoreUpdate(SecureStoreUpdater updater, long initialDelay, long delay, TimeUnit unit) { - throw new UnsupportedOperationException("The scheduleSecureStoreUpdate method is deprecated, " + - "it shouldn't be used."); + throw new UnsupportedOperationException("The scheduleSecureStoreUpdate method is deprecated, " + + "it shouldn't be used."); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/metrics/ProgramUserMetrics.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/metrics/ProgramUserMetrics.java index 0d78ce400d8a..f56d58dc391e 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/metrics/ProgramUserMetrics.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/metrics/ProgramUserMetrics.java @@ -63,8 +63,8 @@ public Metrics child(Map tags) { Sets.SetView intersection = Sets.intersection(getTags().keySet(), tags.keySet()); if (!intersection.isEmpty()) { throw new IllegalArgumentException( - String.format("Tags with names '%s' already exists in the context. " + - "Child Metrics cannot be created with duplicate tag names.", + String.format("Tags with names '%s' already exists in the context. " + + "Child Metrics cannot be created with duplicate tag names.", String.join(", ", intersection))); } return new ProgramUserMetrics(metricsContext.childContext(tags), false); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewMessage.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewMessage.java index d643abfd99b1..b6fa5f38b1f0 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewMessage.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewMessage.java @@ -83,10 +83,10 @@ public T getPayload(Gson gson, java.lang.reflect.Type objType) { @Override public String toString() { - return "PreviewMessage{" + - "type=" + type + - ", entityId=" + entityId + - ", payload=" + payload + - '}'; + return "PreviewMessage{" + + "type=" + type + + ", entityId=" + entityId + + ", payload=" + payload + + '}'; } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewStatus.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewStatus.java index 974a1ed729cc..cea4ceca7be7 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewStatus.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/preview/PreviewStatus.java @@ -124,12 +124,12 @@ public boolean equals(Object o) { } PreviewStatus status1 = (PreviewStatus) o; - return status == status1.status && - submitTime == status1.submitTime && - Objects.equals(throwable, status1.throwable) && - Objects.equals(startTime, status1.startTime) && - Objects.equals(endTime, status1.endTime) && - Objects.equals(positionInWaitingQueue, status1.positionInWaitingQueue); + return status == status1.status + && submitTime == status1.submitTime + && Objects.equals(throwable, status1.throwable) + && Objects.equals(startTime, status1.startTime) + && Objects.equals(endTime, status1.endTime) + && Objects.equals(positionInWaitingQueue, status1.positionInWaitingQueue); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/AbstractProgramRuntimeService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/AbstractProgramRuntimeService.java index 2f0ee4a3da64..db1bb11f2dcc 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/AbstractProgramRuntimeService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/AbstractProgramRuntimeService.java @@ -405,8 +405,8 @@ private ProgramController createController(ProgramId programId, RunId runId, } catch (IllegalArgumentException e) { // This shouldn't happen. If it happen, it means CDAP was incorrectly install such that some of the program // type is not support (maybe due to version mismatch in upgrade). - LOG.error("Unsupported program type {} for program {}. " + - "It is likely caused by incorrect CDAP installation or upgrade to incompatible CDAP version", + LOG.error("Unsupported program type {} for program {}. " + + "It is likely caused by incorrect CDAP installation or upgrade to incompatible CDAP version", programId.getType(), programId); return null; } @@ -417,8 +417,8 @@ private ProgramController createController(ProgramId programId, RunId runId, ResourceReport resourceReport = controller.getResourceReport(); LOG.error( "Unable to create ProgramController for program {} for twill application {}. It is likely caused by " - + - "invalid CDAP program runtime extension.", + + + "invalid CDAP program runtime extension.", programId, resourceReport == null ? "'unknown twill application'" : resourceReport.getApplicationId()); return null; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/ProgramOptions.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/ProgramOptions.java index a11d8f3444a5..03f3b7c2f089 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/ProgramOptions.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/runtime/ProgramOptions.java @@ -70,10 +70,10 @@ static ProgramOptions fromNotification(Notification notification, Gson gson) { }.getType(); boolean debug = Boolean.parseBoolean(debugString); - Map userArguments = userArgumentsString == null ? - Collections.emptyMap() : gson.fromJson(userArgumentsString, stringStringMap); - Map systemArguments = systemArgumentsString == null ? - Collections.emptyMap() : gson.fromJson(systemArgumentsString, stringStringMap); + Map userArguments = userArgumentsString == null + ? Collections.emptyMap() : gson.fromJson(userArgumentsString, stringStringMap); + Map systemArguments = systemArgumentsString == null + ? Collections.emptyMap() : gson.fromJson(systemArgumentsString, stringStringMap); return new SimpleProgramOptions(programId, new BasicArguments(systemArguments), new BasicArguments(userArguments), debug); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/store/ApplicationFilter.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/store/ApplicationFilter.java index 4297f045e04e..9b1c18835b76 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/store/ApplicationFilter.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/store/ApplicationFilter.java @@ -66,9 +66,9 @@ public boolean test(ApplicationId applicationId) { @Override public String toString() { - return "ApplicationIdContainsFilter{" + - "searchFor='" + searchFor + '\'' + - '}'; + return "ApplicationIdContainsFilter{" + + "searchFor='" + searchFor + '\'' + + '}'; } } @@ -90,9 +90,9 @@ public boolean test(ApplicationId applicationId) { @Override public String toString() { - return "ApplicationIdEqualsFilter{" + - "searchFor='" + searchFor + '\'' + - '}'; + return "ApplicationIdEqualsFilter{" + + "searchFor='" + searchFor + '\'' + + '}'; } } @@ -114,9 +114,9 @@ public boolean test(ArtifactId input) { @Override public String toString() { - return "ArtifactNamesInFilter{" + - "names=" + names + - '}'; + return "ArtifactNamesInFilter{" + + "names=" + names + + '}'; } } @@ -138,9 +138,9 @@ public boolean test(ArtifactId input) { @Override public String toString() { - return "ArtifactVersionFilter{" + - "version='" + version + '\'' + - '}'; + return "ArtifactVersionFilter{" + + "version='" + version + '\'' + + '}'; } } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/store/ScanApplicationsRequest.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/store/ScanApplicationsRequest.java index d6b793ba5d77..0b7875203299 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/store/ScanApplicationsRequest.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/store/ScanApplicationsRequest.java @@ -143,17 +143,17 @@ public boolean getSortCreationTime() { @Override public String toString() { - return "ScanApplicationsRequest{" + - "namespaceId=" + namespaceId + - ", application=" + application + - ", scanFrom=" + scanFrom + - ", scanTo=" + scanTo + - ", filters=" + filters + - ", sortOrder=" + sortOrder + - ", limit=" + limit + - ", latestOnly=" + latestOnly + - ", sortCreationTime=" + sortCreationTime + - '}'; + return "ScanApplicationsRequest{" + + "namespaceId=" + namespaceId + + ", application=" + application + + ", scanFrom=" + scanFrom + + ", scanTo=" + scanTo + + ", filters=" + filters + + ", sortOrder=" + sortOrder + + ", limit=" + limit + + ", latestOnly=" + latestOnly + + ", sortCreationTime=" + sortCreationTime + + '}'; } /** @@ -302,14 +302,14 @@ private void validate() { if (namespaceId != null) { if (scanFrom != null && !namespaceId.equals(scanFrom.getNamespaceId())) { throw new IllegalArgumentException( - "Requested to start scan from application " + scanFrom + - " that is outside of scan namespace " + namespaceId + "Requested to start scan from application " + scanFrom + + " that is outside of scan namespace " + namespaceId ); } if (scanTo != null && !namespaceId.equals(scanTo.getNamespaceId())) { - throw new IllegalArgumentException("Requested to finish scan at application " + scanTo + - " that is outside of scan namespace " + namespaceId + throw new IllegalArgumentException("Requested to finish scan at application " + scanTo + + " that is outside of scan namespace " + namespaceId ); } } @@ -323,15 +323,15 @@ private void validate() { if (scanFrom != null && !application.equals(scanFrom.getApplication())) { throw new IllegalArgumentException( - "Requested to start scan from application ID " + scanFrom + - " that does not match application name" + application + "Requested to start scan from application ID " + scanFrom + + " that does not match application name" + application ); } if (scanTo != null && !application.equals(scanTo.getApplication())) { throw new IllegalArgumentException( - "Requested to finish scan at application ID " + scanTo + - " that does not match application name" + application + "Requested to finish scan at application ID " + scanTo + + " that does not match application name" + application ); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/config/PreferencesService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/config/PreferencesService.java index e2c53ffb6f2e..e3eb593777cb 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/config/PreferencesService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/config/PreferencesService.java @@ -107,8 +107,8 @@ private void setConfig(ProfileStore profileStore, PreferencesTable preferencesTa throws NotFoundException, ProfileConflictException, BadRequestException, IOException { boolean isInstanceLevel = entityId.getEntityType().equals(EntityType.INSTANCE); - NamespaceId namespaceId = isInstanceLevel ? - NamespaceId.SYSTEM : ((NamespacedEntityId) entityId).getNamespaceId(); + NamespaceId namespaceId = isInstanceLevel + ? NamespaceId.SYSTEM : ((NamespacedEntityId) entityId).getNamespaceId(); // validate the profile and publish the necessary metadata change if the profile exists in the property Optional profile = SystemArguments.getProfileIdFromArgs(namespaceId, propertyMap); @@ -119,16 +119,16 @@ private void setConfig(ProfileStore profileStore, PreferencesTable preferencesTa if (isInstanceLevel && !propertyMap.get(SystemArguments.PROFILE_NAME) .startsWith(EntityScope.SYSTEM.name())) { throw new BadRequestException( - String.format("Cannot set profile %s at the instance level. " + - "Only system profiles can be set at the instance level. " + - "The profile property must look like SYSTEM:[profile-name]", + String.format("Cannot set profile %s at the instance level. " + + "Only system profiles can be set at the instance level. " + + "The profile property must look like SYSTEM:[profile-name]", propertyMap.get(SystemArguments.PROFILE_NAME))); } if (profileStore.getProfile(profileId).getStatus() == ProfileStatus.DISABLED) { throw new ProfileConflictException( - String.format("Profile %s in namespace %s is disabled. It cannot be " + - "assigned to any programs or schedules", + String.format("Profile %s in namespace %s is disabled. It cannot be " + + "assigned to any programs or schedules", profileId.getProfile(), profileId.getNamespace()), profileId); } @@ -164,8 +164,8 @@ private void deleteConfig(EntityId entityId) { TransactionRunners.run(transactionRunner, context -> { PreferencesTable dataset = new PreferencesTable(context); Map oldProp = dataset.getPreferences(entityId).getProperties(); - NamespaceId namespaceId = entityId.getEntityType().equals(EntityType.INSTANCE) ? - NamespaceId.SYSTEM : ((NamespacedEntityId) entityId).getNamespaceId(); + NamespaceId namespaceId = entityId.getEntityType().equals(EntityType.INSTANCE) + ? NamespaceId.SYSTEM : ((NamespacedEntityId) entityId).getNamespaceId(); Optional oldProfile = SystemArguments.getProfileIdFromArgs(namespaceId, oldProp); long seqId = dataset.deleteProperties(entityId); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/error/Err.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/error/Err.java index 93dd7ef685f5..e7039e798c06 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/error/Err.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/error/Err.java @@ -35,8 +35,8 @@ private Err() { * Common Error messages that can be used in different contexts. */ public static final Errors NOT_AN_ID = new Errors( - "'%s' name is not an ID. ID should be non empty and can contain" + - " only characters A-Za-z0-9_-"); + "'%s' name is not an ID. ID should be non empty and can contain" + + " only characters A-Za-z0-9_-"); /** * Defines Schema related error messages. @@ -50,8 +50,8 @@ private Schema() { } public static final Errors NOT_SUPPORTED_TYPE = new Errors( - "Type %s is not supported. " + - "Only Class or ParameterizedType are supported" + "Type %s is not supported. " + + "Only Class or ParameterizedType are supported" ); } @@ -67,8 +67,8 @@ private Application() { } public static final Errors ATLEAST_ONE_PROCESSOR = new Errors( - "Application %s has no program defined; " + - "should have at least one program defined" + "Application %s has no program defined; " + + "should have at least one program defined" ); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/AppLifecycleHttpHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/AppLifecycleHttpHandler.java index e7403e1098b1..610c9a90c8cf 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/AppLifecycleHttpHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/AppLifecycleHttpHandler.java @@ -759,8 +759,8 @@ protected void onFinish(HttpResponder responder, File uploadedFile) { null, createProgramTerminator()); LOG.info( "Successfully deployed app {} in namespace {} from artifact {} with configuration {} and " - + - "principal {}", app.getApplicationId().getApplication(), + + + "principal {}", app.getApplicationId().getApplication(), app.getApplicationId().getNamespace(), app.getArtifactId(), appRequest.getConfig(), app.getOwnerPrincipal()); @@ -867,8 +867,9 @@ finalOwnerPrincipalId, createProgramTerminator(), updateSchedules); LOG.info( "Successfully deployed app {} in namespace {} from artifact {} with configuration {} and " - + - "principal {}", app.getApplicationId().getApplication(), namespace.getNamespace(), + + + "principal {}", app.getApplicationId().getApplication(), + namespace.getNamespace(), artifactId, configString, finalOwnerPrincipalId); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(getApplicationRecord(app))); @@ -877,15 +878,15 @@ finalOwnerPrincipalId, createProgramTerminator(), } catch (ArtifactAlreadyExistsException e) { responder.sendString(HttpResponseStatus.CONFLICT, String.format( "Artifact '%s' already exists. Please use the API that creates an application from an existing artifact. " - + - "If you are trying to replace the artifact, please delete it and then try again.", + + + "If you are trying to replace the artifact, please delete it and then try again.", artifactId)); } catch (WriteConflictException e) { // don't really expect this to happen. It means after multiple retries there were still write conflicts. LOG.warn("Write conflict while trying to add artifact {}.", artifactId, e); responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, - "Write conflict while adding artifact. This can happen if multiple requests to add " + - "the same artifact occur simultaneously. Please try again."); + "Write conflict while adding artifact. This can happen if multiple requests to add " + + "the same artifact occur simultaneously. Please try again."); } catch (UnauthorizedException e) { responder.sendString(HttpResponseStatus.FORBIDDEN, e.getMessage()); } catch (ConflictException e) { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ArtifactHttpHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ArtifactHttpHandler.java index 252f3de9a1fb..52a049ebadc6 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ArtifactHttpHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ArtifactHttpHandler.java @@ -354,8 +354,8 @@ public void writeProperties(FullHttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("artifact-name") String artifactName, @PathParam("artifact-version") String artifactVersion) throws Exception { - NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) ? - NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); + NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) + ? NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); ArtifactId artifactId = validateAndGetArtifactId(namespace, artifactName, artifactVersion); Map properties; @@ -363,16 +363,16 @@ public void writeProperties(FullHttpRequest request, HttpResponder responder, StandardCharsets.UTF_8)) { properties = GSON.fromJson(reader, MAP_STRING_STRING_TYPE); } catch (JsonSyntaxException e) { - throw new BadRequestException("Json Syntax Error while parsing properties from request. " + - "Please check that the properties are a json map from string to string.", e); + throw new BadRequestException("Json Syntax Error while parsing properties from request. " + + "Please check that the properties are a json map from string to string.", e); } catch (IOException e) { throw new BadRequestException("Unable to read properties from the request.", e); } if (properties == null) { throw new BadRequestException( - "Missing properties from the request. Please check that the request body " + - "is a json map from string to string."); + "Missing properties from the request. Please check that the request body " + + "is a json map from string to string."); } try { @@ -393,8 +393,8 @@ public void writeProperty(FullHttpRequest request, HttpResponder responder, @PathParam("artifact-name") String artifactName, @PathParam("artifact-version") String artifactVersion, @PathParam("property") String key) throws Exception { - NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) ? - NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); + NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) + ? NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); ArtifactId artifactId = validateAndGetArtifactId(namespace, artifactName, artifactVersion); String value = request.content().toString(StandardCharsets.UTF_8); @@ -443,8 +443,8 @@ public void deleteProperties(HttpRequest request, HttpResponder responder, @PathParam("artifact-name") String artifactName, @PathParam("artifact-version") String artifactVersion) throws Exception { - NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) ? - NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); + NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) + ? NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); ArtifactId artifactId = validateAndGetArtifactId(namespace, artifactName, artifactVersion); try { @@ -465,8 +465,8 @@ public void deleteProperty(HttpRequest request, HttpResponder responder, @PathParam("artifact-version") String artifactVersion, @PathParam("property") String key) throws Exception { - NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) ? - NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); + NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) + ? NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); ArtifactId artifactId = validateAndGetArtifactId(namespace, artifactName, artifactVersion); try { @@ -558,8 +558,8 @@ public void getArtifactPlugins(HttpRequest request, HttpResponder responder, } @GET - @Path("/namespaces/{namespace-id}/artifacts/{artifact-name}/" + - "versions/{artifact-version}/extensions/{plugin-type}/plugins/{plugin-name}") + @Path("/namespaces/{namespace-id}/artifacts/{artifact-name}/" + + "versions/{artifact-version}/extensions/{plugin-type}/plugins/{plugin-name}") public void getArtifactPlugin(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("artifact-name") String artifactName, @@ -591,10 +591,10 @@ public boolean apply(ArtifactId input) { // should check if the artifact is from SYSTEM namespace, if not, check if it is from the scoped namespace. // by default, the scoped namespace is for USER scope return (((pluginScope == null && NamespaceId.SYSTEM.equals(input.getParent())) - || pluginArtifactNamespace.equals(input.getParent())) && - (pluginArtifactName == null || pluginArtifactName.equals(input.getArtifact())) && - (pluginRange == null || pluginRange.versionIsInRange( - new ArtifactVersion(input.getVersion())))); + || pluginArtifactNamespace.equals(input.getParent())) + && (pluginArtifactName == null || pluginArtifactName.equals(input.getArtifact())) + && (pluginRange == null || pluginRange.versionIsInRange( + new ArtifactVersion(input.getVersion())))); } }; @@ -733,8 +733,8 @@ public BodyConsumer addArtifact(HttpRequest request, HttpResponder responder, @Override protected void onFinish(HttpResponder responder, File uploadedFile) { try { - String version = (artifactVersion == null || artifactVersion.isEmpty()) ? - getBundleVersion(uploadedFile) : artifactVersion; + String version = (artifactVersion == null || artifactVersion.isEmpty()) + ? getBundleVersion(uploadedFile) : artifactVersion; ArtifactId artifactId = validateAndGetArtifactId(namespace, artifactName, version); // add the artifact to the repo @@ -771,8 +771,8 @@ private String getBundleVersion(File file) throws BadRequestException, IOExcepti if (manifest == null) { throw new BadRequestException( "Unable to derive version from artifact because it does not contain a manifest. " - + - "Please package the jar with a manifest, or explicitly specify the artifact version."); + + + "Please package the jar with a manifest, or explicitly specify the artifact version."); } Attributes attributes = manifest.getMainAttributes(); String version = @@ -780,8 +780,8 @@ private String getBundleVersion(File file) throws BadRequestException, IOExcepti if (version == null) { throw new BadRequestException( "Unable to derive version from artifact because manifest does not contain Bundle-Version attribute. " - + - "Please include Bundle-Version in the manifest, or explicitly specify the artifact version."); + + + "Please include Bundle-Version in the manifest, or explicitly specify the artifact version."); } return version; } catch (ZipException e) { @@ -805,8 +805,8 @@ public void deleteArtifact(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("artifact-name") String artifactName, @PathParam("artifact-version") String artifactVersion) throws Exception { - NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) ? - NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); + NamespaceId namespace = NamespaceId.SYSTEM.getNamespace().equalsIgnoreCase(namespaceId) + ? NamespaceId.SYSTEM : validateAndGetNamespace(namespaceId); ArtifactId artifactId = validateAndGetArtifactId(namespace, artifactName, artifactVersion); try { @@ -885,8 +885,8 @@ private Set parseExtendsHeader(NamespaceId namespace, String exte try { range = ArtifactRanges.parseArtifactRange(parent); // only support extending an artifact that is in the same namespace, or system namespace - if (!NamespaceId.SYSTEM.getNamespace().equals(range.getNamespace()) && - !namespace.getNamespace().equals(range.getNamespace())) { + if (!NamespaceId.SYSTEM.getNamespace().equals(range.getNamespace()) + && !namespace.getNamespace().equals(range.getNamespace())) { throw new BadRequestException( String.format( "Parent artifact %s must be in the same namespace or a system artifact.", diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/MonitorHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/MonitorHandler.java index 13975e8cbdce..386f8ca37bda 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/MonitorHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/MonitorHandler.java @@ -269,8 +269,8 @@ public void updateServiceLogLevels(FullHttpRequest request, HttpResponder respon MasterServiceManager masterServiceManager = serviceManagementMap.get(serviceName); if (!masterServiceManager.isServiceEnabled()) { - throw new ForbiddenException(String.format("Failed to update log levels for service %s " + - "because the service is not enabled", serviceName)); + throw new ForbiddenException(String.format("Failed to update log levels for service %s " + + "because the service is not enabled", serviceName)); } try { @@ -280,8 +280,8 @@ public void updateServiceLogLevels(FullHttpRequest request, HttpResponder respon responder.sendStatus(HttpResponseStatus.OK); } catch (IllegalStateException ise) { throw new ServiceUnavailableException( - String.format("Failed to update log levels for service %s " + - "because the service may not be ready yet", serviceName)); + String.format("Failed to update log levels for service %s " + + "because the service may not be ready yet", serviceName)); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage()); } catch (JsonSyntaxException e) { @@ -306,8 +306,8 @@ public void resetServiceLogLevels(FullHttpRequest request, HttpResponder respond MasterServiceManager masterServiceManager = serviceManagementMap.get(serviceName); if (!masterServiceManager.isServiceEnabled()) { - throw new ForbiddenException(String.format("Failed to reset log levels for service %s " + - "because the service is not enabled", serviceName)); + throw new ForbiddenException(String.format("Failed to reset log levels for service %s " + + "because the service is not enabled", serviceName)); } try { @@ -317,8 +317,8 @@ public void resetServiceLogLevels(FullHttpRequest request, HttpResponder respond responder.sendStatus(HttpResponseStatus.OK); } catch (IllegalStateException ise) { throw new ServiceUnavailableException( - String.format("Failed to reset log levels for service %s " + - "because the service may not be ready yet", serviceName)); + String.format("Failed to reset log levels for service %s " + + "because the service may not be ready yet", serviceName)); } catch (JsonSyntaxException e) { throw new BadRequestException("Invalid Json in the body"); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/NamespaceHttpHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/NamespaceHttpHandler.java index 56a0a0906005..1382268d9882 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/NamespaceHttpHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/NamespaceHttpHandler.java @@ -136,8 +136,8 @@ public void delete(HttpRequest request, HttpResponder responder, if (!cConf.getBoolean(Constants.Dangerous.UNRECOVERABLE_RESET, Constants.Dangerous.DEFAULT_UNRECOVERABLE_RESET)) { responder.sendString(HttpResponseStatus.FORBIDDEN, - String.format("Namespace '%s' cannot be deleted because '%s' is not enabled. " + - "Please enable it and restart CDAP Master.", + String.format("Namespace '%s' cannot be deleted because '%s' is not enabled. " + + "Please enable it and restart CDAP Master.", namespace, Constants.Dangerous.UNRECOVERABLE_RESET)); return; } @@ -154,8 +154,8 @@ public void deleteDatasets(HttpRequest request, HttpResponder responder, Constants.Dangerous.DEFAULT_UNRECOVERABLE_RESET)) { responder.sendString(HttpResponseStatus.FORBIDDEN, String.format( - "All datasets in namespace %s cannot be deleted because '%s' is not enabled." + - " Please enable it and restart CDAP Master.", + "All datasets in namespace %s cannot be deleted because '%s' is not enabled." + + " Please enable it and restart CDAP Master.", namespace, Constants.Dangerous.UNRECOVERABLE_RESET)); return; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ProfileHttpHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ProfileHttpHandler.java index e4150da30b0f..f1d415c92988 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ProfileHttpHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ProfileHttpHandler.java @@ -348,8 +348,8 @@ private void validateProvisionerProperties(ProfileCreateRequest request) try { provisioningService.validateProperties(provisionerInfo.getName(), properties); } catch (NotFoundException e) { - throw new BadRequestException(String.format("The specified provisioner %s does not exist, " + - "thus cannot be associated with a profile", + throw new BadRequestException(String.format("The specified provisioner %s does not exist, " + + "thus cannot be associated with a profile", provisionerInfo.getName()), e); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage(), e); @@ -362,8 +362,8 @@ private String getTotalProcessingCpusLabel(ProvisionerInfo provisionerInfo) try { return provisioningService.getTotalProcessingCpusLabel(provisionerInfo.getName(), properties); } catch (NotFoundException e) { - throw new BadRequestException(String.format("The specified provisioner %s does not exist, " + - "thus cannot be associated with a profile", + throw new BadRequestException(String.format("The specified provisioner %s does not exist, " + + "thus cannot be associated with a profile", provisionerInfo.getName()), e); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ProgramLifecycleHttpHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ProgramLifecycleHttpHandler.java index eae16137b797..4dde6f14241a 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ProgramLifecycleHttpHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/ProgramLifecycleHttpHandler.java @@ -819,8 +819,8 @@ public void getProgramStatusSchedules(HttpRequest request, HttpResponder respond } } catch (Exception e) { throw new BadRequestException( - String.format("Unable to parse program statuses '%s'. Must be comma separated " + - "valid ProgramStatus names such as COMPLETED, FAILED, KILLED.", + String.format("Unable to parse program statuses '%s'. Must be comma separated " + + "valid ProgramStatus names such as COMPLETED, FAILED, KILLED.", triggerProgramStatuses), e); } } else { @@ -1712,8 +1712,8 @@ public void getRunCounts(FullHttpRequest request, HttpResponder responder, List programs = validateAndGetBatchInput(request, BATCH_PROGRAMS_TYPE); if (programs.size() > 100) { throw new BadRequestException( - String.format("%d programs found in the request, the maximum number " + - "supported is 100", programs.size())); + String.format("%d programs found in the request, the maximum number " + + "supported is 100", programs.size())); } List programRefs = programs.stream() diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/WorkflowStatsSLAHttpHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/WorkflowStatsSLAHttpHandler.java index 6cf208e2ea66..fe2c8a97cd71 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/WorkflowStatsSLAHttpHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/WorkflowStatsSLAHttpHandler.java @@ -109,8 +109,8 @@ public void workflowStats(HttpRequest request, HttpResponder responder, for (double i : percentiles) { if (i < 0.0 || i > 100.0) { throw new BadRequestException( - "Percentile values have to be greater than or equal to 0 and" + - " less than or equal to 100. Invalid input was " + Double.toString(i)); + "Percentile values have to be greater than or equal to 0 and" + + " less than or equal to 100. Invalid input was " + Double.toString(i)); } } WorkflowStatistics workflowStatistics = store.getWorkflowStatistics( @@ -158,14 +158,14 @@ public void workflowRunDetail(HttpRequest request, HttpResponder responder, timeInterval = TimeMathParser.resolutionInSeconds(interval); } catch (IllegalArgumentException e) { throw new BadRequestException( - "Interval is specified with invalid time unit. It should be specified with one" + - " of the 'ms', 's', 'm', 'h', 'd' units. Entered value was : " + interval); + "Interval is specified with invalid time unit. It should be specified with one" + + " of the 'ms', 's', 'm', 'h', 'd' units. Entered value was : " + interval); } if (timeInterval <= 0) { throw new BadRequestException( - "Interval should be greater than 0 and should be specified with one of the 'ms'," + - " 's', 'm', 'h', 'd' units. Entered value was : " + interval); + "Interval should be greater than 0 and should be specified with one of the 'ms'," + + " 's', 'm', 'h', 'd' units. Entered value was : " + interval); } Collection workflowRunRecords = store.retrieveSpacedRecords(new NamespaceId(namespaceId), appId, workflowId, runId, limit, diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/preview/PreviewHttpHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/preview/PreviewHttpHandler.java index 585e4c7e8ab4..050509ed7599 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/preview/PreviewHttpHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/gateway/handlers/preview/PreviewHttpHandler.java @@ -347,12 +347,12 @@ private void overrideQueries(Map String previewId) { for (MetricsQueryHelper.QueryRequestFormat format : query.values()) { Map tags = format.getTags(); - if (!tags.containsKey(MetricsQueryHelper.NAMESPACE_STRING) || - !tags.get(MetricsQueryHelper.NAMESPACE_STRING).equals(namespaceId)) { + if (!tags.containsKey(MetricsQueryHelper.NAMESPACE_STRING) + || !tags.get(MetricsQueryHelper.NAMESPACE_STRING).equals(namespaceId)) { tags.put(MetricsQueryHelper.NAMESPACE_STRING, namespaceId); } - if (!tags.containsKey(MetricsQueryHelper.APP_STRING) || - !tags.get(MetricsQueryHelper.APP_STRING).equals(previewId)) { + if (!tags.containsKey(MetricsQueryHelper.APP_STRING) + || !tags.get(MetricsQueryHelper.APP_STRING).equals(previewId)) { tags.put(MetricsQueryHelper.APP_STRING, previewId); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/ApplicationSpecificationAdapter.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/ApplicationSpecificationAdapter.java index d57c19cec609..b3ab2effb68e 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/ApplicationSpecificationAdapter.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/ApplicationSpecificationAdapter.java @@ -135,8 +135,8 @@ public static Set getProgramIds(ApplicationId appId, JsonReader reade String appName = reader.nextString(); if (!appId.getApplication().equals(appName)) { throw new IllegalArgumentException( - String.format("Application name in the specification is '%s' and it doesn't " + - "match with the provided application id '%s'", appName, + String.format("Application name in the specification is '%s' and it doesn't " + + "match with the provided application id '%s'", appName, appId.getApplication())); } break; @@ -181,8 +181,8 @@ private static final class AppSpecTypeAdapterFactory implements TypeAdapterFacto public TypeAdapter create(Gson gson, TypeToken type) { Class rawType = type.getRawType(); // note: we want ordered maps to remain ordered - if (!Map.class.isAssignableFrom(rawType) || - SortedMap.class.isAssignableFrom(rawType)) { + if (!Map.class.isAssignableFrom(rawType) + || SortedMap.class.isAssignableFrom(rawType)) { return null; } // For non-parameterized Map, use the default TypeAdapter diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/DefaultApplicationUpdateContext.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/DefaultApplicationUpdateContext.java index 1370235dea5f..5dcbeb4ee35f 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/DefaultApplicationUpdateContext.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/DefaultApplicationUpdateContext.java @@ -114,8 +114,8 @@ public C getConfig(Type configType) { // Given configtype has to be derived from Config class. Preconditions.checkArgument( Config.class.isAssignableFrom(TypeToken.of(configType).getRawType()), - "Application config type " + configType + " is not supported. " + - "Type must extend Config and cannot be parameterized."); + "Application config type " + configType + " is not supported. " + + "Type must extend Config and cannot be parameterized."); if (configString.isEmpty()) { try { return ((Class) TypeToken.of(configType).getRawType()).newInstance(); @@ -166,9 +166,9 @@ private List getScopedPluginArtifacts(String pluginType, String plug Predicate predicate = input -> { // Check if it is from the scoped namespace and should check if plugin is in given range if provided. - return (pluginArtifactNamespace.equals(input.getParent()) && - (pluginRange == null || pluginRange.versionIsInRange( - new ArtifactVersion(input.getVersion())))); + return (pluginArtifactNamespace.equals(input.getParent()) + && (pluginRange == null || pluginRange.versionIsInRange( + new ArtifactVersion(input.getVersion())))); }; try { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/InMemoryConfigurator.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/InMemoryConfigurator.java index fafd8a16bd14..d29b2255cd20 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/InMemoryConfigurator.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/InMemoryConfigurator.java @@ -221,23 +221,23 @@ private ConfigResponse createResponse(Application app, } catch (ClassNotFoundException e) { // Spark is not available, it is most likely caused by missing Spark in the platform throw new IllegalStateException( - "Missing Spark related class " + missingClass + - ". It may be caused by unavailability of Spark. " + - "Please verify environment variable " + Constants.SPARK_HOME + "Missing Spark related class " + missingClass + + ". It may be caused by unavailability of Spark. " + + "Please verify environment variable " + Constants.SPARK_HOME + " is set correctly", t); } // Spark is available, can be caused by incompatible Spark version throw new InvalidArtifactException( - "Missing Spark related class " + missingClass + - ". Configured to use Spark located at " + System.getenv(Constants.SPARK_HOME) + - ", which may be incompatible with the one required by the application", t); + "Missing Spark related class " + missingClass + + ". Configured to use Spark located at " + System.getenv(Constants.SPARK_HOME) + + ", which may be incompatible with the one required by the application", t); } // If Spark is available or the missing class is not a spark related class, // then the missing class is most likely due to some missing library in the artifact jar throw new InvalidArtifactException( - "Missing class " + missingClass + - ". It may be caused by missing dependency jar(s) in the artifact jar.", t); + "Missing class " + missingClass + + ". It may be caused by missing dependency jar(s) in the artifact jar.", t); } throw t; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/InMemoryProgramRunDispatcher.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/InMemoryProgramRunDispatcher.java index fa51f8653750..2c1ab131af38 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/InMemoryProgramRunDispatcher.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/InMemoryProgramRunDispatcher.java @@ -263,8 +263,8 @@ public ProgramController dispatchProgram(ProgramRunDispatcherContext dispatcherC // Do the app spec regeneration if the mode is on premise or if it's a tethered run. // For non-tethered run in isolated mode, the regeneration is done on the runtime environment before the program // launch. For preview we already have a resolved app spec, so no need to regenerate the app spec again - if (!isPreview && appSpec != null && - (ClusterMode.ON_PREMISE.equals(clusterMode) || tetheredRun)) { + if (!isPreview && appSpec != null + && (ClusterMode.ON_PREMISE.equals(clusterMode) || tetheredRun)) { RemoteClientFactory factory = remoteClientFactory; PluginFinder pf = pluginFinder; @@ -296,8 +296,8 @@ public ProgramController dispatchProgram(ProgramRunDispatcherContext dispatcherC if (!tetheredRun) { ArtifactDescriptor artifactDescriptor = artifactDetail.getDescriptor(); - if (artifactsComputeHash && (artifactsComputeHashSnapshot || - !artifactDescriptor.getArtifactId().getVersion().isSnapshot())) { + if (artifactsComputeHash && (artifactsComputeHashSnapshot + || !artifactDescriptor.getArtifactId().getVersion().isSnapshot())) { Hasher hasher = Hashing.sha256().newHasher(); hasher.putString(artifactDescriptor.getNamespace()); hasher.putString(artifactDescriptor.getArtifactId().getName()); @@ -576,10 +576,10 @@ private ProgramOptions createPluginSnapshot(ProgramOptions options, ProgramId pr * {@link Constants.AppFabric.ARTIFACTS_COMPUTE_HASH_SNAPSHOT} allows to compute hash on snapshots * which should only be used in testings. */ - boolean computeHash = artifactsComputeHash && !appSpec.getPlugins().isEmpty() && - (artifactsComputeHashSnapshot || - appSpec.getPlugins().values().stream() - .allMatch(plugin -> !plugin.getArtifactId().getVersion().isSnapshot())); + boolean computeHash = artifactsComputeHash && !appSpec.getPlugins().isEmpty() + && (artifactsComputeHashSnapshot + || appSpec.getPlugins().values().stream() + .allMatch(plugin -> !plugin.getArtifactId().getVersion().isSnapshot())); // Sort plugins based on keys so generated hashes remain identical SortedMap sortedMap = new TreeMap<>(appSpec.getPlugins()); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/ApplicationVerificationStage.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/ApplicationVerificationStage.java index 2f067ae1a2d4..0c2cc5a2c204 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/ApplicationVerificationStage.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/ApplicationVerificationStage.java @@ -200,8 +200,8 @@ protected void verifyPrograms(ApplicationId appId, ApplicationSpecification spec String programName = entry.getValue().getProgramName(); if (!specification.getWorkflows().containsKey(programName)) { throw new RuntimeException( - String.format("Schedule '%s' is invalid: Workflow '%s' is not configured " + - "in application '%s'", + String.format("Schedule '%s' is invalid: Workflow '%s' is not configured " + + "in application '%s'", entry.getValue().getName(), programName, specification.getName())); } } @@ -219,9 +219,9 @@ private void verifyWorkflowNode(ApplicationSpecification appSpec, WorkflowNodeType nodeType = node.getType(); // TODO CDAP-5640 Add check so that node id in the Workflow should not be same as name of the Workflow. if (node.getNodeId().equals(workflowSpec.getName())) { - String msg = String.format("Node used in Workflow has same name as that of Workflow '%s'." + - " This will conflict while getting the Workflow token details associated with" + - " the node. Please use name for the node other than the name of the Workflow.", + String msg = String.format("Node used in Workflow has same name as that of Workflow '%s'." + + " This will conflict while getting the Workflow token details associated with" + + " the node. Please use name for the node other than the name of the Workflow.", workflowSpec.getName()); LOG.warn(msg); } @@ -245,8 +245,8 @@ private void verifyWorkflowFork(ApplicationSpecification appSpec, WorkflowNode node, Set existingNodeNames) { WorkflowForkNode forkNode = (WorkflowForkNode) node; Preconditions.checkNotNull(forkNode.getBranches(), - String.format("Fork is added in the Workflow '%s' without" + - " any branches", workflowSpec.getName())); + String.format("Fork is added in the Workflow '%s' without" + + " any branches", workflowSpec.getName())); for (List branch : forkNode.getBranches()) { verifyWorkflowNodeList(appSpec, workflowSpec, branch, existingNodeNames); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/DeployDatasetModulesStage.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/DeployDatasetModulesStage.java index d84b7ff26e35..49d9b8eb6207 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/DeployDatasetModulesStage.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/DeployDatasetModulesStage.java @@ -90,8 +90,8 @@ public void process(ApplicationDeployable input) throws Exception { classLoader, authorizingUser); } } else if (deployer.hasNonSystemDatasetModules(datasetModules)) { - throw new IllegalStateException("Custom dataset module is not supported. " + - "One of the dataset module is a custom module: " + datasetModules); + throw new IllegalStateException("Custom dataset module is not supported. " + + "One of the dataset module is a custom module: " + datasetModules); } // Emit the input to next stage. diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/MetadataWriterStage.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/MetadataWriterStage.java index 33a9737e0009..1d6ca8fd9974 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/MetadataWriterStage.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/deploy/pipeline/MetadataWriterStage.java @@ -78,8 +78,8 @@ public void process(ApplicationWithPrograms input) { // add the rest user defined metadata Metadata userAppMetadata = input.getMetadata().get(MetadataScope.USER); - if (userAppMetadata != null && - (!userAppMetadata.getProperties().isEmpty() || !userAppMetadata.getTags().isEmpty())) { + if (userAppMetadata != null + && (!userAppMetadata.getProperties().isEmpty() || !userAppMetadata.getTags().isEmpty())) { mutations.add(new MetadataMutation.Create( appId.toMetadataEntity(), new io.cdap.cdap.spi.metadata.Metadata(MetadataScope.USER, userAppMetadata.getTags(), diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/AbstractStorageProviderNamespaceAdmin.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/AbstractStorageProviderNamespaceAdmin.java index b76b19ed4355..7918ada7b7ea 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/AbstractStorageProviderNamespaceAdmin.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/AbstractStorageProviderNamespaceAdmin.java @@ -84,8 +84,8 @@ private void deleteLocation(NamespaceId namespaceId) throws IOException { if (hasCustomLocation(namespaceQueryAdmin.get(namespaceId))) { LOG.debug( "Custom location mapping {} was found while deleting namespace {}. Deleting all data inside it but" - + - "skipping namespace home directory delete.", namespaceHome, namespaceId); + + + "skipping namespace home directory delete.", namespaceHome, namespaceId); // delete everything inside the namespace home but not the namespace home as its user owned directory Locations.deleteContent(namespaceHome); } else { @@ -224,16 +224,16 @@ private Location validateCustomLocation(NamespaceMeta namespaceMeta) throws IOEx if (!customNamespacedLocation.exists()) { throw new IOException(String.format( "The provided home directory '%s' for namespace '%s' does not exist. Please create it on filesystem " - + - "with sufficient privileges for the user %s and then try creating a namespace.", + + + "with sufficient privileges for the user %s and then try creating a namespace.", customNamespacedLocation.toString(), namespaceMeta.getNamespaceId(), namespaceMeta.getConfig().getPrincipal())); } if (!customNamespacedLocation.isDirectory()) { throw new IOException(String.format( "The provided home directory '%s' for namespace '%s' is not a directory. Please specify a directory for the " - + - "namespace with sufficient privileges for the user %s and then try creating a namespace.", + + + "namespace with sufficient privileges for the user %s and then try creating a namespace.", customNamespacedLocation.toString(), namespaceMeta.getNamespaceId(), namespaceMeta.getConfig().getPrincipal())); } @@ -241,8 +241,8 @@ private Location validateCustomLocation(NamespaceMeta namespaceMeta) throws IOEx if (!customNamespacedLocation.list().isEmpty()) { throw new IOException(String.format( "The provided home directory '%s' for namespace '%s' is not empty. Please try creating the namespace " - + - "again with an empty directory mapping and sufficient privileges for the user %s.", + + + "again with an empty directory mapping and sufficient privileges for the user %s.", customNamespacedLocation.toString(), namespaceMeta.getNamespaceId(), namespaceMeta.getConfig().getPrincipal())); } @@ -253,15 +253,16 @@ private Location validateCustomLocation(NamespaceMeta namespaceMeta) throws IOEx if (!groupName.equals(namespaceMeta.getConfig().getGroupName())) { LOG.warn( "The provided home directory '{}' for namespace '{}' has group '{}', which is different from " - + - "the configured group '{}' of the namespace.", customNamespacedLocation.toString(), + + + "the configured group '{}' of the namespace.", + customNamespacedLocation.toString(), namespaceMeta.getNamespaceId(), groupName, namespaceMeta.getConfig().getGroupName()); } if (!"rwx".equals(permissions)) { LOG.warn( "The provided home directory '{}' for namespace '{}' has group permissions of '{}'. It is " - + - "recommended to set the group permissions to 'rwx'", + + + "recommended to set the group permissions to 'rwx'", customNamespacedLocation.toString(), namespaceMeta.getNamespaceId(), permissions); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/DefaultNamespaceAdmin.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/DefaultNamespaceAdmin.java index 8d0ee41b4924..c80653fc79a7 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/DefaultNamespaceAdmin.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/DefaultNamespaceAdmin.java @@ -163,13 +163,13 @@ public synchronized void create(final NamespaceMeta metadata) throws Exception { String configuredPrincipal = metadata.getConfig().getPrincipal(); String configuredKeytabURI = metadata.getConfig().getKeytabURI(); if ((!Strings.isNullOrEmpty(configuredPrincipal) && Strings.isNullOrEmpty( - configuredKeytabURI)) || - (Strings.isNullOrEmpty(configuredPrincipal) && !Strings.isNullOrEmpty( - configuredKeytabURI))) { + configuredKeytabURI)) + || (Strings.isNullOrEmpty(configuredPrincipal) && !Strings.isNullOrEmpty( + configuredKeytabURI))) { throw new BadRequestException( String.format( - "Either both or none of the following two configurations must be configured. " + - "Configured principal: %s, Configured keytabURI: %s", + "Either both or none of the following two configurations must be configured. " + + "Configured principal: %s, Configured keytabURI: %s", configuredPrincipal, configuredKeytabURI)); } hasValidKerberosConf = true; @@ -224,20 +224,20 @@ private void validateCustomMapping(NamespaceMeta metadata) throws Exception { for (NamespaceMeta existingNamespaceMeta : list()) { NamespaceConfig existingConfig = existingNamespaceMeta.getConfig(); // if hbase namespace is provided validate no other existing namespace is mapped to it - if (!Strings.isNullOrEmpty(metadata.getConfig().getHbaseNamespace()) && - metadata.getConfig().getHbaseNamespace().equals(existingConfig.getHbaseNamespace())) { + if (!Strings.isNullOrEmpty(metadata.getConfig().getHbaseNamespace()) + && metadata.getConfig().getHbaseNamespace().equals(existingConfig.getHbaseNamespace())) { throw new BadRequestException( - String.format("A namespace '%s' already exists with the given " + - "namespace mapping for hbase namespace '%s'", + String.format("A namespace '%s' already exists with the given " + + "namespace mapping for hbase namespace '%s'", existingNamespaceMeta.getName(), existingConfig.getHbaseNamespace())); } // if hive database is provided validate no other existing namespace is mapped to it - if (!Strings.isNullOrEmpty(metadata.getConfig().getHiveDatabase()) && - metadata.getConfig().getHiveDatabase().equals(existingConfig.getHiveDatabase())) { + if (!Strings.isNullOrEmpty(metadata.getConfig().getHiveDatabase()) + && metadata.getConfig().getHiveDatabase().equals(existingConfig.getHiveDatabase())) { throw new BadRequestException( - String.format("A namespace '%s' already exists with the given " + - "namespace mapping for hive database '%s'", + String.format("A namespace '%s' already exists with the given " + + "namespace mapping for hive database '%s'", existingNamespaceMeta.getName(), existingConfig.getHiveDatabase())); } @@ -248,10 +248,10 @@ private void validateCustomMapping(NamespaceMeta metadata) throws Exception { // location or vice versa. if (hasSubDirRelationship(existingConfig.getRootDirectory(), metadata.getConfig().getRootDirectory())) { - throw new BadRequestException(String.format("Failed to create namespace %s with custom " + - "location %s. A namespace '%s' already exists " + - "with location '%s' and these two locations are " + - "have a subdirectory relationship.", + throw new BadRequestException(String.format("Failed to create namespace %s with custom " + + "location %s. A namespace '%s' already exists " + + "with location '%s' and these two locations are " + + "have a subdirectory relationship.", metadata.getName(), metadata.getConfig().getRootDirectory(), existingNamespaceMeta.getName(), @@ -263,15 +263,15 @@ private void validateCustomMapping(NamespaceMeta metadata) throws Exception { private boolean hasSubDirRelationship(@Nullable String existingDir, String newDir) { // only check for subdir if the existing namespace dir is custom mapped in which case this will not be null - return !Strings.isNullOrEmpty(existingDir) && - (Paths.get(newDir).startsWith(existingDir) || Paths.get(existingDir).startsWith(newDir)); + return !Strings.isNullOrEmpty(existingDir) + && (Paths.get(newDir).startsWith(existingDir) || Paths.get(existingDir).startsWith(newDir)); } private boolean hasCustomMapping(NamespaceMeta metadata) { NamespaceConfig config = metadata.getConfig(); return !(Strings.isNullOrEmpty(config.getRootDirectory()) && Strings.isNullOrEmpty( - config.getHbaseNamespace()) && - Strings.isNullOrEmpty(config.getHiveDatabase())); + config.getHbaseNamespace()) + && Strings.isNullOrEmpty(config.getHiveDatabase())); } private void validatePath(String namespace, String rootDir) throws IOException { @@ -301,17 +301,17 @@ public synchronized void delete(@Name("namespaceId") final NamespaceId namespace if (checkProgramsRunning(namespaceId)) { throw new NamespaceCannotBeDeletedException(namespaceId, - String.format("Some programs are currently running in namespace " + - "'%s', please stop them before deleting namespace", + String.format("Some programs are currently running in namespace " + + "'%s', please stop them before deleting namespace", namespaceId)); } List tetheredPeers = getTetheredPeersUsingNamespace(namespaceId); if (!tetheredPeers.isEmpty()) { throw new NamespaceCannotBeDeletedException(namespaceId, - String.format("Namespace '%s' is used in tethering connections " + - "with peers: %s. Delete tethering connections " + - "before deleting the namespace", + String.format("Namespace '%s' is used in tethering connections " + + "with peers: %s. Delete tethering connections " + + "before deleting the namespace", namespaceId, tetheredPeers)); } @@ -357,9 +357,9 @@ public synchronized void deleteDatasets(@Name("namespaceId") NamespaceId namespa if (checkProgramsRunning(namespaceId)) { throw new NamespaceCannotBeDeletedException(namespaceId, - String.format("Some programs are currently running in namespace " + - "'%s', please stop them before deleting datasets " + - "in the namespace.", + String.format("Some programs are currently running in namespace " + + "'%s', please stop them before deleting datasets " + + "in the namespace.", namespaceId)); } try { @@ -418,8 +418,8 @@ public synchronized void updateProperties(NamespaceId namespaceId, NamespaceMeta Set difference = existingMeta.getConfig().getDifference(config); if (!difference.isEmpty()) { throw new BadRequestException( - String.format("Mappings %s for namespace %s cannot be updated once the namespace " + - "is created.", difference, namespaceId)); + String.format("Mappings %s for namespace %s cannot be updated once the namespace " + + "is created.", difference, namespaceId)); } NamespaceMeta updatedMeta = builder.build(); nsStore.update(updatedMeta); @@ -473,8 +473,8 @@ public NamespaceMeta get(NamespaceId namespaceId) throws Exception { } catch (Exception e) { if (lastUnauthorizedException == null) { Throwable cause = e.getCause(); - if (cause instanceof NamespaceNotFoundException || cause instanceof IOException || - cause instanceof UnauthorizedException) { + if (cause instanceof NamespaceNotFoundException || cause instanceof IOException + || cause instanceof UnauthorizedException) { throw (Exception) cause; } throw e; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/DistributedStorageProviderNamespaceAdmin.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/DistributedStorageProviderNamespaceAdmin.java index 24d74fcb4a11..9ccfc9362108 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/DistributedStorageProviderNamespaceAdmin.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/namespace/DistributedStorageProviderNamespaceAdmin.java @@ -106,8 +106,8 @@ public void create(NamespaceMeta namespaceMeta) throws IOException, SQLException try (HBaseAdmin admin = new HBaseAdmin(hConf)) { if (!tableUtil.hasNamespace(admin, hbaseNamespace)) { throw new IOException( - String.format("HBase namespace '%s' specified for new namespace '%s' does not" + - " exist. Please specify an existing HBase namespace.", hbaseNamespace, + String.format("HBase namespace '%s' specified for new namespace '%s' does not" + + " exist. Please specify an existing HBase namespace.", hbaseNamespace, namespaceMeta.getName())); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/preview/DefaultPreviewRunner.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/preview/DefaultPreviewRunner.java index 16720e16132c..91ce6e0f9997 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/preview/DefaultPreviewRunner.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/preview/DefaultPreviewRunner.java @@ -350,8 +350,8 @@ protected void startUp() throws Exception { PreviewStatus status = new PreviewStatus( PreviewStatus.Status.KILLED_BY_EXCEEDING_MEMORY_LIMIT, submitTimeMillis, new BasicThrowable(new Exception( - "Preview runner container killed possibly because of out of memory. " + - "Please try running preview again.")), + "Preview runner container killed possibly because of out of memory. " + + "Please try running preview again.")), null, null); previewTerminated(programId, status); } catch (IOException e) { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/DefaultTaskLocalizationContext.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/DefaultTaskLocalizationContext.java index db1f7b2de0c0..5cc4ca5f757c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/DefaultTaskLocalizationContext.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/DefaultTaskLocalizationContext.java @@ -39,8 +39,8 @@ public DefaultTaskLocalizationContext(Map localizedResources) { public File getLocalFile(String name) throws FileNotFoundException { if (!localizedResources.containsKey(name)) { throw new FileNotFoundException( - String.format("The specified file %s was not found. Please make sure it was " + - "localized using context.localize().", name)); + String.format("The specified file %s was not found. Please make sure it was " + + "localized using context.localize().", name)); } return localizedResources.get(name); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/RemoteAppStateStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/RemoteAppStateStore.java index 16a9a383d922..bfa3472a54d7 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/RemoteAppStateStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/RemoteAppStateStore.java @@ -136,8 +136,8 @@ private void handleErrorResponse(int responseCode, String responseBody, case HttpURLConnection.HTTP_UNAVAILABLE: case HttpURLConnection.HTTP_GATEWAY_TIMEOUT: throw new ServiceUnavailableException(Constants.Service.APP_FABRIC_HTTP, - Constants.Service.APP_FABRIC_HTTP + - " service is not available with status " + responseCode); + Constants.Service.APP_FABRIC_HTTP + + " service is not available with status " + responseCode); case HttpURLConnection.HTTP_NOT_FOUND: throw new NotFoundException(notFoundExceptionMessage); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/SystemArguments.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/SystemArguments.java index 30acbe894b9c..1be72f58a25c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/SystemArguments.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/SystemArguments.java @@ -385,8 +385,8 @@ public static Map getTwillContainerConfigs(Map a } int heapMemory = containerMemory - reservedMemory; if (heapMemory <= 0) { - LOG.warn("Ignoring invalid reserved memory size '{}' from runtime arguments. " + - "It must be smaller than container memory size '{}'", reservedMemory, containerMemory); + LOG.warn("Ignoring invalid reserved memory size '{}' from runtime arguments. " + + "It must be smaller than container memory size '{}'", reservedMemory, containerMemory); return Collections.emptyMap(); } double ratio = ((double) heapMemory) / containerMemory; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactClassesWithMetadata.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactClassesWithMetadata.java index b5c8b9fb6a5f..a57c03b36faa 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactClassesWithMetadata.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactClassesWithMetadata.java @@ -55,8 +55,8 @@ public boolean equals(Object o) { } ArtifactClassesWithMetadata that = (ArtifactClassesWithMetadata) o; - return Objects.equals(artifactClasses, that.artifactClasses) && - Objects.equals(mutations, that.mutations); + return Objects.equals(artifactClasses, that.artifactClasses) + && Objects.equals(mutations, that.mutations); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactDescriptor.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactDescriptor.java index a7ebd88f62f1..4856129587f9 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactDescriptor.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactDescriptor.java @@ -82,12 +82,12 @@ public URI getLocationURI() { @Override public String toString() { - return "ArtifactDescriptor{" + - " artifactId=" + artifactId + - ", namespace=" + namespace + - ", locationURI=" + locationURI + - ", location=" + location + - '}'; + return "ArtifactDescriptor{" + + " artifactId=" + artifactId + + ", namespace=" + namespace + + ", locationURI=" + locationURI + + ", location=" + location + + '}'; } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactDetail.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactDetail.java index ebf064bfee63..41b39061729f 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactDetail.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactDetail.java @@ -50,8 +50,8 @@ public boolean equals(Object o) { } ArtifactDetail that = (ArtifactDetail) o; - return Objects.equals(descriptor, that.descriptor) && - Objects.equals(meta, that.meta); + return Objects.equals(descriptor, that.descriptor) + && Objects.equals(meta, that.meta); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactMeta.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactMeta.java index a5fc0fc812ce..640b89cb1d8e 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactMeta.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactMeta.java @@ -79,9 +79,9 @@ public boolean equals(Object o) { ArtifactMeta that = (ArtifactMeta) o; - return Objects.equals(classes, that.classes) && - Objects.equals(usableBy, that.usableBy) && - Objects.equals(getProperties(), that.getProperties()); + return Objects.equals(classes, that.classes) + && Objects.equals(usableBy, that.usableBy) + && Objects.equals(getProperties(), that.getProperties()); } @Override @@ -91,10 +91,10 @@ public int hashCode() { @Override public String toString() { - return "ArtifactMeta{" + - "classes=" + classes + - ", usableBy=" + usableBy + - ", properties=" + getProperties() + - '}'; + return "ArtifactMeta{" + + "classes=" + classes + + ", usableBy=" + usableBy + + ", properties=" + getProperties() + + '}'; } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactStore.java index 779b377d7d09..ac5f4bfa5683 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/ArtifactStore.java @@ -336,8 +336,8 @@ private R collectArtifacts(Iterator iterator, @Nullable Ar ArtifactData.class); ArtifactMeta filteredArtifactMeta = filterPlugins(data.meta); ArtifactId artifactId = new ArtifactId(artifactKey.name, e.getKey(), - artifactKey.namespace.equals(NamespaceId.SYSTEM.getNamespace()) ? - ArtifactScope.SYSTEM : ArtifactScope.USER); + artifactKey.namespace.equals(NamespaceId.SYSTEM.getNamespace()) + ? ArtifactScope.SYSTEM : ArtifactScope.USER); Location artifactLocation = Locations.getLocationFromAbsolutePath(locationFactory, data.getLocationPath()); return new ArtifactDetail( @@ -626,8 +626,8 @@ public SortedMap getPluginClasses( parentArtifactRange.getName()); } - SortedMap plugins = order == ArtifactSortOrder.DESC ? - new TreeMap<>(Collections.reverseOrder()) : + SortedMap plugins = order == ArtifactSortOrder.DESC + ? new TreeMap<>(Collections.reverseOrder()) : new TreeMap<>(); List parentArtifacts = new ArrayList<>(); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/Artifacts.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/Artifacts.java index 12d8a3c0589a..e23a7e788d81 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/Artifacts.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/Artifacts.java @@ -59,8 +59,8 @@ public static Type getConfigType(Class appClass) { // It has to be Config Preconditions.checkArgument(Config.class == configType.getRawType(), - "Application config type " + configType + " not supported. " + - "Type must extend Config and cannot be parameterized."); + "Application config type " + configType + " not supported. " + + "Type must extend Config and cannot be parameterized."); return Config.class; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/DefaultArtifactInspector.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/DefaultArtifactInspector.java index 6c792a3ec18d..354ea62030d7 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/DefaultArtifactInspector.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/DefaultArtifactInspector.java @@ -250,8 +250,8 @@ private ArtifactClasses.Builder inspectApplications(Id.Artifact artifactId, configType = Artifacts.getConfigType(app.getClass()); } catch (Exception e) { throw new InvalidArtifactException(String.format( - "Could not resolve config type for Application class %s in artifact %s. " + - "The type must extend Config and cannot be parameterized.", mainClassName, + "Could not resolve config type for Application class %s in artifact %s. " + + "The type must extend Config and cannot be parameterized.", mainClassName, artifactId)); } @@ -264,8 +264,8 @@ private ArtifactClasses.Builder inspectApplications(Id.Artifact artifactId, "Could not find Application main class %s in artifact %s.", mainClassName, artifactId)); } catch (UnsupportedTypeException e) { throw new InvalidArtifactException(String.format( - "Config for Application %s in artifact %s has an unsupported schema. " + - "The type must extend Config and cannot be parameterized.", mainClassName, + "Config for Application %s in artifact %s has an unsupported schema. " + + "The type must extend Config and cannot be parameterized.", mainClassName, artifactId)); } catch (InstantiationException | IllegalAccessException e) { throw new InvalidArtifactException(String.format( @@ -326,10 +326,10 @@ private void inspectPlugins(ArtifactClasses.Builder builder, File artifactFile, } } catch (Throwable t) { throw new InvalidArtifactException(String.format( - "Class could not be found while inspecting artifact for plugins. " + - "Please check dependencies are available, and that the correct parent artifact was specified. " - + - "Error class: %s, message: %s.", t.getClass(), t.getMessage()), t); + "Class could not be found while inspecting artifact for plugins. " + + "Please check dependencies are available, and that the correct parent artifact was specified. " + + + "Error class: %s, message: %s.", t.getClass(), t.getMessage()), t); } } @@ -591,9 +591,9 @@ private Collection createPluginProperties( Map properties = new HashMap<>(); if (PluginConfig.class.isAssignableFrom(rawType)) { if (!inspectNested) { - throw new IllegalArgumentException("Plugin config with name " + name + - " is a subclass of PluginGroupConfig and can " + - "only be defined within PluginConfig."); + throw new IllegalArgumentException("Plugin config with name " + name + + " is a subclass of PluginGroupConfig and can " + + "only be defined within PluginConfig."); } // don't inspect if the field is already nested inspectConfigField(fieldType, properties, false); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/DefaultArtifactRepository.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/DefaultArtifactRepository.java index ec20ba0ccb77..c9ff0d0ed482 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/DefaultArtifactRepository.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/DefaultArtifactRepository.java @@ -376,8 +376,8 @@ public void addSystemArtifacts() throws Exception { try { // read and parse the config file if it exists. Otherwise use an empty config with the artifact filename - ArtifactConfig artifactConfig = configFile.isFile() ? - configReader.read(artifactId.getNamespace(), configFile) : new ArtifactConfig(); + ArtifactConfig artifactConfig = configFile.isFile() + ? configReader.read(artifactId.getNamespace(), configFile) : new ArtifactConfig(); validateParentSet(artifactId, artifactConfig.getParents()); validatePluginSet(artifactConfig.getPlugins()); @@ -686,9 +686,9 @@ private List getParentArtifactDescriptors(Id.Artifact artifa Set grandparentRanges = parent.getMeta().getUsableBy(); for (ArtifactRange grandparentRange : grandparentRanges) { // if the parent as the child as a parent (cyclic dependency) - if (grandparentRange.getNamespace().equals(artifactId.getNamespace().getId()) && - grandparentRange.getName().equals(artifactId.getName()) && - grandparentRange.versionIsInRange(artifactId.getVersion())) { + if (grandparentRange.getNamespace().equals(artifactId.getNamespace().getId()) + && grandparentRange.getName().equals(artifactId.getName()) + && grandparentRange.versionIsInRange(artifactId.getVersion())) { throw new InvalidArtifactException(String.format( "Invalid artifact '%s': cyclic dependency. Parent '%s' has artifact '%s' as a parent.", artifactId, parent.getDescriptor().getArtifactId(), artifactId)); @@ -786,8 +786,8 @@ static void validateParentSet(Id.Artifact artifactId, Set parents dupes.add(parentName); isInvalid = true; } - if (artifactId.getName().equals(parentName) && - artifactId.getNamespace().toEntityId().getNamespace().equals(parent.getNamespace())) { + if (artifactId.getName().equals(parentName) + && artifactId.getNamespace().toEntityId().getNamespace().equals(parent.getNamespace())) { throw new InvalidArtifactException(String.format( "Invalid parent '%s' for artifact '%s'. An artifact cannot extend itself.", parent, artifactId)); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/RemoteIsolatedPluginFinder.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/RemoteIsolatedPluginFinder.java index 81d47b47ff6e..9a3ab3b97952 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/RemoteIsolatedPluginFinder.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/RemoteIsolatedPluginFinder.java @@ -68,8 +68,8 @@ protected Location getArtifactLocation(ArtifactId artifactId) artifactId.getNamespace(), artifactId.getArtifact(), artifactId.getVersion(), - artifactId.getNamespace().equalsIgnoreCase(NamespaceId.SYSTEM.getNamespace()) ? - ArtifactScope.SYSTEM.name().toLowerCase() : ArtifactScope.USER.name().toLowerCase()); + artifactId.getNamespace().equalsIgnoreCase(NamespaceId.SYSTEM.getNamespace()) + ? ArtifactScope.SYSTEM.name().toLowerCase() : ArtifactScope.USER.name().toLowerCase()); HttpURLConnection urlConn = remoteClientInternal.openConnection(HttpMethod.GET, url); @@ -78,8 +78,8 @@ protected Location getArtifactLocation(ArtifactId artifactId) if (responseCode != HttpURLConnection.HTTP_OK) { if (HttpCodes.isRetryable(responseCode)) { throw new ServiceUnavailableException( - Constants.Service.APP_FABRIC_HTTP, Constants.Service.APP_FABRIC_HTTP + - " service is not available with status " + responseCode); + Constants.Service.APP_FABRIC_HTTP, Constants.Service.APP_FABRIC_HTTP + + " service is not available with status " + responseCode); } if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { throw new ArtifactNotFoundException(artifactId); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/RemotePluginFinder.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/RemotePluginFinder.java index 460d69610581..e85f1f5e4099 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/RemotePluginFinder.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/artifact/RemotePluginFinder.java @@ -123,8 +123,8 @@ public Map.Entry findPlugin(NamespaceId pluginN } Location artifactLocation = getArtifactLocation( - Artifacts.toProtoArtifactId(selected.getKey().getScope().equals(ArtifactScope.SYSTEM) ? - NamespaceId.SYSTEM : pluginNamespaceId, + Artifacts.toProtoArtifactId(selected.getKey().getScope().equals(ArtifactScope.SYSTEM) + ? NamespaceId.SYSTEM : pluginNamespaceId, selected.getKey())); return Maps.immutableEntry(new ArtifactDescriptor(pluginNamespaceId.getEntityName(), selected.getKey(), artifactLocation), selected.getValue()); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/BasicMapReduceContext.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/BasicMapReduceContext.java index 63b8bd003359..3ba95c3eb672 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/BasicMapReduceContext.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/BasicMapReduceContext.java @@ -192,8 +192,8 @@ public void addInput(Input input, @Nullable Class mapperCls) { .equals(NamespaceId.SYSTEM.getNamespace()) && !getProgram().getNamespaceId().equals(NamespaceId.SYSTEM.getNamespace())) { // trying to access system namespace from a program outside system namespace is not allowed - throw new IllegalArgumentException(String.format("Accessing Input %s in system namespace " + - "is not allowed from the namespace %s", + throw new IllegalArgumentException(String.format("Accessing Input %s in system namespace " + + "is not allowed from the namespace %s", input.getName(), getProgram().getNamespaceId())); } if (input instanceof Input.DatasetInput) { @@ -216,8 +216,8 @@ public void addOutput(Output output) { .equals(NamespaceId.SYSTEM.getNamespace()) && !getProgram().getNamespaceId().equals(NamespaceId.SYSTEM.getNamespace())) { // trying to access system namespace from a program outside system namespace is not allowed - throw new IllegalArgumentException(String.format("Accessing Output %s in system namespace " + - "is not allowed from the namespace %s", + throw new IllegalArgumentException(String.format("Accessing Output %s in system namespace " + + "is not allowed from the namespace %s", output.getName(), getProgram().getNamespaceId())); } String alias = output.getAlias(); @@ -235,8 +235,8 @@ public void addOutput(Output output) { // disallow user from adding a DatasetOutputCommitter as an OutputFormatProviderOutput because we would not // be able to call its methods in MainOutputCommitter. It needs to be a DatasetOutput. throw new IllegalArgumentException( - "Cannot add a DatasetOutputCommitter as an OutputFormatProviderOutput. " + - "Add the output as a DatasetOutput."); + "Cannot add a DatasetOutputCommitter as an OutputFormatProviderOutput. " + + "Add the output as a DatasetOutput."); } providedOutput = new ProvidedOutput(output, outputFormatProvider); } else if (output.getClass().getCanonicalName().startsWith(CDAP_PACKAGE_PREFIX)) { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceLifecycleContext.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceLifecycleContext.java index 1056fda840bf..afe559a23fa9 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceLifecycleContext.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceLifecycleContext.java @@ -337,9 +337,9 @@ public void execute(int timeoutInSeconds, TxRunnable runnable) @Override public String toString() { - return "MapReduceLifecycleContext{" + - "delegate=" + delegate + - '}'; + return "MapReduceLifecycleContext{" + + "delegate=" + delegate + + '}'; } @Override @@ -378,15 +378,15 @@ public Metadata getMetadata(MetadataScope scope, MetadataEntity metadataEntity) @Override public void record(Collection operations) { throw new UnsupportedOperationException( - "Recording field lineage operations is not supported in " + - "MapReduce task-level context"); + "Recording field lineage operations is not supported in " + + "MapReduce task-level context"); } @Override public void flushLineage() { throw new UnsupportedOperationException( - "Recording field lineage operations is not supported in " + - "MapReduce task-level context"); + "Recording field lineage operations is not supported in " + + "MapReduce task-level context"); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceProgramController.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceProgramController.java index a43fc2a1c293..74da17e32c92 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceProgramController.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceProgramController.java @@ -45,8 +45,8 @@ public WorkflowToken getWorkflowToken() { BasicWorkflowToken workflowTokenFromContext = context.getWorkflowToken(); if (workflowTokenFromContext == null) { - throw new IllegalStateException("WorkflowToken cannot be null when the " + - "MapReduce program is started by Workflow."); + throw new IllegalStateException("WorkflowToken cannot be null when the " + + "MapReduce program is started by Workflow."); } try { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceProgramRunner.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceProgramRunner.java index 60bb75013bc8..0ba514ae55e3 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceProgramRunner.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceProgramRunner.java @@ -150,8 +150,8 @@ public ProgramController run(final Program program, ProgramOptions options) { RunId runId = ProgramRunners.getRunId(options); WorkflowProgramInfo workflowInfo = WorkflowProgramInfo.create(arguments); - DatasetFramework programDatasetFramework = workflowInfo == null ? - datasetFramework : + DatasetFramework programDatasetFramework = workflowInfo == null + ? datasetFramework : NameMappedDatasetFramework.createFromWorkflowProgramInfo(datasetFramework, workflowInfo, appSpec); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceRuntimeService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceRuntimeService.java index 12acca0f8004..894846e8aca7 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceRuntimeService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceRuntimeService.java @@ -639,9 +639,9 @@ private void assertConsistentTypes(Class firstMapperClass, if (!firstMapperClassOutputTypes.getKey().equals(mapperOutputKeyValueTypes.getKey()) || !firstMapperClassOutputTypes.getValue().equals(mapperOutputKeyValueTypes.getValue())) { throw new IllegalArgumentException( - String.format("Type mismatch in output type of mappers: %s and %s. " + - "Map output key types: %s and %s. " + - "Map output value types: %s and %s.", + String.format("Type mismatch in output type of mappers: %s and %s. " + + "Map output key types: %s and %s. " + + "Map output value types: %s and %s.", firstMapperClass, secondMapperClass, firstMapperClassOutputTypes.getKey(), mapperOutputKeyValueTypes.getKey(), firstMapperClassOutputTypes.getValue(), mapperOutputKeyValueTypes.getValue())); @@ -737,8 +737,8 @@ private void fixOutputPermissions(JobContext job, List outputs) if (mustFixUmasks) { LOG.info( "Overriding permissions of outputs {} because a umask of {} was set programmatically in the job " - + - "configuration.", outputsWithUmask, jobConfUmask); + + + "configuration.", outputsWithUmask, jobConfUmask); } } else if (allOutputsHaveUmask && allOutputsAgree) { // case 2: no programmatic umask in job conf, all outputs want the same umask: set it in job conf @@ -752,8 +752,8 @@ private void fixOutputPermissions(JobContext job, List outputs) if (mustFixUmasks) { LOG.warn( "Overriding permissions of outputs {} because they configure different permissions. Falling back " - + - "to default umask of {} in job configuration.", outputsWithUmask, jobConfUmask); + + + "to default umask of {} in job configuration.", outputsWithUmask, jobConfUmask); } } @@ -1174,8 +1174,8 @@ public void configure(Configuration conf, CConfiguration cConf, int reservedMemory = cConf.getInt(Configs.Keys.JAVA_RESERVED_MEMORY_MB); double minHeapRatio = cConf.getDouble(Configs.Keys.HEAP_RESERVED_MIN_RATIO); String maxHeapSource = - "from system configuration " + Configs.Keys.JAVA_RESERVED_MEMORY_MB + - " and " + Configs.Keys.HEAP_RESERVED_MIN_RATIO; + "from system configuration " + Configs.Keys.JAVA_RESERVED_MEMORY_MB + + " and " + Configs.Keys.HEAP_RESERVED_MIN_RATIO; // Optionally overrides the settings from the runtime arguments Map configs = SystemArguments.getTwillContainerConfigs(runtimeArgs, memoryMB); @@ -1200,8 +1200,8 @@ public void configure(Configuration conf, CConfiguration cConf, : conf.get(javaOptsKey, "") + " " + jvmOpts; conf.set(javaOptsKey, jvmOpts.trim()); - LOG.debug("MapReduce {} task container memory is {}MB, set {}. " + - "Maximum heap memory size of {}MB, set {}.{}", + LOG.debug("MapReduce {} task container memory is {}MB, set {}. " + + "Maximum heap memory size of {}MB, set {}.{}", name().toLowerCase(), memoryMB, memorySource, maxHeapSize, maxHeapSource, vcores > 0 ? " Virtual cores is " + vcores + ", set " + vcoreSource + "." : "."); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceTaskContextProvider.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceTaskContextProvider.java index 8ea91823345b..17b2fbf93ea5 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceTaskContextProvider.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapReduceTaskContextProvider.java @@ -221,8 +221,8 @@ public BasicMapReduceTaskContext load(ContextCacheKey key) throws Exception { } WorkflowProgramInfo workflowInfo = contextConfig.getWorkflowProgramInfo(); - DatasetFramework programDatasetFramework = workflowInfo == null ? - datasetFramework : + DatasetFramework programDatasetFramework = workflowInfo == null + ? datasetFramework : NameMappedDatasetFramework.createFromWorkflowProgramInfo(datasetFramework, workflowInfo, program.getApplicationSpecification()); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapperWrapper.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapperWrapper.java index b1f19e78cc03..60c23b9d732d 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapperWrapper.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/MapperWrapper.java @@ -132,8 +132,8 @@ public void run(Context context) throws IOException, InterruptedException { Throwable rootCause = Throwables.getRootCause(e); USERLOG.error( "Failed to initialize program '{}' with error: {}. Please check the system logs for more " - + - "details.", program, rootCause.getMessage(), rootCause); + + + "details.", program, rootCause.getMessage(), rootCause); throw new IOException( String.format("Failed to initialize mapper with %s", basicMapReduceContext), e); } finally { @@ -247,8 +247,8 @@ private Mapper createMapperInstance(ClassLoader classLoader, String userMapper, LOG.error("Failed to create instance of the user-defined Mapper class: " + userMapper); USERLOG.error( "Failed to create mapper instance for program '{}' with error: {}. Please check the system logs " - + - "for more details.", program, rootCause.getMessage(), rootCause); + + + "for more details.", program, rootCause.getMessage(), rootCause); throw Throwables.propagate(e); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/dataset/DatasetOutputFormatProvider.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/dataset/DatasetOutputFormatProvider.java index 36246dac4ec0..bcc01b6dd550 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/dataset/DatasetOutputFormatProvider.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/dataset/DatasetOutputFormatProvider.java @@ -45,8 +45,8 @@ public DatasetOutputFormatProvider(String namespace, String datasetName, this.outputFormatClassName = MapReduceBatchWritableOutputFormat.class.getName(); this.configuration = createDatasetConfiguration(namespace, datasetName, datasetArgs); } else { - throw new IllegalArgumentException("Dataset '" + dataset + - "' is neither OutputFormatProvider nor BatchWritable."); + throw new IllegalArgumentException("Dataset '" + dataset + + "' is neither OutputFormatProvider nor BatchWritable."); } this.dataset = dataset; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/dataset/input/BasicPartitionedFileSetInputContext.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/dataset/input/BasicPartitionedFileSetInputContext.java index 31e34fb69887..477736301f46 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/dataset/input/BasicPartitionedFileSetInputContext.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/batch/dataset/input/BasicPartitionedFileSetInputContext.java @@ -93,8 +93,8 @@ public PartitionKey getInputPartitionKey() { throw new IllegalStateException( String.format( "The value of '%s' in the configuration must be set by the RecordReader in case of using an " - + - "InputFormat that returns CombineFileSplit.", + + + "InputFormat that returns CombineFileSplit.", MRJobConfig.MAP_INPUT_FILE)); } if (!inputFileName.equals(currentInputfileName)) { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/AppFabricServiceManager.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/AppFabricServiceManager.java index 83f35bb55354..1094fdf6cab8 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/AppFabricServiceManager.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/AppFabricServiceManager.java @@ -171,8 +171,8 @@ private LogEntry.Level setLogLevel(LoggerContext context, String loggerName, private LoggerContext getLoggerContext() { ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory(); if (!(loggerFactory instanceof LoggerContext)) { - LOG.warn("LoggerFactory is not a logback LoggerContext. No log appender is added. " + - "Logback might not be in the classpath"); + LOG.warn("LoggerFactory is not a logback LoggerContext. No log appender is added. " + + "Logback might not be in the classpath"); return null; } return (LoggerContext) loggerFactory; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/DistributedProgramRunner.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/DistributedProgramRunner.java index 01aa09352288..0fe75b91d831 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/DistributedProgramRunner.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/DistributedProgramRunner.java @@ -692,8 +692,8 @@ private ProgramOptions updateProgramOptions(ProgramOptions options, if (localizeResources.containsKey(pluginArchiveFileName)) { newSystemArgs.put(ProgramOptionConstants.PLUGIN_ARCHIVE, pluginArchiveFileName); } - newSystemArgs.put(SystemArguments.PROFILE_PROPERTIES_PREFIX + - Constants.AppFabric.ARTIFACTS_COMPUTE_HASH_TIME_BUCKET_DAYS, + newSystemArgs.put(SystemArguments.PROFILE_PROPERTIES_PREFIX + + Constants.AppFabric.ARTIFACTS_COMPUTE_HASH_TIME_BUCKET_DAYS, String.valueOf(cConf.getInt(Constants.AppFabric.ARTIFACTS_COMPUTE_HASH_TIME_BUCKET_DAYS))); return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(newSystemArgs), diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/FireAndForgetTwillRunnerService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/FireAndForgetTwillRunnerService.java index e13a8091017c..362472ea1d18 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/FireAndForgetTwillRunnerService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/FireAndForgetTwillRunnerService.java @@ -72,8 +72,8 @@ public Iterable lookup(String applicationName) { @Override public Iterable lookupLive() { - throw new UnsupportedOperationException("The lookupLive method is not supported in " + - "FireAndForgetTwillRunnerService."); + throw new UnsupportedOperationException("The lookupLive method is not supported in " + + "FireAndForgetTwillRunnerService."); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionService.java index 5c63c0dc9742..1075b5925465 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionService.java @@ -150,8 +150,8 @@ protected long handleRetriesExhausted(Exception e) throws Exception { // If failed to fetch messages and the remote process is not running, emit a failure program state and // terminates the monitor programStateWriter.error(programRunId, - new IllegalStateException("Program runtime terminated due to too many failures. " + - "Please inspect logs for root cause.", e)); + new IllegalStateException("Program runtime terminated due to too many failures. " + + "Please inspect logs for root cause.", e)); throw e; } finally { cancellable.cancel(); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionTwillPreparer.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionTwillPreparer.java index 30c95aca2935..548187f2d648 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionTwillPreparer.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionTwillPreparer.java @@ -169,8 +169,8 @@ private void validateKerberos(@Nullable String principal, @Nullable String keyta try { klistPath = session.executeAndWait("which klist").trim(); } catch (IOException e) { - LOG.warn("Failed to locate klist command for Kerberos validation. " + - "If the Kerberos principal and keytab are mis-configured, program execution will fail.", + LOG.warn("Failed to locate klist command for Kerberos validation. " + + "If the Kerberos principal and keytab are mis-configured, program execution will fail.", e); return; } @@ -387,8 +387,8 @@ private String generateLaunchScript(String targetPath, String runnableName, } scriptWriter.printf( - "nohup java -Djava.io.tmpdir=tmp -Dcdap.runid=%s -cp %s/%s -Xmx%dm %s %s '%s' true %s " + - ">%s/stdout 2>%s/stderr &\n", + "nohup java -Djava.io.tmpdir=tmp -Dcdap.runid=%s -cp %s/%s -Xmx%dm %s %s '%s' true %s " + + ">%s/stdout 2>%s/stderr &\n", getProgramRunId().getRun(), targetPath, Constants.Files.LAUNCHER_JAR, memory, jvmOptions.getAMExtraOptions(), RemoteLauncher.class.getName(), diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionTwillRunnerService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionTwillRunnerService.java index 9a0e404d15bd..3c77c8bc216e 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionTwillRunnerService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteExecutionTwillRunnerService.java @@ -319,8 +319,8 @@ public Iterable getControllers() { public Cancellable scheduleSecureStoreUpdate(SecureStoreUpdater updater, long initialDelay, long delay, TimeUnit unit) { // This method is deprecated and not used in CDAP - throw new UnsupportedOperationException("The scheduleSecureStoreUpdate method is deprecated, " + - "use setSecureStoreRenewer instead"); + throw new UnsupportedOperationException("The scheduleSecureStoreUpdate method is deprecated, " + + "use setSecureStoreRenewer instead"); } @Override @@ -682,8 +682,8 @@ private RemoteExecutionTwillController createController(ProgramRunId programRunI Map systemArguments = programOpts.getArguments().asMap(); String provisionerName = SystemArguments.getProfileProvisioner(systemArguments); String peerName = systemArguments.get(ProgramOptionConstants.PEER_NAME); - boolean useControllerToStop = TetheringProvisioner.TETHERING_NAME.equals(provisionerName) && - peerName == null; + boolean useControllerToStop = TetheringProvisioner.TETHERING_NAME.equals(provisionerName) + && peerName == null; // Create the controller and start the runtime monitor when the startup task completed successfully. RemoteExecutionTwillController controller = new RemoteExecutionTwillController(cConf, programRunId, diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteLauncher.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteLauncher.java index 57f753eea76e..41c1b985c839 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteLauncher.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/distributed/remote/RemoteLauncher.java @@ -141,8 +141,8 @@ private static ClassLoader createContainerClassLoader(URL[] classpath) { throw new RuntimeException( "Failed to load container class loader class " + containerClassLoaderName, e); } catch (NoSuchMethodException e) { - throw new RuntimeException("Container class loader must have a public constructor with " + - "parameters (URL[] classpath, ClassLoader parent)", e); + throw new RuntimeException("Container class loader must have a public constructor with " + + "parameters (URL[] classpath, ClassLoader parent)", e); } catch (InstantiationException | InvocationTargetException | IllegalAccessException e) { throw new RuntimeException( "Failed to create container class loader of class " + containerClassLoaderName, e); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/k8s/PreviewRequestPollerInfo.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/k8s/PreviewRequestPollerInfo.java index 7a2c7cf97ed6..08db55df55ed 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/k8s/PreviewRequestPollerInfo.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/k8s/PreviewRequestPollerInfo.java @@ -42,9 +42,9 @@ public String getInstanceUid() { @Override public String toString() { - return "PreviewRequestPollerInfo{" + - "instanceId=" + instanceId + - ", instanceUid='" + instanceUid + '\'' + - '}'; + return "PreviewRequestPollerInfo{" + + "instanceId=" + instanceId + + ", instanceUid='" + instanceUid + '\'' + + '}'; } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeHandler.java index 85c3e9a66956..ebb2fb8680df 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeHandler.java @@ -72,8 +72,8 @@ /** * The http handler for handling runtime requests from the program runtime. */ -@Path(Constants.Gateway.INTERNAL_API_VERSION_3 + - "/runtime/namespaces/{namespace}/apps/{app}/versions/{version}/{program-type}/{program}/runs/{run}") +@Path(Constants.Gateway.INTERNAL_API_VERSION_3 + + "/runtime/namespaces/{namespace}/apps/{app}/versions/{version}/{program-type}/{program}/runs/{run}") public class RuntimeHandler extends AbstractHttpHandler { private static final Logger LOG = LoggerFactory.getLogger(RuntimeHandler.class); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeMonitors.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeMonitors.java index 9a5fbff7d18b..f8ad3166a853 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeMonitors.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeMonitors.java @@ -67,8 +67,8 @@ public static List createTopicNameList(CConfiguration cConf) { int totalTopicCount = Integer.parseInt(key.substring(idx + 1)); if (totalTopicCount <= 0) { throw new IllegalArgumentException( - "Total topic number must be positive for system topic config '" + - key + "'."); + "Total topic number must be positive for system topic config '" + + key + "'."); } // For metrics, We make an assumption that number of metrics topics on runtime are not different than // cdap system. So, we will add same number of topic configs as number of metrics topics so that we can diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeServiceRoutingHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeServiceRoutingHandler.java index f57911c104fd..d2c4ff6c9371 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeServiceRoutingHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/RuntimeServiceRoutingHandler.java @@ -73,8 +73,8 @@ /** * The http handler for routing CDAP service requests from program runtime. */ -@Path(Constants.Gateway.INTERNAL_API_VERSION_3 + - "/runtime/namespaces/{namespace}/apps/{app}/versions/{version}/{program-type}/{program}/runs/{run}") +@Path(Constants.Gateway.INTERNAL_API_VERSION_3 + + "/runtime/namespaces/{namespace}/apps/{app}/versions/{version}/{program-type}/{program}/runs/{run}") public class RuntimeServiceRoutingHandler extends AbstractHttpHandler { private static final Logger LOG = LoggerFactory.getLogger(RuntimeServiceRoutingHandler.class); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/plugin/PluginInstantiator.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/plugin/PluginInstantiator.java index 06bc45ce9e6a..60a50516435c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/plugin/PluginInstantiator.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/plugin/PluginInstantiator.java @@ -700,8 +700,8 @@ public void visit(Object instance, Type inspectType, Type declareType, Field fie for (String child : children) { PluginPropertyField childProperty = pluginClass.getProperties().get(child); // if child property is required and it is missing, add it to missing properties and continue - if (childProperty.isRequired() && !macroFields.contains(child) && - !properties.getProperties().containsKey(child)) { + if (childProperty.isRequired() && !macroFields.contains(child) + && !properties.getProperties().containsKey(child)) { missingProperties.add(child); missing = true; continue; @@ -794,9 +794,9 @@ private Object convertValue(String name, Type declareType, TypeToken fieldTyp } catch (InvocationTargetException e) { if (e.getCause() instanceof NumberFormatException) { // if exception is due to wrong value for integer/double conversion - String errorMessage = Strings.isNullOrEmpty(value) ? - String.format("Value of field %s.%s is null or empty. It should be a number", - declareType, name) : + String errorMessage = Strings.isNullOrEmpty(value) + ? String.format("Value of field %s.%s is null or empty. It should be a number", + declareType, name) : String.format("Value of field %s.%s is expected to be a number", declareType, name); throw new InvalidPluginConfigException(errorMessage, e.getCause()); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/DefaultScheduleBuilder.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/DefaultScheduleBuilder.java index c30ca5698551..ea0efdd6969b 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/DefaultScheduleBuilder.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/DefaultScheduleBuilder.java @@ -199,8 +199,8 @@ private ScheduleCreationBuilder(String name, String description, String programN @Override public Trigger getTrigger() { throw new UnsupportedOperationException( - String.format("Schedule %s does not have a trigger because it is " + - "missing a defined namespace and application environment", + String.format("Schedule %s does not have a trigger because it is " + + "missing a defined namespace and application environment", getName())); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramSchedule.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramSchedule.java index 84b0dfb5c468..af0f221babba 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramSchedule.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramSchedule.java @@ -102,13 +102,13 @@ public boolean equals(Object o) { } ProgramSchedule that = (ProgramSchedule) o; - return Objects.equal(this.scheduleId, that.scheduleId) && - Objects.equal(this.programId, that.programId) && - Objects.equal(this.description, that.description) && - Objects.equal(this.properties, that.properties) && - Objects.equal(this.trigger, that.trigger) && - Objects.equal(this.constraints, that.constraints) && - Objects.equal(this.timeoutMillis, that.timeoutMillis); + return Objects.equal(this.scheduleId, that.scheduleId) + && Objects.equal(this.programId, that.programId) + && Objects.equal(this.description, that.description) + && Objects.equal(this.properties, that.properties) + && Objects.equal(this.trigger, that.trigger) + && Objects.equal(this.constraints, that.constraints) + && Objects.equal(this.timeoutMillis, that.timeoutMillis); } @Override @@ -119,15 +119,15 @@ public int hashCode() { @Override public String toString() { - return "ProgramSchedule{" + - "scheduleId=" + scheduleId + - ", programId=" + programId + - ", description='" + description + '\'' + - ", properties=" + properties + - ", trigger=" + trigger + - ", constraints=" + constraints + - ", timeoutMillis=" + timeoutMillis + - '}'; + return "ProgramSchedule{" + + "scheduleId=" + scheduleId + + ", programId=" + programId + + ", description='" + description + '\'' + + ", properties=" + properties + + ", trigger=" + trigger + + ", constraints=" + constraints + + ", timeoutMillis=" + timeoutMillis + + '}'; } public ScheduleDetail toScheduleDetail() { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramScheduleMeta.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramScheduleMeta.java index afa53e092eef..00e33d7b47fc 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramScheduleMeta.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramScheduleMeta.java @@ -50,8 +50,8 @@ public boolean equals(Object o) { ProgramScheduleMeta that = (ProgramScheduleMeta) o; - return Objects.equal(this.lastUpdated, that.lastUpdated) && - Objects.equal(this.status, that.status); + return Objects.equal(this.lastUpdated, that.lastUpdated) + && Objects.equal(this.status, that.status); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramScheduleRecord.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramScheduleRecord.java index 78cd23c5226f..e69626442419 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramScheduleRecord.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/ProgramScheduleRecord.java @@ -53,8 +53,8 @@ public boolean equals(Object o) { ProgramScheduleRecord that = (ProgramScheduleRecord) o; - return Objects.equal(this.schedule, that.schedule) && - Objects.equal(this.meta, that.meta); + return Objects.equal(this.schedule, that.schedule) + && Objects.equal(this.meta, that.meta); } @Override @@ -64,10 +64,10 @@ public int hashCode() { @Override public String toString() { - return "ProgramScheduleRecord{" + - "schedule=" + schedule + - ", meta=" + meta + - '}'; + return "ProgramScheduleRecord{" + + "schedule=" + schedule + + ", meta=" + meta + + '}'; } public ScheduleDetail toScheduleDetail() { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/TimeScheduler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/TimeScheduler.java index 25b322b6d52a..00aae4f77490 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/TimeScheduler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/TimeScheduler.java @@ -244,8 +244,8 @@ private void assertTriggerDoesNotExist(TriggerKey triggerKey) // We do not need to check for same schedule in the current list as its already checked in app configuration stage if (scheduler.checkExists(triggerKey)) { throw new ObjectAlreadyExistsException( - "Unable to store Trigger with name " + triggerKey.getName() + - "because one already exists with this identification."); + "Unable to store Trigger with name " + triggerKey.getName() + + "because one already exists with this identification."); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/JobKey.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/JobKey.java index e4bee57953a0..7267b32df0d6 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/JobKey.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/JobKey.java @@ -57,8 +57,8 @@ public boolean equals(Object o) { JobKey that = (JobKey) o; - return Objects.equal(this.scheduleId, that.scheduleId) && - Objects.equal(this.generationId, that.generationId); + return Objects.equal(this.scheduleId, that.scheduleId) + && Objects.equal(this.generationId, that.generationId); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/JobQueueTable.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/JobQueueTable.java index 17bf7ba72489..19cc03e7669d 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/JobQueueTable.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/JobQueueTable.java @@ -291,11 +291,11 @@ public void close() { /** * Construct a Job object from the rows in iterator. A job may need up to three rows from the - * iterator for its construction - - *
    - *
  • Row JOB - the row containing the job data, required
  • - *
  • Row DELETE - the row containing the time when the job was marked for deletion, optional
  • - *
  • Row OBSOLETE - the row containing the time when the job was marked as obsolete, optional
  • + * iterator for its construction + * - *
      + *
    • Row JOB - the row containing the job data, required
    • + *
    • Row DELETE - the row containing the time when the job was marked for deletion, optional
    • + *
    • Row OBSOLETE - the row containing the time when the job was marked as obsolete, optional
    • *
    * The above three rows will always be next to each other due to sorting. * @@ -312,8 +312,8 @@ private Job toJob(PeekingIterator peekingIterator) { // Also get the generationId to only read the rows for the current job int generationId = getGenerationId(peekingIterator.peek()); // Get all the rows for the current job from the iterator - while (peekingIterator.hasNext() && generationId == getGenerationId(peekingIterator.peek()) && - scheduleId.equals(getScheduleId(peekingIterator.peek()))) { + while (peekingIterator.hasNext() && generationId == getGenerationId(peekingIterator.peek()) + && scheduleId.equals(getScheduleId(peekingIterator.peek()))) { StructuredRow row = peekingIterator.next(); StoreDefinition.JobQueueStore.RowType rowType = getRowType(row); switch (rowType) { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/SimpleJob.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/SimpleJob.java index 220d97bfa368..37b78b0e10cd 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/SimpleJob.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/queue/SimpleJob.java @@ -97,13 +97,13 @@ public boolean equals(Object o) { SimpleJob that = (SimpleJob) o; - return Objects.equal(this.schedule, that.schedule) && - Objects.equal(this.creationTime, that.creationTime) && - Objects.equal(this.jobKey, that.jobKey) && - Objects.equal(this.notifications, that.notifications) && - Objects.equal(this.state, that.state) && - Objects.equal(this.scheduleLastUpdatedTime, that.scheduleLastUpdatedTime) && - Objects.equal(this.deleteTimeMillis, that.deleteTimeMillis); + return Objects.equal(this.schedule, that.schedule) + && Objects.equal(this.creationTime, that.creationTime) + && Objects.equal(this.jobKey, that.jobKey) + && Objects.equal(this.notifications, that.notifications) + && Objects.equal(this.state, that.state) + && Objects.equal(this.scheduleLastUpdatedTime, that.scheduleLastUpdatedTime) + && Objects.equal(this.deleteTimeMillis, that.deleteTimeMillis); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/DatasetBasedTimeScheduleStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/DatasetBasedTimeScheduleStore.java index ba5b492b2e12..d9d84b75835c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/DatasetBasedTimeScheduleStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/DatasetBasedTimeScheduleStore.java @@ -305,8 +305,8 @@ private void readSchedulesFromPersistentStore() throws Exception { TriggerStatusV2 trigger = (TriggerStatusV2) SerializationUtils.deserialize( iterator.next().getBytes(StoreDefinition.TimeScheduleStore.VALUE_FIELD)); - if (trigger.state.equals(Trigger.TriggerState.NORMAL) || - trigger.state.equals(Trigger.TriggerState.PAUSED)) { + if (trigger.state.equals(Trigger.TriggerState.NORMAL) + || trigger.state.equals(Trigger.TriggerState.PAUSED)) { triggers.add(trigger); LOG.debug("Schedule: trigger with key {} added", trigger.trigger.getKey()); } else { @@ -341,8 +341,8 @@ private void readSchedulesFromPersistentStore() throws Exception { } for (TriggerKey key : triggersWithNoJob) { - LOG.error(String.format("No Job was found for the Trigger key '%s'." + - " Deleting the trigger entry from the store.", key)); + LOG.error(String.format("No Job was found for the Trigger key '%s'." + + " Deleting the trigger entry from the store.", key)); executeDelete(key); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/ProgramScheduleStoreDataset.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/ProgramScheduleStoreDataset.java index 7d635e20d06c..06fea4c9d8ae 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/ProgramScheduleStoreDataset.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/ProgramScheduleStoreDataset.java @@ -365,8 +365,9 @@ public List modifySchedulesTriggeredByDeletedProgram(ProgramId scheduleRecord.getMeta().getStatus(), System.currentTimeMillis()); } catch (AlreadyExistsException e) { // this should never happen - LOG.warn("Failed to add the schedule '{}' triggered by '{}' with updated trigger '{}', " + - "skip adding this schedule.", schedule.getScheduleId(), programId, updatedTrigger, e); + LOG.warn("Failed to add the schedule '{}' triggered by '{}' with updated trigger '{}', " + + "skip adding this schedule.", schedule.getScheduleId(), programId, updatedTrigger, + e); } } else { deleted.add(schedule); @@ -438,10 +439,10 @@ public List listSchedulesSuspended(NamespaceId namespaceId, lon long endTimeMillis) throws IOException { Predicate predicate = - row -> row.getLong(StoreDefinition.ProgramScheduleStore.UPDATE_TIME) >= startTimeMillis && - row.getLong(StoreDefinition.ProgramScheduleStore.UPDATE_TIME) < endTimeMillis && - ProgramScheduleStatus.SUSPENDED.toString() - .equals(row.getString(StoreDefinition.ProgramScheduleStore.STATUS)); + row -> row.getLong(StoreDefinition.ProgramScheduleStore.UPDATE_TIME) >= startTimeMillis + && row.getLong(StoreDefinition.ProgramScheduleStore.UPDATE_TIME) < endTimeMillis + && ProgramScheduleStatus.SUSPENDED.toString() + .equals(row.getString(StoreDefinition.ProgramScheduleStore.STATUS)); return listSchedulesWithPrefixAndKeyPredicate(getScheduleKeysForNamespaceScan(namespaceId), predicate); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/Schedulers.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/Schedulers.java index 9383a55f8f6d..990bda2fb9a3 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/Schedulers.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/Schedulers.java @@ -108,8 +108,8 @@ public static String getQuartzCronExpression(String cronEntry) { // CronExpression will directly be used for tests. String parts[] = cronEntry.split(" "); Preconditions.checkArgument(parts.length == 5 || parts.length == 6, - "Invalid cron entry format in '%s'. " + - "Cron entry must contain 5 or 6 fields.", cronEntry); + "Invalid cron entry format in '%s'. " + + "Cron entry must contain 5 or 6 fields.", cronEntry); if (parts.length == 5) { // Convert cron entry format to Quartz format by replacing wild-card character "*" // if day-of-the-month is not "?" and day-of-the-week is wild-card, replace day-of-the-week with "?" diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/UpgradeValueLoader.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/UpgradeValueLoader.java index be10f7b8d817..b5c214ad12c9 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/UpgradeValueLoader.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/store/UpgradeValueLoader.java @@ -75,8 +75,8 @@ public void apply() throws Exception { } }); } catch (Exception ex) { - LIMITED_LOGGER.debug("Upgrade Check got an exception while trying to read the " + - "upgrade version of {} table.", name, ex); + LIMITED_LOGGER.debug("Upgrade Check got an exception while trying to read the " + + "upgrade version of {} table.", name, ex); } return resultFlag.get(); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/AbstractCompositeTriggerBuilder.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/AbstractCompositeTriggerBuilder.java index 1328665ddc6e..1d137d4bde06 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/AbstractCompositeTriggerBuilder.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/AbstractCompositeTriggerBuilder.java @@ -42,8 +42,8 @@ protected SatisfiableTrigger[] getBuiltTriggers(String namespace, String applica SatisfiableTrigger[] builtTriggers = new SatisfiableTrigger[numTriggers]; for (int i = 0; i < numTriggers; i++) { Trigger trigger = triggers[i]; - builtTriggers[i] = trigger instanceof TriggerBuilder ? - ((TriggerBuilder) trigger).build(namespace, applicationName, applicationVersion) + builtTriggers[i] = trigger instanceof TriggerBuilder + ? ((TriggerBuilder) trigger).build(namespace, applicationName, applicationVersion) : (SatisfiableTrigger) trigger; } return builtTriggers; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/AndTrigger.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/AndTrigger.java index af9906fcf976..331d38db8b5d 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/AndTrigger.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/AndTrigger.java @@ -60,8 +60,9 @@ public List getTriggerInfos(TriggerInfoContext context) { public SatisfiableTrigger getTriggerWithDeletedProgram(ProgramId programId) { List updatedTriggers = new ArrayList<>(); for (SatisfiableTrigger trigger : getTriggers()) { - if (trigger instanceof ProgramStatusTrigger && - programId.isSameProgramExceptVersion(((ProgramStatusTrigger) trigger).getProgramId())) { + if (trigger instanceof ProgramStatusTrigger + && programId.isSameProgramExceptVersion( + ((ProgramStatusTrigger) trigger).getProgramId())) { // this program status trigger will never be satisfied, so the current AND trigger will never be satisfied return null; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/OrTrigger.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/OrTrigger.java index fadc1aa70470..556194a3fdee 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/OrTrigger.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/OrTrigger.java @@ -59,8 +59,9 @@ public List getTriggerInfos(TriggerInfoContext context) { public SatisfiableTrigger getTriggerWithDeletedProgram(ProgramId programId) { List updatedTriggers = new ArrayList<>(); for (SatisfiableTrigger trigger : getTriggers()) { - if (trigger instanceof ProgramStatusTrigger && - programId.isSameProgramExceptVersion(((ProgramStatusTrigger) trigger).getProgramId())) { + if (trigger instanceof ProgramStatusTrigger + && programId.isSameProgramExceptVersion( + ((ProgramStatusTrigger) trigger).getProgramId())) { // this program status trigger will never be satisfied, skip adding it to updatedTriggers continue; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/service/http/DelayedHttpServiceResponder.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/service/http/DelayedHttpServiceResponder.java index cdaf58985788..50e6bf89e9c3 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/service/http/DelayedHttpServiceResponder.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/service/http/DelayedHttpServiceResponder.java @@ -89,9 +89,9 @@ protected void doSend(int status, String contentType, @Nullable HttpContentProducer contentProducer, @Nullable HttpHeaders headers) { Preconditions.checkState(!closed, - "Responder is already closed. " + - "This may due to either using a HttpServiceResponder inside HttpContentProducer or " + - "not using HttpServiceResponder provided to the HttpContentConsumer onFinish/onError method."); + "Responder is already closed. " + + "This may due to either using a HttpServiceResponder inside HttpContentProducer or " + + "not using HttpServiceResponder provided to the HttpContentConsumer onFinish/onError method."); if (bufferedResponse != null) { LOG.warn( diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/workflow/BasicWorkflowToken.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/workflow/BasicWorkflowToken.java index 8add7953dc08..a3c0e257f87e 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/workflow/BasicWorkflowToken.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/workflow/BasicWorkflowToken.java @@ -147,8 +147,8 @@ public synchronized void put(String key, Value value) { private void put(String key, Value value, Scope scope) { if (!putAllowed) { String msg = String.format( - "Failed to put key '%s' from node '%s' in the WorkflowToken. Put operation is not " + - "allowed from the Mapper and Reducer classes and from Spark executor.", key, + "Failed to put key '%s' from node '%s' in the WorkflowToken. Put operation is not " + + "allowed from the Mapper and Reducer classes and from Spark executor.", key, nodeName); throw new UnsupportedOperationException(msg); } @@ -321,10 +321,10 @@ private void addOrUpdate(String key, NodeValue nodeValue, List nodeVa left = (left < 0 || index >= 0) ? left : left - key.length(); if (left < 0) { throw new IllegalStateException( - String.format("Exceeded maximum permitted size of workflow token '%sMB' while " + - "adding key '%s' with value '%s'. Current size is '%sMB'. " + - "Please increase the maximum permitted size by setting the " + - "parameter '%s' in cdap-site.xml to add more values.", + String.format("Exceeded maximum permitted size of workflow token '%sMB' while " + + "adding key '%s' with value '%s'. Current size is '%sMB'. " + + "Please increase the maximum permitted size by setting the " + + "parameter '%s' in cdap-site.xml to add more values.", maxSizeBytes / (1024 * 1024), key, nodeValue, (maxSizeBytes - bytesLeft) / (1024 * 1024), Constants.AppFabric.WORKFLOW_TOKEN_MAX_SIZE_MB)); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/workflow/NameMappedDatasetFramework.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/workflow/NameMappedDatasetFramework.java index d993ac757d60..8a4019417b1c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/workflow/NameMappedDatasetFramework.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/runtime/workflow/NameMappedDatasetFramework.java @@ -58,7 +58,7 @@ public static NameMappedDatasetFramework createFromWorkflowProgramInfo( } /** - * Creates a new instance which maps the given set of dataset names by appending ("." + + * Creates a new instance which maps the given set of dataset names by appending ("." + * * nameSuffix). */ public NameMappedDatasetFramework(DatasetFramework delegate, Set datasets, diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/ApplicationLifecycleService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/ApplicationLifecycleService.java index ac1ab664c9d7..79761c35a1f6 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/ApplicationLifecycleService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/ApplicationLifecycleService.java @@ -372,8 +372,8 @@ public ApplicationDetail getLatestAppDetail(ApplicationReference appRef, return enforceApplicationDetailAccess(appId, ApplicationDetail.fromSpec(appMeta.getSpec(), ownerPrincipal, appMeta.getChange(), - getSourceControlMeta ? - appMeta.getSourceControlMeta() : null)); + getSourceControlMeta + ? appMeta.getSourceControlMeta() : null)); } /** @@ -512,8 +512,8 @@ public ApplicationWithPrograms updateApp(ApplicationId appId, AppRequest appRequ } if (!currentArtifact.getScope().equals(requestedArtifact.getScope())) { - throw new InvalidArtifactException("Only artifact version updates are allowed. " + - "Cannot change from a non-system artifact to a system artifact or vice versa."); + throw new InvalidArtifactException("Only artifact version updates are allowed. " + + "Cannot change from a non-system artifact to a system artifact or vice versa."); } // check requested artifact version is valid @@ -533,8 +533,8 @@ public ApplicationWithPrograms updateApp(ApplicationId appId, AppRequest appRequ Object requestedConfigObj = appRequest.getConfig(); // if config is null, use the previous config. Shouldn't use a static GSON since the request Config object can // be a user class, otherwise there will be ClassLoader leakage. - String requestedConfigStr = requestedConfigObj == null ? - currentSpec.getConfiguration() : new Gson().toJson(requestedConfigObj); + String requestedConfigStr = requestedConfigObj == null + ? currentSpec.getConfiguration() : new Gson().toJson(requestedConfigObj); Id.Artifact artifactId = Id.Artifact.fromEntityId( Artifacts.toProtoArtifactId(appId.getParent(), newArtifactId)); @@ -998,8 +998,8 @@ public ApplicationWithPrograms deployApp(NamespaceId namespace, @Nullable String } return deployApp(namespace, appName, appVersion, configStr, changeSummary, sourceControlMeta, programTerminator, - artifactDetail.get(0), ownerPrincipal, updateSchedules == null ? - appUpdateSchedules : updateSchedules, isPreview, userProps); + artifactDetail.get(0), ownerPrincipal, updateSchedules == null + ? appUpdateSchedules : updateSchedules, isPreview, userProps); } /** @@ -1348,8 +1348,8 @@ private void deleteApp(ApplicationId appId, ApplicationSpecification spec) throw } catch (Exception e) { LOG.warn( "Failed to delete app owner principal for application {} if one existed while deleting the " - + - "application.", appId); + + + "application.", appId); } try { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/ProgramLifecycleService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/ProgramLifecycleService.java index 0040033b8f25..9762aa84302f 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/ProgramLifecycleService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/ProgramLifecycleService.java @@ -737,8 +737,8 @@ public RunId runInternal(ProgramId programId, Map userArgs, } if (maxConcurrentLaunching >= 0 && maxConcurrentLaunching < counter.getLaunchingCount()) { - String msg = String.format("Program %s cannot start because the maximum of %d concurrent " + - "provisioning/starting runs is allowed", programId, maxConcurrentLaunching); + String msg = String.format("Program %s cannot start because the maximum of %d concurrent " + + "provisioning/starting runs is allowed", programId, maxConcurrentLaunching); LOG.info(msg); TooManyRequestsException e = new TooManyRequestsException(msg); @@ -770,8 +770,8 @@ ProgramOptions createProgramOptions(ProgramId programId, Map use Profile profile = profileService.getProfile(profileId, profileProperties); if (profile.getStatus() == ProfileStatus.DISABLED) { throw new ProfileConflictException( - String.format("Profile %s in namespace %s is disabled. It cannot be " + - "used to start the program %s", + String.format("Profile %s in namespace %s is disabled. It cannot be " + + "used to start the program %s", profileId.getProfile(), profileId.getNamespace(), programId.toString()), profileId); } @@ -1074,8 +1074,8 @@ private Collection issueStopInternal( && runRecord.getStatus().equals(ProgramRunStatus.RUNNING)) { String workflowRunId = runRecord.getProperties().get(AppMetadataStore.WORKFLOW_RUNID); throw new BadRequestException( - String.format("Cannot stop the program run '%s' started by the Workflow " + - "run '%s'. Please stop the Workflow.", activeRunId, + String.format("Cannot stop the program run '%s' started by the Workflow " + + "run '%s'. Please stop the Workflow.", activeRunId, workflowRunId)); } // send a message to stop the program run @@ -1549,8 +1549,8 @@ private Set getPluginRequirements(ProgramSpecification progra private void authorizePipelineRuntimeImpersonation(Map userArgs) throws Exception { - if ((userArgs.containsKey(SystemArguments.RUNTIME_PRINCIPAL_NAME)) && - (userArgs.containsKey(SystemArguments.RUNTIME_KEYTAB_PATH))) { + if ((userArgs.containsKey(SystemArguments.RUNTIME_PRINCIPAL_NAME)) + && (userArgs.containsKey(SystemArguments.RUNTIME_KEYTAB_PATH))) { String principal = userArgs.get(SystemArguments.RUNTIME_PRINCIPAL_NAME); LOG.debug("Checking authorisation for user: {}, using runtime config principal: {}", authenticationContext.getPrincipal(), principal); @@ -1579,8 +1579,8 @@ private void checkLatestVersionExeceution(ProgramId programId) String latestVersion = getLatestApplicationId(programId.getAppReference()).getVersion(); if (!latestVersion.equals(programId.getVersion())) { throw new BadRequestException( - String.format("Start action is only allowed on the latest version %s. " + - "Please use the versionless start API instead.", latestVersion)); + String.format("Start action is only allowed on the latest version %s. " + + "Please use the versionless start API instead.", latestVersion)); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/RunRecordCorrectorService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/RunRecordCorrectorService.java index 93a9c1cee6f3..bb5013c48a9c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/RunRecordCorrectorService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/RunRecordCorrectorService.java @@ -104,8 +104,8 @@ void fixRunRecords() { Set fixed = doFixRunRecords(); if (!fixed.isEmpty()) { - LOG.info("Corrected {} run records with status in {} that have no actual running program. " + - "Such programs likely have crashed or were killed by external signal.", + LOG.info("Corrected {} run records with status in {} that have no actual running program. " + + "Such programs likely have crashed or were killed by external signal.", fixed.size(), NOT_STOPPED_STATUSES); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/RunRecordMonitorService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/RunRecordMonitorService.java index 64df819f43a4..d97adea3e01a 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/RunRecordMonitorService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/services/RunRecordMonitorService.java @@ -167,9 +167,10 @@ private void emitMetrics(String metricName, long value) { private void cleanupQueue() { while (true) { ProgramRunId programRunId = launchingQueue.peek(); - if (programRunId == null || - RunIds.getTime(programRunId.getRun(), TimeUnit.MILLISECONDS) + (ageThresholdSec * 1000) >= - System.currentTimeMillis()) { + if (programRunId == null + || RunIds.getTime(programRunId.getRun(), TimeUnit.MILLISECONDS) + (ageThresholdSec * 1000) + >= + System.currentTimeMillis()) { //Queue is empty or queue head has not expired yet. return; } @@ -230,7 +231,7 @@ class Counter { /** * Total number of launch requests that have been accepted but still missing in metadata store + - * total number of run records with {@link ProgramRunStatus#PENDING} status + total number of + * * total number of run records with {@link ProgramRunStatus#PENDING} status + total number of * run records with {@link ProgramRunStatus#STARTING} status */ private final int launchingCount; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/AppMetadataStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/AppMetadataStore.java index f9de280e41e0..2217bb1287c9 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/AppMetadataStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/AppMetadataStore.java @@ -301,14 +301,14 @@ public void scanApplications(ScanApplicationsRequest request, if (request.getScanFrom() != null) { startBound = Range.Bound.EXCLUSIVE; - startFields = sortCreationTime ? - getApplicationNamespaceAppCreationKeys(request.getScanFrom()) : + startFields = sortCreationTime + ? getApplicationNamespaceAppCreationKeys(request.getScanFrom()) : getApplicationPrimaryKeys(request.getScanFrom()); } if (request.getScanTo() != null) { endBound = Range.Bound.EXCLUSIVE; - endFields = sortCreationTime ? - getApplicationNamespaceAppCreationKeys(request.getScanTo()) : + endFields = sortCreationTime + ? getApplicationNamespaceAppCreationKeys(request.getScanTo()) : getApplicationPrimaryKeys(request.getScanTo()); } @@ -603,8 +603,8 @@ public int createApplicationVersion(ApplicationId id, ApplicationMeta appMeta) String latestVersion = latest == null ? null : latest.getSpec().getAppVersion(); if (!deployAppAllowed(parentVersion, latest)) { throw new ConflictException( - String.format("Cannot deploy the application because parent version '%s' does not " + - "match the latest version '%s'.", parentVersion, latestVersion)); + String.format("Cannot deploy the application because parent version '%s' does not " + + "match the latest version '%s'.", parentVersion, latestVersion)); } // When the app does not exist, it is not an edit if (latest != null) { @@ -811,8 +811,8 @@ public RunRecordDetail recordProgramProvisioning(ProgramRunId programRunId, if (startTs == -1L) { LOG.error( "Ignoring unexpected request to record provisioning state for program run {} that does not have " - + - "a timestamp in the run id.", programRunId); + + + "a timestamp in the run id.", programRunId); return null; } @@ -1063,8 +1063,8 @@ public RunRecordDetail recordProgramRejected(ProgramRunId programRunId, if (startTs == -1L) { LOG.error( "Ignoring unexpected request to record provisioning state for program run {} that does not have " - + - "a timestamp in the run id.", programRunId); + + + "a timestamp in the run id.", programRunId); return null; } @@ -1438,8 +1438,8 @@ private boolean isValid(RunRecordDetail existing, ProgramRunStatus nextProgramSt byte[] existingSourceId = existing.getSourceId(); if (existingSourceId != null && Bytes.compareTo(sourceId, existingSourceId) < 0) { LOG.debug( - "Current source id '{}' is not larger than the existing source id '{}' in the existing " + - "run record meta '{}'. Skip recording state transition to program state {} and cluster state {}.", + "Current source id '{}' is not larger than the existing source id '{}' in the existing " + + "run record meta '{}'. Skip recording state transition to program state {} and cluster state {}.", Bytes.toHexString(sourceId), Bytes.toHexString(existingSourceId), existing, nextProgramState, nextClusterState); return false; @@ -2213,8 +2213,8 @@ public Map getProgramTotalRunCounts( row.getString(StoreDefinition.AppMetadataStore.PROGRAM_FIELD)) .getProgramReference(); // calculate total run counts for programs across versions - result.put(programRef, result.get(programRef) + - Optional.ofNullable(row.getLong(StoreDefinition.AppMetadataStore.COUNTS)).orElse(0L)); + result.put(programRef, result.get(programRef) + + Optional.ofNullable(row.getLong(StoreDefinition.AppMetadataStore.COUNTS)).orElse(0L)); } } return result; @@ -2265,8 +2265,8 @@ Set getRunningInRangeForStatus(String statusKey, long startTimeInSecs, long endTimeInSecs) throws IOException { // Create time filter to get running programs between start and end time Predicate timeFilter = (runRecordMeta) -> - runRecordMeta.getStartTs() < endTimeInSecs && - (runRecordMeta.getStopTs() == null || runRecordMeta.getStopTs() >= startTimeInSecs); + runRecordMeta.getStartTs() < endTimeInSecs + && (runRecordMeta.getStopTs() == null || runRecordMeta.getStopTs() >= startTimeInSecs); List> prefix = getRunRecordStatusPrefix(statusKey); Set runIds = new HashSet<>(); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/DefaultStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/DefaultStore.java index 399ef5732ff2..e16046199585 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/DefaultStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/DefaultStore.java @@ -252,8 +252,8 @@ private void recordCompletedWorkflow(AppMetadataStore metaStore, WorkflowTable w ApplicationSpecification appSpec = getApplicationSpec(metaStore, app); if (appSpec == null || appSpec.getWorkflows() == null || appSpec.getWorkflows().get(workflowId.getProgram()) == null) { - LOG.warn("Missing ApplicationSpecification for {}, " + - "potentially caused by application removal right after stopping workflow {}", app, + LOG.warn("Missing ApplicationSpecification for {}, " + + "potentially caused by application removal right after stopping workflow {}", app, workflowId); return; } @@ -275,8 +275,8 @@ private void recordCompletedWorkflow(AppMetadataStore metaStore, WorkflowTable w Long stopTs = innerProgramRun.getStopTs(); // since the program is completed, the stop ts cannot be null if (stopTs == null) { - LOG.warn("Since the program has completed, expected its stop time to not be null. " + - "Not writing workflow completed record for Program = {}, Workflow = {}, Run = {}", + LOG.warn("Since the program has completed, expected its stop time to not be null. " + + "Not writing workflow completed record for Program = {}, Workflow = {}, Run = {}", innerProgram, workflowId, runRecord); workFlowNodeFailed = true; break; @@ -929,15 +929,15 @@ private static ServiceSpecification getServiceSpecOrFail(ProgramId id, @Nullable ApplicationSpecification appSpec) { if (appSpec == null) { throw new NoSuchElementException( - "no such application @ namespace id: " + id.getNamespaceId() + - ", app id: " + id.getApplication()); + "no such application @ namespace id: " + id.getNamespaceId() + + ", app id: " + id.getApplication()); } ServiceSpecification spec = appSpec.getServices().get(id.getProgram()); if (spec == null) { - throw new NoSuchElementException("no such service @ namespace id: " + id.getNamespace() + - ", app id: " + id.getApplication() + - ", service id: " + id.getProgram()); + throw new NoSuchElementException("no such service @ namespace id: " + id.getNamespace() + + ", app id: " + id.getApplication() + + ", service id: " + id.getProgram()); } return spec; } @@ -946,15 +946,15 @@ private static WorkerSpecification getWorkerSpecOrFail(ProgramId id, @Nullable ApplicationSpecification appSpec) { if (appSpec == null) { throw new NoSuchElementException( - "no such application @ namespace id: " + id.getNamespaceId() + - ", app id: " + id.getApplication()); + "no such application @ namespace id: " + id.getNamespaceId() + + ", app id: " + id.getApplication()); } WorkerSpecification workerSpecification = appSpec.getWorkers().get(id.getProgram()); if (workerSpecification == null) { - throw new NoSuchElementException("no such worker @ namespace id: " + id.getNamespaceId() + - ", app id: " + id.getApplication() + - ", worker id: " + id.getProgram()); + throw new NoSuchElementException("no such worker @ namespace id: " + id.getNamespaceId() + + ", app id: " + id.getApplication() + + ", worker id: " + id.getProgram()); } return workerSpecification; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/WorkflowTable.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/WorkflowTable.java index accdad42f691..c126b3fa2eda 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/WorkflowTable.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/WorkflowTable.java @@ -71,8 +71,8 @@ void write(WorkflowId id, RunRecordDetail runRecordMeta, List progra List> fields = getPrimaryKeyFields(id, startTs); Long stopTs = runRecordMeta.getStopTs(); Preconditions.checkState(stopTs != null, - "Workflow Stats are written when the workflow has completed. Hence, " + - "expected workflow stop time to be non-null. Workflow = %s, Run = %s, Stop time = %s", + "Workflow Stats are written when the workflow has completed. Hence, " + + "expected workflow stop time to be non-null. Workflow = %s, Run = %s, Stop time = %s", id, runRecordMeta, stopTs); long timeTaken = stopTs - startTs; fields.add( @@ -290,8 +290,8 @@ private Map getNeighbors(WorkflowId id, RunId runId, indexRow.getLong(StoreDefinition.WorkflowStore.START_TIME_FIELD); workflowRunRecords.put(indexRow.getString(StoreDefinition.WorkflowStore.RUN_ID_FIELD), getRunRecordFromRow(indexRow)); - prevStartTime = startTime + (i * timeInterval) < timeOfNextRecord ? - timeOfNextRecord + 1 : startTime + (i * timeInterval); + prevStartTime = startTime + (i * timeInterval) < timeOfNextRecord + ? timeOfNextRecord + 1 : startTime + (i * timeInterval); i++; } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/preview/DefaultPreviewStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/preview/DefaultPreviewStore.java index 2b3476f78fd1..2ae2e5f2074b 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/preview/DefaultPreviewStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/preview/DefaultPreviewStore.java @@ -119,8 +119,8 @@ public void put(ApplicationId applicationId, String tracerName, String propertyN previewTable.putDefaultVersion(mdsKey.getKey(), VALUE, Bytes.toBytes(gson.toJson(value))); } catch (IOException e) { String message = String.format( - "Error while putting property '%s' for application '%s' and tracer '%s' in" + - " preview table.", propertyName, applicationId, tracerName); + "Error while putting property '%s' for application '%s' and tracer '%s' in" + + " preview table.", propertyName, applicationId, tracerName); throw new RuntimeException(message, e); } } @@ -345,8 +345,8 @@ public void setPreviewRequestPollerInfo(ApplicationId applicationId, @Nullable b } if (previewStatus.getStatus() != PreviewStatus.Status.WAITING) { throw new ConflictException( - String.format("Preview application with id %s does not exist in the " + - "waiting state. Its current state is %s", applicationId, + String.format("Preview application with id %s does not exist in the " + + "waiting state. Its current state is %s", applicationId, previewStatus.getStatus().name())); } long submitTimeInMillis = RunIds.getTime(applicationId.getApplication(), TimeUnit.SECONDS); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/profile/ProfileStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/profile/ProfileStore.java index 06e13b32d3e9..c7a3c5ab6a27 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/profile/ProfileStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/store/profile/ProfileStore.java @@ -185,8 +185,8 @@ public void deleteProfile(ProfileId profileId) } if (value.getStatus() == ProfileStatus.ENABLED) { throw new ProfileConflictException( - String.format("Profile %s in namespace %s is currently enabled. A profile can " + - "only be deleted if it is disabled", profileId.getProfile(), + String.format("Profile %s in namespace %s is currently enabled. A profile can " + + "only be deleted if it is disabled", profileId.getProfile(), profileId.getNamespace()), profileId); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/workflow/DefaultWorkflowConfigurer.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/workflow/DefaultWorkflowConfigurer.java index 78a0d9a3c9fd..d45ee1606004 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/workflow/DefaultWorkflowConfigurer.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/workflow/DefaultWorkflowConfigurer.java @@ -163,10 +163,10 @@ public void createLocalDataset(String datasetName, String typeName, DatasetCreationSpec existingSpec = localDatasetSpecs.get(datasetName); if (existingSpec != null && !existingSpec.equals(spec)) { throw new IllegalArgumentException( - String.format("DatasetInstance '%s' was added multiple times with" + - " different specifications. Please resolve the conflict so" + - " that there is only one specification for the local dataset" + - " instance in the Workflow.", datasetName)); + String.format("DatasetInstance '%s' was added multiple times with" + + " different specifications. Please resolve the conflict so" + + " that there is only one specification for the local dataset" + + " instance in the Workflow.", datasetName)); } localDatasetSpecs.put(datasetName, spec); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/CapabilityApplier.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/CapabilityApplier.java index 4a06a58915c9..975168cafc51 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/CapabilityApplier.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/CapabilityApplier.java @@ -449,8 +449,8 @@ private void doWithRetry(T argument, CheckedConsumer consumer) throws Exc } private boolean shouldRetry(Throwable throwable) { - return !(throwable instanceof UnauthorizedException || - throwable instanceof InvalidArtifactException); + return !(throwable instanceof UnauthorizedException + || throwable instanceof InvalidArtifactException); } /** diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/CapabilityConfig.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/CapabilityConfig.java index 37db7c220ed9..e5b238a8179b 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/CapabilityConfig.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/CapabilityConfig.java @@ -99,12 +99,12 @@ public boolean equals(Object other) { return false; } CapabilityConfig otherConfig = (CapabilityConfig) other; - return Objects.equals(label, otherConfig.label) && - status == otherConfig.status && - Objects.equals(capability, otherConfig.capability) && - Objects.equals(applications, otherConfig.applications) && - Objects.equals(programs, otherConfig.programs) && - Objects.equals(hubs, otherConfig.hubs); + return Objects.equals(label, otherConfig.label) + && status == otherConfig.status + && Objects.equals(capability, otherConfig.capability) + && Objects.equals(applications, otherConfig.applications) + && Objects.equals(programs, otherConfig.programs) + && Objects.equals(hubs, otherConfig.hubs); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/SystemApplication.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/SystemApplication.java index 3fe3b68a8bda..20fff735d979 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/SystemApplication.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/SystemApplication.java @@ -77,10 +77,10 @@ public boolean equals(Object other) { return false; } SystemApplication otherApplication = (SystemApplication) other; - return Objects.equals(namespace, otherApplication.namespace) && - Objects.equals(name, otherApplication.name) && - Objects.equals(artifact, otherApplication.artifact) && - Objects.equals(config, otherApplication.config); + return Objects.equals(namespace, otherApplication.namespace) + && Objects.equals(name, otherApplication.name) + && Objects.equals(artifact, otherApplication.artifact) + && Objects.equals(config, otherApplication.config); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/SystemProgram.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/SystemProgram.java index dadca044641f..58f3ae36ce95 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/SystemProgram.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/SystemProgram.java @@ -89,11 +89,11 @@ public boolean equals(Object other) { return false; } SystemProgram program = (SystemProgram) other; - return Objects.equals(namespace, program.namespace) && - Objects.equals(application, program.application) && - Objects.equals(type, program.type) && - Objects.equals(name, program.name) && - Objects.equals(args, program.args); + return Objects.equals(namespace, program.namespace) + && Objects.equals(application, program.application) + && Objects.equals(type, program.type) + && Objects.equals(name, program.name) + && Objects.equals(args, program.args); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/autoinstall/HubPackage.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/autoinstall/HubPackage.java index f65580e9f03f..acfca6459846 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/autoinstall/HubPackage.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/capability/autoinstall/HubPackage.java @@ -148,8 +148,8 @@ public void installPlugin(URL url, ArtifactRepository artifactRepository, File t continue; } URL configURL = new URL(url.getProtocol(), url.getHost(), url.getPort(), - url.getPath() + - Joiner.on("/").join(Arrays.asList("/packages", name, version, configFilename))); + url.getPath() + + Joiner.on("/").join(Arrays.asList("/packages", name, version, configFilename))); // Download plugin json from hub JsonObject jsonObj = GSON.fromJson(HttpClients.doGetAsString(configURL), JsonObject.class); List parents = GSON.fromJson(jsonObj.get("parents"), new TypeToken>() { @@ -164,8 +164,8 @@ public void installPlugin(URL url, ArtifactRepository artifactRepository, File t File destination = File.createTempFile("artifact-", ".jar", tmpDir); FileChannel channel = new FileOutputStream(destination, false).getChannel(); URL jarURL = new URL(url.getProtocol(), url.getHost(), url.getPort(), - url.getPath() + - Joiner.on("/").join(Arrays.asList("/packages", name, version, jarName))); + url.getPath() + + Joiner.on("/").join(Arrays.asList("/packages", name, version, jarName))); HttpRequest request = HttpRequest.get(jarURL).withContentConsumer(new HttpContentConsumer() { @Override public boolean onReceived(ByteBuffer buffer) { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/events/EventWriterExtensionProvider.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/events/EventWriterExtensionProvider.java index 2a89188a481b..592f1b679c26 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/events/EventWriterExtensionProvider.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/events/EventWriterExtensionProvider.java @@ -61,8 +61,8 @@ private static Set createAllowedResources() { return ClassPathResources.getResourcesWithDependencies(EventWriter.class.getClassLoader(), EventWriter.class); } catch (IOException e) { - throw new RuntimeException("Failed to trace dependencies for writer extension. " + - "Usage of events writer might fail.", e); + throw new RuntimeException("Failed to trace dependencies for writer extension. " + + "Usage of events writer might fail.", e); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/metadata/MetadataConsumerExtensionLoader.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/metadata/MetadataConsumerExtensionLoader.java index a4d393d3abc4..e04250dba08e 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/metadata/MetadataConsumerExtensionLoader.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/metadata/MetadataConsumerExtensionLoader.java @@ -62,8 +62,8 @@ private static Set createAllowedResources() { MetadataConsumer.class.getClassLoader(), MetadataConsumer.class); } catch (IOException e) { - throw new RuntimeException("Failed to trace dependencies for metadata consumer extension. " + - "Usage of metadata consumer might fail.", e); + throw new RuntimeException("Failed to trace dependencies for metadata consumer extension. " + + "Usage of metadata consumer might fail.", e); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/pipeline/PluginRequirement.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/pipeline/PluginRequirement.java index 2301bd7b6b34..7833c388ca2d 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/pipeline/PluginRequirement.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/pipeline/PluginRequirement.java @@ -64,9 +64,9 @@ public boolean equals(Object o) { return false; } PluginRequirement that = (PluginRequirement) o; - return Objects.equals(name, that.name) && - Objects.equals(type, that.type) && - Objects.equals(requirements, that.requirements); + return Objects.equals(name, that.name) + && Objects.equals(type, that.type) + && Objects.equals(requirements, that.requirements); } @Override @@ -76,10 +76,10 @@ public int hashCode() { @Override public String toString() { - return "PluginRequirement{" + - "name='" + name + '\'' + - ", type='" + type + '\'' + - ", requirements=" + requirements + - '}'; + return "PluginRequirement{" + + "name='" + name + '\'' + + ", type='" + type + '\'' + + ", requirements=" + requirements + + '}'; } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/profile/ProfileService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/profile/ProfileService.java index 8134b36e739f..cebb02eb2e83 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/profile/ProfileService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/profile/ProfileService.java @@ -298,8 +298,8 @@ public void disableProfile(ProfileId profileId) throws NotFoundException, ProfileConflictException, MethodNotAllowedException { if (profileId.equals(ProfileId.NATIVE)) { throw new MethodNotAllowedException( - String.format("Cannot change status for Profile Native %s, " + - "it should always be ENABLED", profileId.getScopedName())); + String.format("Cannot change status for Profile Native %s, " + + "it should always be ENABLED", profileId.getScopedName())); } TransactionRunners.run(transactionRunner, context -> { ProfileStore.get(context).disableProfile(profileId); @@ -354,8 +354,8 @@ private void deleteProfile(ProfileStore profileStore, AppMetadataStore appMetada // The profile status must be DISABLED if (profile.getStatus() == ProfileStatus.ENABLED) { throw new ProfileConflictException( - String.format("Profile %s in namespace %s is currently enabled. A profile can " + - "only be deleted if it is disabled", profileId.getProfile(), + String.format("Profile %s in namespace %s is currently enabled. A profile can " + + "only be deleted if it is disabled", profileId.getProfile(), profileId.getNamespace()), profileId); } @@ -367,8 +367,8 @@ private void deleteProfile(ProfileStore profileStore, AppMetadataStore appMetada String firstEntity = getUserFriendlyEntityStr(assignments.iterator().next()); String countStr = getCountStr(numAssignments, "entity", "entities"); throw new ProfileConflictException( - String.format("Profile '%s' is still assigned to %s%s. " + - "Please delete all assignments before deleting the profile.", + String.format("Profile '%s' is still assigned to %s%s. " + + "Please delete all assignments before deleting the profile.", profileId.getProfile(), firstEntity, countStr), profileId); } @@ -391,8 +391,8 @@ private void deleteProfile(ProfileStore profileStore, AppMetadataStore appMetada String firstRun = activeRuns.keySet().iterator().next().toString(); String countStr = getCountStr(numRuns, "run", "runs"); throw new ProfileConflictException( - String.format("Profile '%s' is in use by run %s%s. Please stop all active runs " + - "before deleting the profile.", + String.format("Profile '%s' is in use by run %s%s. Please stop all active runs " + + "before deleting the profile.", profileId.toString(), firstRun, countStr), profileId); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/DefaultSSHContext.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/DefaultSSHContext.java index 3fd12e3ff162..385b9eed453f 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/DefaultSSHContext.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/DefaultSSHContext.java @@ -81,8 +81,8 @@ public SSHKeyPair generate(String user, int bits) throws KeyException { @Override public void setSSHKeyPair(SSHKeyPair keyPair) { if (keysDir == null) { - throw new IllegalStateException("Setting of key pair is not allowed. " + - "It can only be called during the Provisioner.createCluster cycle"); + throw new IllegalStateException("Setting of key pair is not allowed. " + + "It can only be called during the Provisioner.createCluster cycle"); } this.sshKeyPair = keyPair; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerConfig.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerConfig.java index 950ca12124db..2cfeef4eff72 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerConfig.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerConfig.java @@ -72,9 +72,9 @@ public boolean equals(Object o) { } ProvisionerConfig that = (ProvisionerConfig) o; - return Objects.equals(configurationGroups, that.configurationGroups) && - Objects.equals(filters, that.filters) && - Objects.equals(beta, that.beta); + return Objects.equals(configurationGroups, that.configurationGroups) + && Objects.equals(filters, that.filters) + && Objects.equals(beta, that.beta); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerExtensionLoader.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerExtensionLoader.java index edf67fd61e18..37ffc232bc3b 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerExtensionLoader.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerExtensionLoader.java @@ -45,8 +45,8 @@ private static Set createAllowedResources() { return ClassPathResources.getResourcesWithDependencies(Provisioner.class.getClassLoader(), Provisioner.class); } catch (IOException e) { - throw new RuntimeException("Failed to trace dependencies for provisioner extension. " + - "Usage of provisioner might fail.", e); + throw new RuntimeException("Failed to trace dependencies for provisioner extension. " + + "Usage of provisioner might fail.", e); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerTable.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerTable.java index e56f883c099e..aa311c6e362c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerTable.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisionerTable.java @@ -85,9 +85,9 @@ public List listTaskInfo() throws IOException { public ProvisioningTaskInfo getTaskInfo(ProvisioningTaskKey key) throws IOException { Optional row = table.read( createPrimaryKey(key.getProgramRunId(), key.getType())); - return row.isPresent() ? - deserialize( - row.get().getString(StoreDefinition.ProvisionerStore.PROVISIONER_TASK_INFO_FIELD)) : + return row.isPresent() + ? deserialize( + row.get().getString(StoreDefinition.ProvisionerStore.PROVISIONER_TASK_INFO_FIELD)) : null; } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisioningService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisioningService.java index 4cbc47848f96..b2d640bc36ca 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisioningService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/ProvisioningService.java @@ -292,8 +292,8 @@ void resumeTasks(Consumer taskCleanup) throws IOException { // the actual task still needs to be run for cleanup to happen, but avoid logging a confusing // message about resuming a task that is in cancelled state or resuming a task that is completed - if (provisioningOp.getStatus() != ProvisioningOp.Status.CANCELLED && - provisioningOp.getStatus() != ProvisioningOp.Status.CREATED) { + if (provisioningOp.getStatus() != ProvisioningOp.Status.CANCELLED + && provisioningOp.getStatus() != ProvisioningOp.Status.CREATED) { LOG.info("Resuming provisioning task for run {} of type {} in state {}.", provisioningTaskInfo.getProgramRunId(), provisioningTaskInfo.getProvisioningOp().getType(), @@ -380,13 +380,13 @@ public Runnable provision(ProvisionRequest provisionRequest, StructuredTableCont if (!unfulfilledRequirements.isEmpty()) { runWithProgramLogging(programRunId, args, () -> LOG.error(String.format( - "'%s' cannot be run using profile '%s' because the profile does not met all " + - "plugin requirements. Following requirements were not meet by the listed " + - "plugins: '%s'", programRunId.getProgram(), name, + "'%s' cannot be run using profile '%s' because the profile does not met all " + + "plugin requirements. Following requirements were not meet by the listed " + + "plugins: '%s'", programRunId.getProgram(), name, groupByRequirement(unfulfilledRequirements)))); programStateWriter.error(programRunId, - new IllegalArgumentException("Provisioner does not meet all the " + - "requirements for the program to run.")); + new IllegalArgumentException("Provisioner does not meet all the " + + "requirements for the program to run.")); provisionerNotifier.deprovisioned(programRunId); return () -> { }; @@ -779,9 +779,9 @@ private List getInProgressTasks() throws IOException { Throwable rootCause = Throwables.getRootCause(t); if (!(rootCause instanceof SocketTimeoutException || rootCause instanceof ConnectException)) { - SAMPLING_LOG.warn("Error scanning for in-progress provisioner tasks. " + - "Tasks that were in progress during the last CDAP shutdown will " + - "not be resumed until this succeeds. ", t); + SAMPLING_LOG.warn("Error scanning for in-progress provisioner tasks. " + + "Tasks that were in progress during the last CDAP shutdown will " + + "not be resumed until this succeeds. ", t); } return true; }); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/task/ProvisionTask.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/task/ProvisionTask.java index 505814de7ef7..720b18f99765 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/task/ProvisionTask.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/provision/task/ProvisionTask.java @@ -118,8 +118,8 @@ private ProvisioningSubtask createClusterCreateSubtask() { return new ClusterCreateSubtask(provisioner, provisionerContext, cluster -> { if (!Objects.equals(provisionerContext.getCDAPVersionInfo(), provisionerContext.getAppCDAPVersionInfo())) { - USERLOG.info("Starting a pipeline created with a previous version. " + - "Please consider upgrading the pipeline to employ all the enhancements"); + USERLOG.info("Starting a pipeline created with a previous version. " + + "Please consider upgrading the pipeline to employ all the enhancements"); LOG.debug( "Starting a pipeline created with a previous version. Pipeline version {}, platform version {}", provisionerContext.getAppCDAPVersionInfo(), provisionerContext.getCDAPVersionInfo()); @@ -127,8 +127,8 @@ private ProvisioningSubtask createClusterCreateSubtask() { if (cluster == null) { // this is in violation of the provisioner contract, but in case somebody writes a provisioner that // returns a null cluster. - LOG.warn("Provisioner {} returned an invalid null cluster. " + - "Sending notification to de-provision it.", provisioner.getSpec().getName()); + LOG.warn("Provisioner {} returned an invalid null cluster. " + + "Sending notification to de-provision it.", provisioner.getSpec().getName()); notifyFailed(new IllegalStateException("Provisioner returned an invalid null cluster.")); // RequestingCreate --> Failed return Optional.of(ProvisioningOp.Status.FAILED); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/NamespaceAllocation.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/NamespaceAllocation.java index c302f00e6397..1c69c09a42e2 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/NamespaceAllocation.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/NamespaceAllocation.java @@ -58,9 +58,9 @@ public boolean equals(Object other) { return false; } NamespaceAllocation that = (NamespaceAllocation) other; - return Objects.equals(this.namespace, that.namespace) && - Objects.equals(this.cpuLimit, that.cpuLimit) && - Objects.equals(this.memoryLimit, that.memoryLimit); + return Objects.equals(this.namespace, that.namespace) + && Objects.equals(this.cpuLimit, that.cpuLimit) + && Objects.equals(this.memoryLimit, that.memoryLimit); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/PeerBase.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/PeerBase.java index 5b46642b7217..9417134134d5 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/PeerBase.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/PeerBase.java @@ -69,11 +69,11 @@ public boolean equals(Object other) { return false; } PeerBase that = (PeerBase) other; - return Objects.equals(this.name, that.name) && - Objects.equals(this.endpoint, that.endpoint) && - Objects.equals(this.tetheringStatus, that.tetheringStatus) && - Objects.equals(this.metadata, that.metadata) && - Objects.equals(this.requestTime, that.requestTime); + return Objects.equals(this.name, that.name) + && Objects.equals(this.endpoint, that.endpoint) + && Objects.equals(this.tetheringStatus, that.tetheringStatus) + && Objects.equals(this.metadata, that.metadata) + && Objects.equals(this.requestTime, that.requestTime); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/PeerMetadata.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/PeerMetadata.java index 34e24216ce66..6ce2ea4859ce 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/PeerMetadata.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/PeerMetadata.java @@ -61,9 +61,9 @@ public boolean equals(Object other) { return false; } PeerMetadata that = (PeerMetadata) other; - return Objects.equals(this.namespaceAllocations, that.namespaceAllocations) && - Objects.equals(this.metadata, that.metadata) && - Objects.equals(this.description, that.description); + return Objects.equals(this.namespaceAllocations, that.namespaceAllocations) + && Objects.equals(this.metadata, that.metadata) + && Objects.equals(this.description, that.description); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/TetheringControlMessage.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/TetheringControlMessage.java index 35995156d052..4234798ab461 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/TetheringControlMessage.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/TetheringControlMessage.java @@ -64,8 +64,8 @@ public boolean equals(Object o) { } TetheringControlMessage that = (TetheringControlMessage) o; - return Objects.equals(type, that.type) && - Arrays.equals(payload, that.payload); + return Objects.equals(type, that.type) + && Arrays.equals(payload, that.payload); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/TetheringHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/TetheringHandler.java index 47477106efce..00baf36e8f6d 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/TetheringHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/TetheringHandler.java @@ -128,8 +128,8 @@ public void deleteTether(HttpRequest request, HttpResponder responder, new ProvisionerPropertyValue(TetheringConf.TETHERED_INSTANCE_PROPERTY, peer, true)); if (!tetheringProfiles.isEmpty()) { throw new BadRequestException( - String.format("Cannot delete tethering as it's in use by compute profiles: %s." + - " Delete these profiles before deleting this tethering.", + String.format("Cannot delete tethering as it's in use by compute profiles: %s." + + " Delete these profiles before deleting this tethering.", tetheringProfiles.stream().map(Profile::getName) .collect(Collectors.toList()))); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/proto/v1/TetheringLaunchMessage.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/proto/v1/TetheringLaunchMessage.java index c38352791ab5..7f241f2cec76 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/proto/v1/TetheringLaunchMessage.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/proto/v1/TetheringLaunchMessage.java @@ -57,11 +57,11 @@ public String getRuntimeNamespace() { @Override public String toString() { - return "TetheringLaunchMessage{" + - "localizeFiles='" + localizeFiles + '\'' + - ", cConfEntries=" + cConfEntries + - ", runtimeNamespace=" + runtimeNamespace + - '}'; + return "TetheringLaunchMessage{" + + "localizeFiles='" + localizeFiles + '\'' + + ", cConfEntries=" + cConfEntries + + ", runtimeNamespace=" + runtimeNamespace + + '}'; } @Override @@ -74,9 +74,9 @@ public boolean equals(Object o) { } TetheringLaunchMessage that = (TetheringLaunchMessage) o; - return Objects.equals(localizeFiles, that.localizeFiles) && - Objects.equals(cConfEntries, that.cConfEntries) && - Objects.equals(runtimeNamespace, that.runtimeNamespace); + return Objects.equals(localizeFiles, that.localizeFiles) + && Objects.equals(cConfEntries, that.cConfEntries) + && Objects.equals(runtimeNamespace, that.runtimeNamespace); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/runtime/spi/runtimejob/TetheringRuntimeJobManager.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/runtime/spi/runtimejob/TetheringRuntimeJobManager.java index c08fde262a24..3877ba5c338f 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/runtime/spi/runtimejob/TetheringRuntimeJobManager.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/tethering/runtime/spi/runtimejob/TetheringRuntimeJobManager.java @@ -96,8 +96,8 @@ public TetheringRuntimeJobManager(TetheringConf conf, CConfiguration cConf, @Override public void launch(RuntimeJobInfo runtimeJobInfo) throws Exception { ProgramRunInfo runInfo = runtimeJobInfo.getProgramRunInfo(); - LOG.debug("Launching program run {} with following configurations: " + - "tethered instance name {}, tethered namespace {}.", + LOG.debug("Launching program run {} with following configurations: " + + "tethered instance name {}, tethered namespace {}.", runInfo, tetheredInstanceName, tetheredNamespace); checkTetheredConnection(tetheredInstanceName, tetheredNamespace); byte[] payload = Bytes.toBytes(GSON.toJson(createLaunchPayload(runtimeJobInfo))); @@ -129,8 +129,8 @@ public void stop(ProgramRunInfo programRunInfo) throws Exception { if (status.isTerminated()) { return; } - LOG.debug("Stopping program run {} with following configurations: " + - "tethered instance name {}, tethered namespace {}.", + LOG.debug("Stopping program run {} with following configurations: " + + "tethered instance name {}, tethered namespace {}.", programRunInfo, tetheredInstanceName, tetheredNamespace); TetheringControlMessage message = createProgramTerminatePayload(programRunInfo, TetheringControlMessage.Type.STOP_PROGRAM); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/master/environment/k8s/AbstractServiceMain.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/master/environment/k8s/AbstractServiceMain.java index ea667a17ff45..6ee7c99a377e 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/master/environment/k8s/AbstractServiceMain.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/master/environment/k8s/AbstractServiceMain.java @@ -117,8 +117,8 @@ void main(Class mainClass, String[] args) throws Exception { if (!DaemonMain.class.getName().equals(superClass.getName())) { // This should never happen - throw new IllegalStateException("Main service class " + mainClass.getName() + - " should inherit from " + DaemonMain.class.getName()); + throw new IllegalStateException("Main service class " + mainClass.getName() + + " should inherit from " + DaemonMain.class.getName()); } Method method = superClass.getDeclaredMethod("doMain", String[].class); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/DatasetFieldLineageSummary.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/DatasetFieldLineageSummary.java index a97b3cc06da1..6f5c8831603e 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/DatasetFieldLineageSummary.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/DatasetFieldLineageSummary.java @@ -124,9 +124,9 @@ public boolean equals(Object o) { } DatasetFieldLineageSummary.FieldLineageRelations that = (DatasetFieldLineageSummary.FieldLineageRelations) o; - return Objects.equals(datasetId, that.datasetId) && - Objects.equals(relations, that.relations) && - Objects.equals(fieldCount, that.fieldCount); + return Objects.equals(datasetId, that.datasetId) + && Objects.equals(relations, that.relations) + && Objects.equals(fieldCount, that.fieldCount); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/FieldLineageAdmin.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/FieldLineageAdmin.java index 8b398940942b..e4de2e3bb0cb 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/FieldLineageAdmin.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/FieldLineageAdmin.java @@ -174,8 +174,8 @@ public DatasetFieldLineageSummary getDatasetFieldLineage( EndPointField endPointField = new EndPointField(endPoint, field); // compute the incoming field level lineage - if (direction == Constants.FieldLineage.Direction.INCOMING || - direction == Constants.FieldLineage.Direction.BOTH) { + if (direction == Constants.FieldLineage.Direction.INCOMING + || direction == Constants.FieldLineage.Direction.BOTH) { Map> incomingSummary = convertSummaryToDatasetMap( fieldLineageReader.getIncomingSummary(endPointField, start, end)); @@ -192,8 +192,8 @@ public DatasetFieldLineageSummary getDatasetFieldLineage( } // compute the outgoing field level lineage - if (direction == Constants.FieldLineage.Direction.OUTGOING || - direction == Constants.FieldLineage.Direction.BOTH) { + if (direction == Constants.FieldLineage.Direction.OUTGOING + || direction == Constants.FieldLineage.Direction.BOTH) { Map> outgoingSummary = convertSummaryToDatasetMap( fieldLineageReader.getOutgoingSummary(endPointField, start, end)); @@ -318,8 +318,8 @@ private Set getFieldsWithNoFieldLineage(EndPoint dataset, } else { LOG.trace( "Received request to include schema fields for {} but no schema was found. Only fields present in " - + - "the lineage store will be returned.", dataset); + + + "the lineage store will be returned.", dataset); } return Collections.emptySet(); } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/FieldRelation.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/FieldRelation.java index 3a071ae847f5..a3ab7d655da9 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/FieldRelation.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/FieldRelation.java @@ -42,8 +42,8 @@ public boolean equals(Object o) { } FieldRelation that = (FieldRelation) o; - return Objects.equals(source, that.source) && - Objects.equals(destination, that.destination); + return Objects.equals(source, that.source) + && Objects.equals(destination, that.destination); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/LineageAdmin.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/LineageAdmin.java index af531349bf60..dfbf55b11c36 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/LineageAdmin.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/LineageAdmin.java @@ -393,10 +393,10 @@ public boolean equals(Object o) { // Don't use AccessType for equals (same for hashCode) RelationKey other = (RelationKey) o; - return Objects.equals(relation.getData(), other.relation.getData()) && - Objects.equals(relation.getProgram(), other.relation.getProgram()) && - Objects.equals(relation.getRun(), other.relation.getRun()) && - Objects.equals(relation.getComponents(), other.relation.getComponents()); + return Objects.equals(relation.getData(), other.relation.getData()) + && Objects.equals(relation.getProgram(), other.relation.getProgram()) + && Objects.equals(relation.getRun(), other.relation.getRun()) + && Objects.equals(relation.getComponents(), other.relation.getComponents()); } @Override diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/LineageHTTPHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/LineageHTTPHandler.java index 1a48c6c917a0..18d171435956 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/LineageHTTPHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/LineageHTTPHandler.java @@ -379,8 +379,8 @@ private Constants.FieldLineage.Direction parseDirection(@Nullable String directi } catch (NullPointerException | IllegalArgumentException e) { String directionValues = Joiner.on(", ").join(Constants.FieldLineage.Direction.values()); throw new BadRequestException( - String.format("Direction must be specified to get the field lineage " + - "summary and should be one of the following: [%s].", + String.format("Direction must be specified to get the field lineage " + + "summary and should be one of the following: [%s].", directionValues.toLowerCase())); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/MetadataHttpHandler.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/MetadataHttpHandler.java index 5cc77a352472..ed26e9834d4c 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/MetadataHttpHandler.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/MetadataHttpHandler.java @@ -434,11 +434,11 @@ private SearchRequest getValidatedSearchRequest(@Nullable String scope, // this cannot happen because UTF_8 is always supported throw new IllegalStateException(e); } - if (!MetadataConstants.ENTITY_NAME_KEY.equalsIgnoreCase(sorting.getKey()) && - !MetadataConstants.CREATION_TIME_KEY.equalsIgnoreCase(sorting.getKey())) { - throw new IllegalArgumentException("Sorting is only supported on fields: " + - MetadataConstants.ENTITY_NAME_KEY + ", " + - MetadataConstants.CREATION_TIME_KEY); + if (!MetadataConstants.ENTITY_NAME_KEY.equalsIgnoreCase(sorting.getKey()) + && !MetadataConstants.CREATION_TIME_KEY.equalsIgnoreCase(sorting.getKey())) { + throw new IllegalArgumentException("Sorting is only supported on fields: " + + MetadataConstants.ENTITY_NAME_KEY + ", " + + MetadataConstants.CREATION_TIME_KEY); } builder.setSorting(sorting); } @@ -467,8 +467,8 @@ private SearchRequest getValidatedSearchRequest(@Nullable String scope, private MetadataEntity getMetadataEntityFromPath(String uri, @Nullable String entityType, String suffix) { - String[] parts = uri.substring((uri.indexOf(Constants.Gateway.API_VERSION_3) + - Constants.Gateway.API_VERSION_3.length() + 1), uri.lastIndexOf(suffix)).split("/"); + String[] parts = uri.substring((uri.indexOf(Constants.Gateway.API_VERSION_3) + + Constants.Gateway.API_VERSION_3.length() + 1), uri.lastIndexOf(suffix)).split("/"); MetadataEntity.Builder builder = MetadataEntity.builder(); int curIndex = 0; @@ -511,9 +511,9 @@ static MetadataEntity.Builder makeBackwardCompatible(MetadataEntity.Builder buil List entityKeyValues = StreamSupport.stream(entity.spliterator(), false) .collect(Collectors.toList()); - if (entityKeyValues.size() == 3 && entity.getType().equals(MetadataEntity.VERSION) && - (entityKeyValues.get(1).getKey().equals(MetadataEntity.ARTIFACT) || - entityKeyValues.get(1).getKey().equals(MetadataEntity.APPLICATION))) { + if (entityKeyValues.size() == 3 && entity.getType().equals(MetadataEntity.VERSION) + && (entityKeyValues.get(1).getKey().equals(MetadataEntity.ARTIFACT) + || entityKeyValues.get(1).getKey().equals(MetadataEntity.APPLICATION))) { // this is artifact or application so update the builder MetadataEntity.Builder actualEntityBuilder = MetadataEntity.builder(); // namespace @@ -605,9 +605,9 @@ private EntityScope validateEntityScope(@Nullable String entityScope) throws Bad return EntityScope.valueOf(entityScope.toUpperCase()); } catch (IllegalArgumentException e) { throw new BadRequestException( - String.format("Invalid entity scope '%s'. Expected '%s' or '%s' for entities " + - "from specified scope, or just omit the parameter to get " + - "entities from both scopes", + String.format("Invalid entity scope '%s'. Expected '%s' or '%s' for entities " + + "from specified scope, or just omit the parameter to get " + + "entities from both scopes", entityScope, EntityScope.USER, EntityScope.SYSTEM)); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/MetadataValidator.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/MetadataValidator.java index ad6786d8bba6..40dd0c34e134 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/MetadataValidator.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/MetadataValidator.java @@ -114,8 +114,8 @@ private static void validateKeyAndTagsFormat(MetadataEntity metadataEntity, Stri throws InvalidMetadataException { if (!KEY_AND_TAG_MATCHER.matchesAllOf(keyword)) { throw new InvalidMetadataException(metadataEntity, String.format( - "Illegal format for '%s'. Should only contain alphanumeric characters (a-z, A-Z, 0-9), " + - "underscores and hyphens.", keyword)); + "Illegal format for '%s'. Should only contain alphanumeric characters (a-z, A-Z, 0-9), " + + "underscores and hyphens.", keyword)); } } @@ -127,8 +127,8 @@ private static void validateValueFormat(MetadataEntity metadataEntity, String ke if (!VALUE_MATCHER.matchesAllOf(keyword)) { throw new InvalidMetadataException(metadataEntity, String.format( "Illegal format for the value '%s'. Should only contain alphanumeric characters (a-z, A-Z, 0-9), " - + - "underscores, hyphens and whitespaces.", keyword)); + + + "underscores, hyphens and whitespaces.", keyword)); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/profile/ProfileMetadataMessageProcessor.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/profile/ProfileMetadataMessageProcessor.java index 9857c4d38459..12bff67d5ceb 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/profile/ProfileMetadataMessageProcessor.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/metadata/profile/ProfileMetadataMessageProcessor.java @@ -184,8 +184,8 @@ private void collectProfileMetadata(EntityId entityId, MetadataMessage message, if (namespaceTable.get(namespaceId) == null) { LOG.debug( "Namespace {} is not found, so the profile metadata of programs or schedules in it will not get " - + - "updated. Ignoring the message {}", namespaceId, message); + + + "updated. Ignoring the message {}", namespaceId, message); return; } ProfileId namespaceProfile = getResolvedProfileId(namespaceId); @@ -209,8 +209,8 @@ private void collectProfileMetadata(EntityId entityId, MetadataMessage message, if (meta == null) { LOG.debug( "Application {} is not found, so the profile metadata of its programs/schedules will not get " - + - "updated. Ignoring the message {}", appId, message); + + + "updated. Ignoring the message {}", appId, message); return; } collectAppProfileMetadata(appId, meta.getSpec(), null, updates); @@ -223,8 +223,8 @@ private void collectProfileMetadata(EntityId entityId, MetadataMessage message, if (meta == null) { LOG.debug( "Application {} is not found, so the profile metadata of program {} will not get updated. " - + - "Ignoring the message {}", programId.getParent(), programId, message); + + + "Ignoring the message {}", programId.getParent(), programId, message); return; } if (PROFILE_ALLOWED_PROGRAM_TYPES.contains(programId.getType())) { @@ -239,15 +239,15 @@ private void collectProfileMetadata(EntityId entityId, MetadataMessage message, collectScheduleProfileMetadata(schedule, getResolvedProfileId(schedule.getProgramId()), updates); } catch (NotFoundException e) { - LOG.debug("Schedule {} is not found, so its profile metadata will not get updated. " + - "Ignoring the message {}", scheduleId, message); + LOG.debug("Schedule {} is not found, so its profile metadata will not get updated. " + + "Ignoring the message {}", scheduleId, message); return; } break; default: // this should not happen - LOG.warn("Type of the entity id {} cannot be used to update profile metadata. " + - "Ignoring the message {}", entityId, message); + LOG.warn("Type of the entity id {} cannot be used to update profile metadata. " + + "Ignoring the message {}", entityId, message); } } @@ -369,8 +369,8 @@ private void addPluginMetadataDelete(ApplicationId appId, ApplicationSpecificati */ // TODO: CDAP-13579 consider preference key starts with [scope].[name].system.profile.name private ProfileId getResolvedProfileId(EntityId entityId) throws IOException { - NamespaceId namespaceId = entityId.getEntityType().equals(EntityType.INSTANCE) ? - NamespaceId.SYSTEM : ((NamespacedEntityId) entityId).getNamespaceId(); + NamespaceId namespaceId = entityId.getEntityType().equals(EntityType.INSTANCE) + ? NamespaceId.SYSTEM : ((NamespacedEntityId) entityId).getNamespaceId(); String profileName = preferencesTable.getResolvedPreference(entityId, SystemArguments.PROFILE_NAME); return profileName == null ? ProfileId.NATIVE @@ -385,8 +385,8 @@ private ProfileId getResolvedProfileId(EntityId entityId) throws IOException { * @return the profile id configured for this entity id, if any */ private Optional getProfileId(EntityId entityId) throws IOException { - NamespaceId namespaceId = entityId.getEntityType().equals(EntityType.INSTANCE) ? - NamespaceId.SYSTEM : ((NamespacedEntityId) entityId).getNamespaceId(); + NamespaceId namespaceId = entityId.getEntityType().equals(EntityType.INSTANCE) + ? NamespaceId.SYSTEM : ((NamespacedEntityId) entityId).getNamespaceId(); String profileName = preferencesTable.getPreferences(entityId).getProperties() .get(SystemArguments.PROFILE_NAME); return profileName == null ? Optional.empty() diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalExtensionId.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalExtensionId.java index 697bac367203..3a44b52ddb1f 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalExtensionId.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalExtensionId.java @@ -50,8 +50,8 @@ public boolean equals(Object o) { OperationalExtensionId that = (OperationalExtensionId) o; - return Objects.equals(serviceName, that.serviceName) && - Objects.equals(statType, that.statType); + return Objects.equals(serviceName, that.serviceName) + && Objects.equals(statType, that.statType); } @Override @@ -61,9 +61,9 @@ public int hashCode() { @Override public String toString() { - return "OperationalExtensionId{" + - "serviceName='" + serviceName + '\'' + - ", statType='" + statType + '\'' + - '}'; + return "OperationalExtensionId{" + + "serviceName='" + serviceName + '\'' + + ", statType='" + statType + '\'' + + '}'; } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalStatsLoader.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalStatsLoader.java index 5ae61fb99880..d171fa4c3a39 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalStatsLoader.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalStatsLoader.java @@ -42,8 +42,8 @@ public Set getSupportedTypesForProvider( OperationalStats operationalStats) { OperationalExtensionId operationalExtensionId = OperationalStatsUtils.getOperationalExtensionId( operationalStats); - return operationalExtensionId == null ? - Collections.emptySet() : + return operationalExtensionId == null + ? Collections.emptySet() : Collections.singleton(operationalExtensionId); } } diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalStatsService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalStatsService.java index 742341ecfb59..b15f0d978021 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalStatsService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/operations/OperationalStatsService.java @@ -177,8 +177,8 @@ protected void shutDown() throws Exception { if (objectName == null) { LOG.warn( "Found an operational extension with null service name and stat type while unregistering - {}. " - + - "Ignoring this extension.", operationalStats.getClass().getName()); + + + "Ignoring this extension.", operationalStats.getClass().getName()); continue; } try { diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/scheduler/ConstraintCheckerService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/scheduler/ConstraintCheckerService.java index 9be85ccb0fc8..e6f12fcbff06 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/scheduler/ConstraintCheckerService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/scheduler/ConstraintCheckerService.java @@ -212,21 +212,22 @@ private void checkAndUpdateJob(JobQueue jobQueue, Job job) throws IOException { long now = System.currentTimeMillis(); if (job.isToBeDeleted()) { // only delete jobs that are pending trigger or pending constraint. If pending launch, the launcher will delete - if ((job.getState() == Job.State.PENDING_CONSTRAINT || - // if pending trigger, we need to check if now - deletionTime > 2 * txTimeout. + if ((job.getState() == Job.State.PENDING_CONSTRAINT + || // if pending trigger, we need to check if now - deletionTime > 2 * txTimeout. // Otherwise the subscriber thread might update this job concurrently (because // its tx does not see the delete flag) and cause a conflict. // It's 2 * txTimeout for: // - the transaction the marked it as to be deleted // - the subscriber's transaction that may not have seen that change - (job.getState() == Job.State.PENDING_TRIGGER && - now - job.getDeleteTimeMillis() > 2 * Schedulers.SUBSCRIBER_TX_TIMEOUT_MILLIS))) { + (job.getState() == Job.State.PENDING_TRIGGER + && now - job.getDeleteTimeMillis() + > 2 * Schedulers.SUBSCRIBER_TX_TIMEOUT_MILLIS))) { jobQueue.deleteJob(job); } return; } - if (now - job.getCreationTime() >= job.getSchedule().getTimeoutMillis() + - 2 * Schedulers.SUBSCRIBER_TX_TIMEOUT_MILLIS) { + if (now - job.getCreationTime() >= job.getSchedule().getTimeoutMillis() + + 2 * Schedulers.SUBSCRIBER_TX_TIMEOUT_MILLIS) { LOG.info("Deleted job {}, due to timeout value of {}.", job.getJobKey(), job.getSchedule().getTimeoutMillis()); jobQueue.deleteJob(job); @@ -313,8 +314,8 @@ private ConstraintResult.SatisfiedState constraintsSatisfied(Job job, long now) if (!(constraint instanceof CheckableConstraint)) { // this shouldn't happen, since implementation of Constraint in ProgramSchedule // should implement CheckableConstraint - throw new IllegalArgumentException("Implementation of Constraint in ProgramSchedule" + - " must implement CheckableConstraint"); + throw new IllegalArgumentException("Implementation of Constraint in ProgramSchedule" + + " must implement CheckableConstraint"); } CheckableConstraint abstractConstraint = (CheckableConstraint) constraint; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/scheduler/CoreSchedulerService.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/scheduler/CoreSchedulerService.java index c5883e4fc19c..c270a5fcd57b 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/scheduler/CoreSchedulerService.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/scheduler/CoreSchedulerService.java @@ -239,8 +239,8 @@ public void addSchedules(Iterable schedules) ProfileId profileId = profile.get(); if (profileDataset.getProfile(profileId).getStatus() == ProfileStatus.DISABLED) { throw new ProfileConflictException( - String.format("Profile %s in namespace %s is disabled. It cannot " + - "be assigned to schedule %s", + String.format("Profile %s in namespace %s is disabled. It cannot " + + "be assigned to schedule %s", profileId.getProfile(), profileId.getNamespace(), schedule.getName()), profileId); } @@ -399,8 +399,8 @@ public void deleteSchedules(Iterable scheduleIds) throws N profileDataset.removeProfileAssignment(profileId.get(), scheduleId); } catch (NotFoundException e) { // this should not happen since the profile cannot be deleted if there is a schedule who is using it - LOG.warn("Unable to find the profile {} when deleting schedule {}, " + - "skipping assignment deletion.", profileId.get(), scheduleId); + LOG.warn("Unable to find the profile {} when deleting schedule {}, " + + "skipping assignment deletion.", profileId.get(), scheduleId); } } } @@ -432,8 +432,8 @@ public void deleteSchedules(ApplicationId appId) { profileDataset.removeProfileAssignment(profileId.get(), scheduleId); } catch (NotFoundException e) { // this should not happen since the profile cannot be deleted if there is a schedule who is using it - LOG.warn("Unable to find the profile {} when deleting schedule {}, " + - "skipping assignment deletion.", profileId.get(), scheduleId); + LOG.warn("Unable to find the profile {} when deleting schedule {}, " + + "skipping assignment deletion.", profileId.get(), scheduleId); } } } @@ -464,8 +464,8 @@ public void deleteSchedules(ProgramId programId) { profileDataset.removeProfileAssignment(profileId.get(), scheduleId); } catch (NotFoundException e) { // this should not happen since the profile cannot be deleted if there is a schedule who is using it - LOG.warn("Unable to find the profile {} when deleting schedule {}, " + - "skipping assignment deletion.", profileId.get(), scheduleId); + LOG.warn("Unable to find the profile {} when deleting schedule {}, " + + "skipping assignment deletion.", profileId.get(), scheduleId); } } } @@ -586,8 +586,8 @@ private ProgramSchedule getProgramScheduleWithUserAndArtifactId(ProgramSchedule LOG.error("Exception occurs when looking up program descriptor for program {} in schedule {}", schedule.getProgramId(), schedule, e); throw new RuntimeException( - String.format("Exception occurs when looking up program descriptor for" + - " program %s in schedule %s", schedule.getProgramId(), schedule), e); + String.format("Exception occurs when looking up program descriptor for" + + " program %s in schedule %s", schedule.getProgramId(), schedule), e); } additionalProperties.put(ProgramOptionConstants.ARTIFACT_ID, GSON.toJson(programDescriptor.getArtifactId().toApiArtifactId())); @@ -600,8 +600,8 @@ private ProgramSchedule getProgramScheduleWithUserAndArtifactId(ProgramSchedule "Exception occurs when looking up user group information for program {} in schedule {}", schedule.getProgramId(), schedule, e); throw new RuntimeException( - String.format("Exception occurs when looking up user group information for" + - " program %s in schedule %s", schedule.getProgramId(), schedule), e); + String.format("Exception occurs when looking up user group information for" + + " program %s in schedule %s", schedule.getProgramId(), schedule), e); } // add the user name to the schedule property additionalProperties.put(ProgramOptionConstants.USER_ID, userId); diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/security/impersonation/DefaultUGIProvider.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/security/impersonation/DefaultUGIProvider.java index f182077b879a..2fa3bab5426f 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/security/impersonation/DefaultUGIProvider.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/security/impersonation/DefaultUGIProvider.java @@ -80,8 +80,8 @@ public class DefaultUGIProvider extends AbstractCachedUGIProvider { @Override protected boolean checkExploreAndDetermineCache(ImpersonationRequest impersonationRequest) throws AccessException { - if (impersonationRequest.getEntityId().getEntityType().equals(EntityType.NAMESPACE) && - impersonationRequest.getImpersonatedOpType().equals(ImpersonatedOpType.EXPLORE)) { + if (impersonationRequest.getEntityId().getEntityType().equals(EntityType.NAMESPACE) + && impersonationRequest.getImpersonatedOpType().equals(ImpersonatedOpType.EXPLORE)) { // CDAP-8355 If the operation being impersonated is an explore query then check if the namespace configuration // specifies that it can be impersonated with the namespace owner. // This is done here rather than in the get getConfiguredUGI because the getConfiguredUGI will be called at @@ -144,8 +144,8 @@ protected UGIWithPrincipal createUGI(ImpersonationRequest impersonationRequest) URI keytabURI = URI.create(keytab); boolean isKeytabLocal = keytabURI.getScheme() == null || "file".equals(keytabURI.getScheme()); - File localKeytabFile = isKeytabLocal ? - new File(keytabURI.getPath()) : localizeKeytab(locationFactory.create(keytabURI)); + File localKeytabFile = isKeytabLocal + ? new File(keytabURI.getPath()) : localizeKeytab(locationFactory.create(keytabURI)); try { String expandedPrincipal = SecurityUtil.expandPrincipal( impersonationRequest.getPrincipal()); @@ -169,8 +169,8 @@ protected UGIWithPrincipal createUGI(ImpersonationRequest impersonationRequest) // rethrow the exception with additional information tagged, so the user knows which principal/keytab is // not working throw new AccessException( - String.format("Failed to login for principal=%s, keytab=%s. Check that " + - "the principal was not deleted and that the keytab is still valid.", + String.format("Failed to login for principal=%s, keytab=%s. Check that " + + "the principal was not deleted and that the keytab is still valid.", expandedPrincipal, keytabURI), e); } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/PauseResumeWorklowApp.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/PauseResumeWorklowApp.java index 424b58bff1f4..7836863b6ae9 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/PauseResumeWorklowApp.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/PauseResumeWorklowApp.java @@ -62,11 +62,13 @@ public SimpleAction(String name) { public void run() { LOG.info("Running SimpleAction: " + getContext().getSpecification().getName()); try { - File file = new File(getContext().getRuntimeArguments().get(getContext().getSpecification().getName() + - ".simple.action.file")); + File file = new File( + getContext().getRuntimeArguments().get(getContext().getSpecification().getName() + + ".simple.action.file")); file.createNewFile(); - File doneFile = new File(getContext().getRuntimeArguments().get(getContext().getSpecification().getName() + - ".simple.action.donefile")); + File doneFile = new File( + getContext().getRuntimeArguments().get(getContext().getSpecification().getName() + + ".simple.action.donefile")); while (!doneFile.exists()) { TimeUnit.MILLISECONDS.sleep(50); } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/app/MockAppConfigurer.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/app/MockAppConfigurer.java index 0106dbc6c86b..394cd01ba04b 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/app/MockAppConfigurer.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/app/MockAppConfigurer.java @@ -48,10 +48,11 @@ */ public final class MockAppConfigurer implements ApplicationConfigurer { - private static final String ERROR_MSG = "Applications that use plugins cannot be deployed/created using " + - "deployApplication(Id.Namespace namespace, Class applicationClz) method." + - "Instead use addAppArtifact, addPluginArtifact and " + - "deployApplication(Id.Artifact artifactId, AppRequest appRequest) method."; + private static final String ERROR_MSG = + "Applications that use plugins cannot be deployed/created using " + + "deployApplication(Id.Namespace namespace, Class applicationClz) method." + + "Instead use addAppArtifact, addPluginArtifact and " + + "deployApplication(Id.Artifact artifactId, AppRequest appRequest) method."; private String name; diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/AppFabricClient.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/AppFabricClient.java index 0951fa0ff26e..2c4e0fde2c8a 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/AppFabricClient.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/AppFabricClient.java @@ -468,8 +468,8 @@ public Location deployApplication(Id.Namespace namespace, Class applicationCl } mockResponder = new MockResponder(); bodyConsumer.finished(mockResponder); - verifyResponse(HttpResponseStatus.OK, mockResponder.getStatus(), "Failed to deploy app (" + - mockResponder.getResponseContentAsString() + ")"); + verifyResponse(HttpResponseStatus.OK, mockResponder.getStatus(), "Failed to deploy app (" + + mockResponder.getResponseContentAsString() + ")"); } return deployedJar; } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/deploy/pipeline/SystemMetadataWriterStageTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/deploy/pipeline/SystemMetadataWriterStageTest.java index 569d88a855ae..bc3c67b31a24 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/deploy/pipeline/SystemMetadataWriterStageTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/deploy/pipeline/SystemMetadataWriterStageTest.java @@ -100,20 +100,24 @@ public void testWorkflowTags() throws Exception { systemMetadataWriterStage.process(stageContext); systemMetadataWriterStage.process(appWithPrograms); - Assert.assertEquals(false, metadataStorage.read(new Read(appId.workflow(workflowName).toMetadataEntity(), - MetadataScope.SYSTEM, MetadataKind.TAG)).isEmpty()); + Assert.assertEquals(false, + metadataStorage.read(new Read(appId.workflow(workflowName).toMetadataEntity(), + MetadataScope.SYSTEM, MetadataKind.TAG)).isEmpty()); Set workflowSystemTags = metadataStorage - .read(new Read(appId.workflow(workflowName).toMetadataEntity())).getTags(MetadataScope.SYSTEM); - Sets.SetView intersection = Sets.intersection(workflowSystemTags, getWorkflowForkNodes(workflowSpec)); - Assert.assertTrue("Workflows should not be tagged with fork node names, but found the following fork nodes " + - "in the workflow's system tags: " + intersection, intersection.isEmpty()); + .read(new Read(appId.workflow(workflowName).toMetadataEntity())) + .getTags(MetadataScope.SYSTEM); + Sets.SetView intersection = Sets.intersection(workflowSystemTags, + getWorkflowForkNodes(workflowSpec)); + Assert.assertTrue( + "Workflows should not be tagged with fork node names, but found the following fork nodes " + + "in the workflow's system tags: " + intersection, intersection.isEmpty()); Assert.assertEquals(false, metadataStorage.read(new Read(appId.toMetadataEntity(), - MetadataScope.SYSTEM, MetadataKind.PROPERTY)).isEmpty()); + MetadataScope.SYSTEM, MetadataKind.PROPERTY)).isEmpty()); Map metadataProperties = metadataStorage - .read(new Read(appId.toMetadataEntity())).getProperties(MetadataScope.SYSTEM); + .read(new Read(appId.toMetadataEntity())).getProperties(MetadataScope.SYSTEM); Assert.assertEquals(WorkflowAppWithFork.SCHED_NAME + ":testDescription", - metadataProperties.get("schedule:" + WorkflowAppWithFork.SCHED_NAME)); + metadataProperties.get("schedule:" + WorkflowAppWithFork.SCHED_NAME)); } @Test diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/namespace/StorageProviderNamespaceAdminTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/namespace/StorageProviderNamespaceAdminTest.java index c6f44db6c586..0384430654cf 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/namespace/StorageProviderNamespaceAdminTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/namespace/StorageProviderNamespaceAdminTest.java @@ -121,8 +121,9 @@ public void testNSWithCustomLocation() throws Exception { namespaceStore.create(customSpaceMeta); try { storageProviderNamespaceAdmin.create(customSpaceMeta); - Assert.fail("Expected exception to be thrown while creating namespace with custom location since the custom " + - "location does not exist at this point."); + Assert.fail( + "Expected exception to be thrown while creating namespace with custom location since the custom " + + "location does not exist at this point."); } catch (IOException e) { // expected } @@ -135,8 +136,9 @@ public void testNSWithCustomLocation() throws Exception { Assert.assertTrue(dir1.mkdir()); try { storageProviderNamespaceAdmin.create(customSpaceMeta); - Assert.fail("Expected exception to be thrown while creating namespace with custom location since the custom " + - "location is not empty."); + Assert.fail( + "Expected exception to be thrown while creating namespace with custom location since the custom " + + "location is not empty."); } catch (IOException e) { // expected } @@ -148,9 +150,10 @@ public void testNSWithCustomLocation() throws Exception { Assert.assertTrue(randomFile.createNewFile()); try { storageProviderNamespaceAdmin.create(new NamespaceMeta.Builder(customSpaceMeta) - .setRootDirectory(randomFile.toString()).build()); - Assert.fail("Expected exception to be thrown while creating namespace with custom location since the custom " + - "location is not a directory"); + .setRootDirectory(randomFile.toString()).build()); + Assert.fail( + "Expected exception to be thrown while creating namespace with custom location since the custom " + + "location is not a directory"); } catch (IOException e) { // expected } @@ -170,8 +173,9 @@ public void testNSWithCustomLocation() throws Exception { storageProviderNamespaceAdmin.delete(customSpace); namespaceStore.delete(customSpace); // the data inside the custom location should have been deleted - Assert.assertFalse("Data inside the custom location still exists.", (dir1.exists() || dir2.exists() || - file1.exists())); + Assert.assertFalse("Data inside the custom location still exists.", + (dir1.exists() || dir2.exists() + || file1.exists())); // but custom namespace location should still exists Assert.assertTrue(custom.exists()); Assert.assertTrue(custom.delete()); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/plugins/test/TestPlugin.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/plugins/test/TestPlugin.java index f60f42d3c829..76ec8061eddf 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/plugins/test/TestPlugin.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/plugins/test/TestPlugin.java @@ -97,10 +97,10 @@ public AuthInfo(String token, String id) { @Override public String toString() { - return "AuthInfo{" + - "token='" + token + '\'' + - ", id='" + id + '\'' + - '}'; + return "AuthInfo{" + + "token='" + token + '\'' + + ", id='" + id + '\'' + + '}'; } } } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/SystemArtifactsAuthorizationTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/SystemArtifactsAuthorizationTest.java index dbaab67f7e1b..c15141cf3ab7 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/SystemArtifactsAuthorizationTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/SystemArtifactsAuthorizationTest.java @@ -105,8 +105,9 @@ public void testAuthorizationForSystemArtifacts() throws Exception { SecurityRequestContext.setUserId(ALICE.getName()); try { artifactRepository.addSystemArtifacts(); - Assert.fail("Adding system artifacts should have failed because alice does not have admin privileges on " + - "the namespace system."); + Assert.fail( + "Adding system artifacts should have failed because alice does not have admin privileges on " + + "the namespace system."); } catch (UnauthorizedException expected) { // expected } @@ -123,8 +124,9 @@ public void testAuthorizationForSystemArtifacts() throws Exception { // deleting a system artifact should fail because bob does not have admin privileges on the artifact try { artifactRepository.deleteArtifact(Id.Artifact.fromEntityId(SYSTEM_ARTIFACT)); - Assert.fail("Deleting a system artifact should have failed because alice does not have admin privileges on " + - "the artifact."); + Assert.fail( + "Deleting a system artifact should have failed because alice does not have admin privileges on " + + "the artifact."); } catch (UnauthorizedException expected) { // expected } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/app/inspection/InspectionApp.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/app/inspection/InspectionApp.java index 4f5ca0138993..84d9dae1f4cb 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/app/inspection/InspectionApp.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/app/inspection/InspectionApp.java @@ -152,8 +152,8 @@ public double doSomething() { } @Plugin(type = PLUGIN_TYPE) - @Name("Capability" + - "Plugin") + @Name("Capability" + + "Plugin") @Description(PLUGIN_DESCRIPTION) @Requirements(capabilities = {"cdc"}) public static class CapabilityPlugin { diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/plugin/nested/NestedConfigPlugin.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/plugin/nested/NestedConfigPlugin.java index f7c321a0dc45..ee3f1e153efd 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/plugin/nested/NestedConfigPlugin.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/artifact/plugin/nested/NestedConfigPlugin.java @@ -64,8 +64,8 @@ public boolean equals(Object o) { } Config config = (Config) o; - return x == config.x && - Objects.equals(nested, config.nested); + return x == config.x + && Objects.equals(nested, config.nested); } @Override @@ -98,8 +98,8 @@ public boolean equals(Object o) { } NestedConfig that = (NestedConfig) o; - return Objects.equals(nested1, that.nested1) && - Objects.equals(nested2, that.nested2); + return Objects.equals(nested1, that.nested1) + && Objects.equals(nested2, that.nested2); } @Override diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/batch/AppWithLocalFiles.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/batch/AppWithLocalFiles.java index 79c0fea6be1e..5aa43ea66710 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/batch/AppWithLocalFiles.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/batch/AppWithLocalFiles.java @@ -112,19 +112,24 @@ public void map(byte[] key, byte[] value, Context context) throws IOException, I @Override public void initialize(MapReduceTaskContext context) throws Exception { Map localFiles = context.getAllLocalFiles(); - Preconditions.checkState(localFiles.size() == 2, "Expected 2 files to have been localized."); + Preconditions.checkState(localFiles.size() == 2, + "Expected 2 files to have been localized."); Map args = context.getRuntimeArguments(); Preconditions.checkArgument(args.containsKey(STOPWORDS_FILE_ARG), - "Runtime argument %s must be set.", STOPWORDS_FILE_ARG); + "Runtime argument %s must be set.", STOPWORDS_FILE_ARG); String localFilePath = URI.create(args.get(STOPWORDS_FILE_ARG)).getPath(); // will throw FileNotFoundException if stopwords file does not exist File stopWordsFile = context.getLocalFile(STOPWORDS_FILE_ALIAS); - Preconditions.checkState(stopWordsFile.exists(), "Stopwords file %s must exist", localFilePath); + Preconditions.checkState(stopWordsFile.exists(), "Stopwords file %s must exist", + localFilePath); File localArchive = context.getLocalFile(LOCAL_ARCHIVE_ALIAS); - Preconditions.checkState(localArchive.exists(), "Local archive %s must exist", LOCAL_ARCHIVE_ALIAS); - Preconditions.checkState(localArchive.isDirectory(), "Local archive %s must have been extracted to a " + - "directory", LOCAL_ARCHIVE_ALIAS); - try (BufferedReader reader = Files.newBufferedReader(stopWordsFile.toPath(), Charsets.UTF_8)) { + Preconditions.checkState(localArchive.exists(), "Local archive %s must exist", + LOCAL_ARCHIVE_ALIAS); + Preconditions.checkState(localArchive.isDirectory(), + "Local archive %s must have been extracted to a " + + "directory", LOCAL_ARCHIVE_ALIAS); + try (BufferedReader reader = Files.newBufferedReader(stopWordsFile.toPath(), + Charsets.UTF_8)) { String line; while ((line = reader.readLine()) != null) { stopWords.add(line); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/plugin/MacroParserTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/plugin/MacroParserTest.java index f196fa87b3ea..ab7cde5fcac6 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/plugin/MacroParserTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/plugin/MacroParserTest.java @@ -459,24 +459,24 @@ public void stressTestPropertyTree() throws InvalidMacroException { .put("o", "o") .put("c", "c") .put("a", "a") - .put("hostSuffix", "host") - .put("two", "${filename${fileTypeMacro}}") - .put("three", "${firstPortDigit}${secondPortDigit}") - .put("filename", "index") - .put("fileTypeMacro", "-html") - .put("filename-html", "index.html") - .put("filename-php", "index.php") - .put("firstPortDigit", "8") - .put("secondPortDigit", "0") - .build(); - assertSubstitution("${simpleHostnameTree}${simpleHostnameTree}${simpleHostnameTree}" + - "${advancedHostnameTree}${advancedHostnameTree}${advancedHostnameTree}" + - "${expansiveHostnameTree}${expansiveHostnameTree}${expansiveHostnameTree}" + - "${simpleHostnameTree}${advancedHostnameTree}${expansiveHostnameTree}", - "localhost/index.html:80localhost/index.html:80localhost/index.html:80localhost/index.html:80" + - "localhost/index.html:80localhost/index.html:80localhost/index.html:80localhost/index.html:80" + - "localhost/index.html:80localhost/index.html:80localhost/index.html:80localhost/index.html:80", - properties, new HashMap<>()); + .put("hostSuffix", "host") + .put("two", "${filename${fileTypeMacro}}") + .put("three", "${firstPortDigit}${secondPortDigit}") + .put("filename", "index") + .put("fileTypeMacro", "-html") + .put("filename-html", "index.html") + .put("filename-php", "index.php") + .put("firstPortDigit", "8") + .put("secondPortDigit", "0") + .build(); + assertSubstitution("${simpleHostnameTree}${simpleHostnameTree}${simpleHostnameTree}" + + "${advancedHostnameTree}${advancedHostnameTree}${advancedHostnameTree}" + + "${expansiveHostnameTree}${expansiveHostnameTree}${expansiveHostnameTree}" + + "${simpleHostnameTree}${advancedHostnameTree}${expansiveHostnameTree}", + "localhost/index.html:80localhost/index.html:80localhost/index.html:80localhost/index.html:80" + + "localhost/index.html:80localhost/index.html:80localhost/index.html:80localhost/index.html:80" + + "localhost/index.html:80localhost/index.html:80localhost/index.html:80localhost/index.html:80", + properties, new HashMap<>()); } @Test diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/schedule/store/DatasetBasedTimeScheduleStoreTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/schedule/store/DatasetBasedTimeScheduleStoreTest.java index 04f7528dd613..40460053d486 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/schedule/store/DatasetBasedTimeScheduleStoreTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/schedule/store/DatasetBasedTimeScheduleStoreTest.java @@ -417,14 +417,14 @@ private JobDetail getJobDetail(String jobName) { } private JobDetail getJobDetail(String jobGroup, String jobName, @Nullable String appVersion) { - String identity = Strings.isNullOrEmpty(appVersion) ? - String.format("developer:application1:flow:%s", jobName) : - String.format("developer:application1:%s:flow:%s", appVersion, jobName); + String identity = Strings.isNullOrEmpty(appVersion) + ? String.format("developer:application1:flow:%s", jobName) : + String.format("developer:application1:%s:flow:%s", appVersion, jobName); return JobBuilder.newJob(LogPrintingJob.class) - .withIdentity(identity, jobGroup) - .storeDurably() - .build(); + .withIdentity(identity, jobGroup) + .storeDurably() + .build(); } @AfterClass diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/DefaultProgramStatusTriggerInfoTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/DefaultProgramStatusTriggerInfoTest.java index 1c3fb8db42a2..b2674fa21a98 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/DefaultProgramStatusTriggerInfoTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/runtime/schedule/trigger/DefaultProgramStatusTriggerInfoTest.java @@ -70,18 +70,18 @@ public void testDeserializationVersioning() throws IOException, ClassNotFoundExc // runId, ProgramStatus.COMPLETED, null, // Collections.emptyMap()); // String serialized = serializeToStringBase64(triggerInfo); - String serialized = "rO0ABXNyAFJpby5jZGFwLmNkYXAuaW50ZXJuYWwuYXBwLnJ1bnRpbW" + - "Uuc2NoZWR1bGUudHJpZ2dlci5EZWZhdWx0UHJvZ3JhbVN0YXR1c1RyaWdnZXJJbmZvAAAAA" + - "AAAAAEMAAB4cHctACZ0ZXN0RGVzZXJpYWxpemF0aW9uVmVyc2lvbmluZ05hbWVzcGFjZQAD" + - "QXBwfnIAIGlvLmNkYXAuY2RhcC5hcGkuYXBwLlByb2dyYW1UeXBlAAAAAAAAAAASAAB4cgA" + - "OamF2YS5sYW5nLkVudW0AAAAAAAAAABIAAHhwdAAIV09SS0ZMT1d3NgAOQWxsUHJvZ3JhbX" + - "NBcHAAJDc4ZmU1MmMxLTM5MjEtMTFlYy04Y2MxLTAwMDAwMDc3OWM0Mn5yAB5pby5jZGFwL" + - "mNkYXAuYXBpLlByb2dyYW1TdGF0dXMAAAAAAAAAABIAAHhxAH4AA3QACUNPTVBMRVRFRHB3" + - "BAAAAAB4"; + String serialized = "rO0ABXNyAFJpby5jZGFwLmNkYXAuaW50ZXJuYWwuYXBwLnJ1bnRpbW" + + "Uuc2NoZWR1bGUudHJpZ2dlci5EZWZhdWx0UHJvZ3JhbVN0YXR1c1RyaWdnZXJJbmZvAAAAA" + + "AAAAAEMAAB4cHctACZ0ZXN0RGVzZXJpYWxpemF0aW9uVmVyc2lvbmluZ05hbWVzcGFjZQAD" + + "QXBwfnIAIGlvLmNkYXAuY2RhcC5hcGkuYXBwLlByb2dyYW1UeXBlAAAAAAAAAAASAAB4cgA" + + "OamF2YS5sYW5nLkVudW0AAAAAAAAAABIAAHhwdAAIV09SS0ZMT1d3NgAOQWxsUHJvZ3JhbX" + + "NBcHAAJDc4ZmU1MmMxLTM5MjEtMTFlYy04Y2MxLTAwMDAwMDc3OWM0Mn5yAB5pby5jZGFwL" + + "mNkYXAuYXBpLlByb2dyYW1TdGF0dXMAAAAAAAAAABIAAHhxAH4AA3QACUNPTVBMRVRFRHB3" + + "BAAAAAB4"; // Verify that we can always deserialize. DefaultProgramStatusTriggerInfo deserializedTriggerInfo = - (DefaultProgramStatusTriggerInfo) deSerializeFromStringBase64(serialized); + (DefaultProgramStatusTriggerInfo) deSerializeFromStringBase64(serialized); Assert.assertEquals(namespace, deserializedTriggerInfo.getNamespace()); Assert.assertEquals(AllProgramsApp.NAME, deserializedTriggerInfo.getApplicationName()); Assert.assertEquals(ProgramType.WORKFLOW, deserializedTriggerInfo.getProgramType()); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/AppFabricTestBase.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/AppFabricTestBase.java index a26a3f89af45..2795703696e9 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/AppFabricTestBase.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/AppFabricTestBase.java @@ -590,9 +590,10 @@ protected HttpResponse deploy(Class application, int expectedCode, @Nullable HttpResponse response = HttpRequests.execute(builder.build(), httpRequestConfig); if (expectedCode != response.getResponseCode()) { Assert.fail( - String.format("Expected response code %d but got %d when trying to deploy app '%s' in namespace '%s'. " + - "Response message = '%s'", expectedCode, response.getResponseCode(), - application.getName(), namespace, response.getResponseMessage())); + String.format( + "Expected response code %d but got %d when trying to deploy app '%s' in namespace '%s'. " + + "Response message = '%s'", expectedCode, response.getResponseCode(), + application.getName(), namespace, response.getResponseMessage())); } return response; } @@ -1174,13 +1175,15 @@ protected List listSchedulesByTriggerProgram(String namespace, P @Nullable ProgramScheduleStatus scheduleStatus, ProgramStatus... programStatuses) throws Exception { - String schedulesUrl = String.format("schedules/trigger-type/program-status?trigger-namespace-id=%s" + - "&trigger-app-name=%s&trigger-app-version=%s" + - "&trigger-program-type=%s&trigger-program-name=%s", programId.getNamespace(), - programId.getApplication(), programId.getVersion(), - programId.getType().getCategoryName(), programId.getProgram()); + String schedulesUrl = String.format( + "schedules/trigger-type/program-status?trigger-namespace-id=%s" + + "&trigger-app-name=%s&trigger-app-version=%s" + + "&trigger-program-type=%s&trigger-program-name=%s", programId.getNamespace(), + programId.getApplication(), programId.getVersion(), + programId.getType().getCategoryName(), programId.getProgram()); if (programStatuses.length > 0) { - List statusNames = Arrays.stream(programStatuses).map(Enum::name).collect(Collectors.toList()); + List statusNames = Arrays.stream(programStatuses).map(Enum::name) + .collect(Collectors.toList()); schedulesUrl = schedulesUrl + "&trigger-program-statuses=" + Joiner.on(",").join(statusNames); } if (scheduleStatus != null) { diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/AppLifecycleHttpHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/AppLifecycleHttpHandlerTest.java index 36954ceabe82..b5a4b1c4a690 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/AppLifecycleHttpHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/AppLifecycleHttpHandlerTest.java @@ -1170,19 +1170,20 @@ public void testDelete() throws Exception { waitState(program, "RUNNING"); // Try to delete all Apps while service is running response = doDelete(getVersionedAPIPath("apps", Constants.Gateway.API_VERSION_3_TOKEN, - TEST_NAMESPACE1)); + TEST_NAMESPACE1)); Assert.assertEquals(409, response.getResponseCode()); - Assert.assertEquals("'" + program.getNamespace() + - "' could not be deleted. Reason: The following programs are still running: " - + program.getApplicationId() + ": " + program.getId(), - response.getResponseBodyAsString()); + Assert.assertEquals("'" + program.getNamespace() + + "' could not be deleted. Reason: The following programs are still running: " + + program.getApplicationId() + ": " + program.getId(), + response.getResponseBodyAsString()); stopProgram(program); waitState(program, "STOPPED"); // Delete the app in the wrong namespace - response = doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, - TEST_NAMESPACE2)); + response = doDelete( + getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + TEST_NAMESPACE2)); Assert.assertEquals(404, response.getResponseCode()); // Delete an non-existing app with version @@ -1206,19 +1207,20 @@ public void testDelete() throws Exception { waitState(program1, "RUNNING"); // Try to delete an App while its service is running response = doDelete(getVersionedAPIPath( - String.format("apps/%s/versions/%s", appId.getApplication(), appId.getVersion()), - Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); + String.format("apps/%s/versions/%s", appId.getApplication(), appId.getVersion()), + Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); Assert.assertEquals(409, response.getResponseCode()); - Assert.assertEquals("'" + program1.getParent() + "' could not be deleted. Reason: The following programs" + - " are still running: " + program1.getProgram(), response.getResponseBodyAsString()); + Assert.assertEquals( + "'" + program1.getParent() + "' could not be deleted. Reason: The following programs" + + " are still running: " + program1.getProgram(), response.getResponseBodyAsString()); stopProgram(program1, null, 200, null); waitState(program1, "STOPPED"); // Delete the app with version in the wrong namespace response = doDelete(getVersionedAPIPath( - String.format("apps/%s/versions/%s", appId.getApplication(), appId.getVersion()), - Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); + String.format("apps/%s/versions/%s", appId.getApplication(), appId.getVersion()), + Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(404, response.getResponseCode()); //Delete the app with version after stopping the service @@ -1292,19 +1294,20 @@ public void testDeleteLCMFlagEnabled() throws Exception { waitState(program, "RUNNING"); // Try to delete all Apps while service is running response = doDelete(getVersionedAPIPath("apps", Constants.Gateway.API_VERSION_3_TOKEN, - TEST_NAMESPACE1)); + TEST_NAMESPACE1)); Assert.assertEquals(409, response.getResponseCode()); - Assert.assertEquals("'" + program.getNamespace() + - "' could not be deleted. Reason: The following programs are still running: " - + program.getApplicationId() + ": " + program.getId(), - response.getResponseBodyAsString()); + Assert.assertEquals("'" + program.getNamespace() + + "' could not be deleted. Reason: The following programs are still running: " + + program.getApplicationId() + ": " + program.getId(), + response.getResponseBodyAsString()); stopProgram(program); waitState(program, "STOPPED"); // Delete the app in the wrong namespace - response = doDelete(getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, - TEST_NAMESPACE2)); + response = doDelete( + getVersionedAPIPath("apps/" + AllProgramsApp.NAME, Constants.Gateway.API_VERSION_3_TOKEN, + TEST_NAMESPACE2)); Assert.assertEquals(404, response.getResponseCode()); // Delete an non-existing app with version @@ -1327,22 +1330,23 @@ public void testDeleteLCMFlagEnabled() throws Exception { waitState(program1, "RUNNING"); // Try to delete an App while its service is running response = doDelete(getVersionedAPIPath( - String.format("apps/%s", appId.getApplication()), - Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); + String.format("apps/%s", appId.getApplication()), + Constants.Gateway.API_VERSION_3_TOKEN, appId.getNamespace())); Assert.assertEquals(409, response.getResponseCode()); - ProgramReference programIdDefault = new ApplicationReference(appId.getNamespace(), appId.getApplication()) - .program(ProgramType.SERVICE, AllProgramsApp.NoOpService.NAME); - Assert.assertEquals("'" + programIdDefault.getParent() + "' could not be deleted. Reason: " + - "The following programs are still running: " + AllProgramsApp.NoOpService.NAME, - response.getResponseBodyAsString()); + ProgramReference programIdDefault = new ApplicationReference(appId.getNamespace(), + appId.getApplication()) + .program(ProgramType.SERVICE, AllProgramsApp.NoOpService.NAME); + Assert.assertEquals("'" + programIdDefault.getParent() + "' could not be deleted. Reason: " + + "The following programs are still running: " + AllProgramsApp.NoOpService.NAME, + response.getResponseBodyAsString()); stopProgram(program1, null, 200, null); waitState(program1, "STOPPED"); // Delete the app with version in the wrong namespace response = doDelete(getVersionedAPIPath( - String.format("apps/%s", appId.getApplication()), - Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); + String.format("apps/%s", appId.getApplication()), + Constants.Gateway.API_VERSION_3_TOKEN, TEST_NAMESPACE2)); Assert.assertEquals(404, response.getResponseCode()); //Delete the app with version after stopping the service diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerTest.java index 1f439b154ac1..b22cc159564f 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/services/http/handlers/ProgramLifecycleHttpHandlerTest.java @@ -1897,16 +1897,18 @@ private void verifyProgramHistory(ProgramId program) throws Exception { } private void historyStatusWithRetry(ProgramId program, ProgramRunStatus status, int size) throws Exception { - String urlAppVersionPart = ApplicationId.DEFAULT_VERSION.equals(program.getVersion()) ? - "" : "/versions/" + program.getVersion(); - String basePath = String.format("apps/%s%s/%s/%s/runs", program.getApplication(), urlAppVersionPart, - program.getType().getCategoryName(), program.getProgram()); + String urlAppVersionPart = ApplicationId.DEFAULT_VERSION.equals(program.getVersion()) + ? "" : "/versions/" + program.getVersion(); + String basePath = String.format("apps/%s%s/%s/%s/runs", program.getApplication(), + urlAppVersionPart, + program.getType().getCategoryName(), program.getProgram()); String runsUrl = getVersionedAPIPath(basePath + "?status=" + status.name(), - Constants.Gateway.API_VERSION_3_TOKEN, program.getNamespace()); + Constants.Gateway.API_VERSION_3_TOKEN, program.getNamespace()); int trials = 0; while (trials++ < 5) { HttpResponse response = doGet(runsUrl); - List result = GSON.fromJson(response.getResponseBodyAsString(), LIST_OF_RUN_RECORD); + List result = GSON.fromJson(response.getResponseBodyAsString(), + LIST_OF_RUN_RECORD); if (result != null && result.size() >= size) { for (RunRecord m : result) { String runUrl = getVersionedAPIPath(basePath + "/" + m.getPid(), Constants.Gateway.API_VERSION_3_TOKEN, @@ -1937,17 +1939,18 @@ private void testRuntimeArgs(Class app, String namespace, String appId, Strin deploy(app, 200, Constants.Gateway.API_VERSION_3_TOKEN, namespace); ApplicationDetail appDetails = getAppDetails(namespace, appId); - String versionedRuntimeArgsUrl = getVersionedAPIPath("apps/" + appId + "/" + programType + "/" + programId + - "/runtimeargs", Constants.Gateway.API_VERSION_3_TOKEN, - namespace); + String versionedRuntimeArgsUrl = getVersionedAPIPath( + "apps/" + appId + "/" + programType + "/" + programId + + "/runtimeargs", Constants.Gateway.API_VERSION_3_TOKEN, + namespace); verifyRuntimeArgs(versionedRuntimeArgsUrl); String versionedRuntimeArgsAppVersionUrl = getVersionedAPIPath("apps/" + appId - + "/versions/" + - appDetails.getAppVersion() - + "/" + programType - + "/" + programId + "/runtimeargs", - Constants.Gateway.API_VERSION_3_TOKEN, namespace); + + "/versions/" + + appDetails.getAppVersion() + + "/" + programType + + "/" + programId + "/runtimeargs", + Constants.Gateway.API_VERSION_3_TOKEN, namespace); verifyRuntimeArgs(versionedRuntimeArgsAppVersionUrl); } diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/DefaultStoreTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/DefaultStoreTest.java index 685cf06a2fb6..528e6ecc3caf 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/DefaultStoreTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/DefaultStoreTest.java @@ -696,8 +696,8 @@ public void testProgramRunCount() throws ConflictException { for (RunCountResult runCountResult : result) { ProgramReference programReference = runCountResult.getProgramReference(); Long count = runCountResult.getCount(); - if (programReference.equals(nonExistingAppProgramId.getProgramReference()) || - programReference.equals(nonExistingProgramId.getProgramReference())) { + if (programReference.equals(nonExistingAppProgramId.getProgramReference()) + || programReference.equals(nonExistingProgramId.getProgramReference())) { Assert.assertNull(count); Assert.assertTrue(runCountResult.getException() instanceof NotFoundException); } else { @@ -1162,16 +1162,16 @@ public void testRunningInRangeMulti() { @Test public void testStateRemovedOnRemoveApplication() throws ApplicationNotFoundException, ConflictException { String stateKey = "kafka"; - byte[] stateValue = ("{\n" + - "\"offset\" : 12345\n" + - "}").getBytes(StandardCharsets.UTF_8); + byte[] stateValue = ("{\n" + + "\"offset\" : 12345\n" + + "}").getBytes(StandardCharsets.UTF_8); ApplicationSpecification spec = Specifications.from(new AllProgramsApp()); NamespaceId namespaceId = new NamespaceId("account1"); ApplicationId appId = namespaceId.app(spec.getName()); ApplicationMeta appMeta = new ApplicationMeta(spec.getName(), spec, - new ChangeDetail(null, null, null, - System.currentTimeMillis())); + new ChangeDetail(null, null, null, + System.currentTimeMillis())); store.addApplication(appId, appMeta); store.saveState(new AppStateKeyValue(namespaceId, spec.getName(), stateKey, stateValue)); @@ -1188,17 +1188,17 @@ public void testStateRemovedOnRemoveApplication() throws ApplicationNotFoundExce @Test public void testStateRemovedOnRemoveAll() throws ApplicationNotFoundException, ConflictException { String stateKey = "kafka"; - byte[] stateValue = ("{\n" + - "\"offset\" : 12345\n" + - "}").getBytes(StandardCharsets.UTF_8); + byte[] stateValue = ("{\n" + + "\"offset\" : 12345\n" + + "}").getBytes(StandardCharsets.UTF_8); String appName = "application1"; ApplicationSpecification spec = Specifications.from(new AllProgramsApp()); NamespaceId namespaceId = new NamespaceId("account1"); ApplicationId appId = namespaceId.app(appName); ApplicationMeta appMeta = new ApplicationMeta(spec.getName(), spec, - new ChangeDetail(null, null, null, - System.currentTimeMillis())); + new ChangeDetail(null, null, null, + System.currentTimeMillis())); store.addApplication(appId, appMeta); store.saveState(new AppStateKeyValue(namespaceId, appName, stateKey, stateValue)); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/state/AppStateHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/state/AppStateHandlerTest.java index 45023c40498b..76be4472ad7a 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/state/AppStateHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/state/AppStateHandlerTest.java @@ -53,14 +53,15 @@ import org.junit.rules.TemporaryFolder; public class AppStateHandlerTest extends AppFabricTestBase { + public static final String NAMESPACE_1 = "ns1"; public static final String NAMESPACE_2 = "ns2"; public static final String APP_NAME = "testapp"; public static final String APP_NAME_2 = "testapp2"; public static final String STATE_KEY = "kafka"; - public static final String STATE_VALUE = "{\n" + - "\"offset\" : 12345\n" + - "}"; + public static final String STATE_VALUE = "{\n" + + "\"offset\" : 12345\n" + + "}"; private static String endpoint; private static ApplicationLifecycleService applicationLifecycleService; diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/state/AppStateTableTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/state/AppStateTableTest.java index 6dcbe096fd08..a41ce9acb37e 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/state/AppStateTableTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/app/store/state/AppStateTableTest.java @@ -43,9 +43,9 @@ public class AppStateTableTest extends AppFabricTestBase { public static final String APP_NAME = "testapp"; public static final String STATE_KEY = "kafka"; public static final String STATE_KEY_2 = "pubSub"; - public static final byte[] STATE_VALUE = ("{\n" + - "\"offset\" : 12345\n" + - "}").getBytes(StandardCharsets.UTF_8); + public static final byte[] STATE_VALUE = ("{\n" + + "\"offset\" : 12345\n" + + "}").getBytes(StandardCharsets.UTF_8); private static NamespaceId namespaceId1; private static AppStateKey request; diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/tethering/TetheringServerHandlerTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/tethering/TetheringServerHandlerTest.java index 3a47badef01d..24f64e5c5284 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/tethering/TetheringServerHandlerTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/tethering/TetheringServerHandlerTest.java @@ -223,12 +223,12 @@ public void setUp() throws Exception { public void tearDown() throws IOException { // Delete tethering if it exists HttpRequest.Builder builder = HttpRequest.builder(HttpMethod.DELETE, - config.resolveURL("tethering/connections/xyz")); + config.resolveURL("tethering/connections/xyz")); HttpResponse response = HttpRequests.execute(builder.build()); int responseCode = response.getResponseCode(); - Assert.assertTrue(responseCode == HttpResponseStatus.OK.code() || - responseCode == HttpResponseStatus.NOT_FOUND.code()); + Assert.assertTrue(responseCode == HttpResponseStatus.OK.code() + || responseCode == HttpResponseStatus.NOT_FOUND.code()); } @Test diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/scheduler/CoreSchedulerServiceTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/scheduler/CoreSchedulerServiceTest.java index f1803aa8c547..d33af755161b 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/scheduler/CoreSchedulerServiceTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/scheduler/CoreSchedulerServiceTest.java @@ -527,11 +527,12 @@ private void testScheduleUpdate(ProgramId workflow2, ApplicationId appId, String // A pending job will be created, but it won't run Assert.assertTrue("Expected a PENDING_TRIGGER job for " + scheduleId2, Iterables.any(getAllJobs(), job -> { - if (!(job.getSchedule().getTrigger() instanceof ProtoTrigger.PartitionTrigger)) { + if (!(job.getSchedule() + .getTrigger() instanceof ProtoTrigger.PartitionTrigger)) { return false; } - return scheduleId2.equals(job.getJobKey().getScheduleId()) && - job.getState() == Job.State.PENDING_TRIGGER; + return scheduleId2.equals(job.getJobKey().getScheduleId()) + && job.getState() == Job.State.PENDING_TRIGGER; })); @@ -567,11 +568,12 @@ private void testScheduleUpdate(ProgramId workflow2, ApplicationId appId, String // Again, a pending job will be created, but it won't run since updating the schedule would remove pending trigger Assert.assertTrue("Expected a PENDING_TRIGGER job for " + scheduleId2, Iterables.any(getAllJobs(), job -> { - if (!(job.getSchedule().getTrigger() instanceof ProtoTrigger.PartitionTrigger)) { + if (!(job.getSchedule() + .getTrigger() instanceof ProtoTrigger.PartitionTrigger)) { return false; } - return scheduleId2.equals(job.getJobKey().getScheduleId()) && - job.getState() == Job.State.PENDING_TRIGGER; + return scheduleId2.equals(job.getJobKey().getScheduleId()) + && job.getState() == Job.State.PENDING_TRIGGER; })); Assert.assertEquals(runs, getRuns(workflow2, ProgramRunStatus.ALL)); diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/security/DefaultSecretStoreTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/security/DefaultSecretStoreTest.java index 9d03a4a99474..855e8828f373 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/security/DefaultSecretStoreTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/security/DefaultSecretStoreTest.java @@ -139,11 +139,11 @@ public boolean equals(Object o) { TestSecret secret = (TestSecret) o; - return creationTimeMs == secret.creationTimeMs && - Objects.equals(name, secret.name) && - Objects.equals(description, secret.description) && - Arrays.equals(secretData, secret.secretData) && - Objects.equals(properties, secret.properties); + return creationTimeMs == secret.creationTimeMs + && Objects.equals(name, secret.name) + && Objects.equals(description, secret.description) + && Arrays.equals(secretData, secret.secretData) + && Objects.equals(properties, secret.properties); } @Override diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/security/impersonation/DefaultUGIProviderTest.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/security/impersonation/DefaultUGIProviderTest.java index 4f15d4b8a015..ae3d4c9ff25f 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/security/impersonation/DefaultUGIProviderTest.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/security/impersonation/DefaultUGIProviderTest.java @@ -259,8 +259,8 @@ private OwnerAdmin getOwnerAdmin() { } private void setKeytabDir(String keytabDirPath) { - cConf.set(Constants.Security.KEYTAB_PATH, keytabDirPath + "/" + - Constants.USER_NAME_SPECIFIER + ".keytab"); + cConf.set(Constants.Security.KEYTAB_PATH, keytabDirPath + "/" + + Constants.USER_NAME_SPECIFIER + ".keytab"); } private static String getPrincipal(String name) { diff --git a/cdap-app-fabric/src/test/java/org/apache/hadoop/util/Shell.java b/cdap-app-fabric/src/test/java/org/apache/hadoop/util/Shell.java index 864ba9d75d2c..b0906e39b7ae 100644 --- a/cdap-app-fabric/src/test/java/org/apache/hadoop/util/Shell.java +++ b/cdap-app-fabric/src/test/java/org/apache/hadoop/util/Shell.java @@ -187,9 +187,9 @@ public static String[] getReadlinkCommand(String link) { /** Return a command for determining if process with specified pid is alive. */ public static String[] getCheckProcessIsAliveCommand(String pid) { - return Shell.WINDOWS ? - new String[] { Shell.WINUTILS, "task", "isAlive", pid } : - new String[] { "kill", "-0", isSetsidAvailable ? "-" + pid : pid }; + return Shell.WINDOWS + ? new String[]{Shell.WINUTILS, "task", "isAlive", pid} : + new String[]{"kill", "-0", isSetsidAvailable ? "-" + pid : pid}; } /** Return a command to send a signal to a given pid */ diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/JavaSparkMainWrapper.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/JavaSparkMainWrapper.java index b2961489b2fe..ef136865e57f 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/JavaSparkMainWrapper.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/JavaSparkMainWrapper.java @@ -63,8 +63,8 @@ public void run(JavaSparkExecutionContext sec) throws Exception { } else { // otherwise, assume there is a 'main' method and call it String programArgs = getProgramArgs(sec, stageName); - String[] args = programArgs == null ? - RuntimeArguments.toPosixArray(sec.getRuntimeArguments()) : programArgs.split(" "); + String[] args = programArgs == null + ? RuntimeArguments.toPosixArray(sec.getRuntimeArguments()) : programArgs.split(" "); final Method mainMethod = mainClass.getMethod("main", String[].class); final Object[] methodArgs = new Object[1]; methodArgs[0] = args; @@ -83,8 +83,8 @@ public Void call() throws Exception { private String getProgramArgs(JavaSparkExecutionContext sec, String stageName) { // get program args from plugin properties PluginProperties pluginProperties = sec.getPluginContext().getPluginProperties(stageName); - String programArgs = pluginProperties == null ? - null : pluginProperties.getProperties().get(ExternalSparkProgram.PROGRAM_ARGS); + String programArgs = pluginProperties == null + ? null : pluginProperties.getProperties().get(ExternalSparkProgram.PROGRAM_ARGS); // can be overridden by runtime args String programArgsKey = stageName + "." + ExternalSparkProgram.PROGRAM_ARGS; diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/SmartWorkflow.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/SmartWorkflow.java index 1492b7b48bd4..119479436762 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/SmartWorkflow.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/SmartWorkflow.java @@ -441,8 +441,8 @@ public void initialize(WorkflowContext context) throws Exception { } if (spec.getEngine() == Engine.MAPREDUCE) { - WRAPPERLOGGER.warn("Pipeline '{}' is using Mapreduce engine which is planned to be deprecated. " + - "Please use Spark engine.", context.getApplicationSpecification().getName()); + WRAPPERLOGGER.warn("Pipeline '{}' is using Mapreduce engine which is planned to be deprecated. " + + "Please use Spark engine.", context.getApplicationSpecification().getName()); } PipelineRuntime pipelineRuntime = new PipelineRuntime(context, workflowMetrics); WRAPPERLOGGER.info("Pipeline '{}' is started by user '{}' with arguments {}", @@ -647,9 +647,9 @@ private void addBranchPrograms(String node, WorkflowProgramAdder programAdder, b // if we're already on a branch, we should never have another branch for non-condition programs Set nodeOutputs = dag.getNodeOutputs(node); if (nodeOutputs.size() > 1) { - throw new IllegalStateException("Found an unexpected non-condition branch while on another branch. " + - "This means there is a pipeline planning bug. " + - "Please contact the CDAP team to open a bug report."); + throw new IllegalStateException("Found an unexpected non-condition branch while on another branch. " + + "This means there is a pipeline planning bug. " + + "Please contact the CDAP team to open a bug report."); } if (!nodeOutputs.isEmpty()) { addBranchPrograms(dag.getNodeOutputs(node).iterator().next(), programAdder, shouldJoin); diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/connection/ConnectionStore.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/connection/ConnectionStore.java index e59dd53e1242..12cd7afbf5e6 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/connection/ConnectionStore.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/connection/ConnectionStore.java @@ -128,8 +128,8 @@ public void saveConnection(ConnectionId connectionId, Connection connection, boo if (oldConnection != null) { if (oldConnection.isPreConfigured()) { throw new ConnectionConflictException(String.format( - "Connection %s in namespace %s has same id %s and is pre-configured. " + - "Preconfigured connections cannot be updated or overwritten.", + "Connection %s in namespace %s has same id %s and is pre-configured. " + + "Preconfigured connections cannot be updated or overwritten.", oldConnection.getName(), connectionId.getNamespace(), connectionId.getConnectionId())); } diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/Draft.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/Draft.java index 8dd57caa6f06..73d32f0e096c 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/Draft.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/Draft.java @@ -74,10 +74,10 @@ public boolean equals(Object o) { return false; } Draft draft = (Draft) o; - return createdTimeMillis == draft.createdTimeMillis && - updatedTimeMillis == draft.updatedTimeMillis && - configHash == draft.configHash && - Objects.equals(id, draft.id); + return createdTimeMillis == draft.createdTimeMillis + && updatedTimeMillis == draft.updatedTimeMillis + && configHash == draft.configHash + && Objects.equals(id, draft.id); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/DraftId.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/DraftId.java index edea53de127c..8d61afbcd00d 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/DraftId.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/DraftId.java @@ -53,9 +53,9 @@ public boolean equals(Object o) { return false; } DraftId draftId = (DraftId) o; - return Objects.equals(namespace, draftId.namespace) && - Objects.equals(id, draftId.id) && - Objects.equals(owner, draftId.owner); + return Objects.equals(namespace, draftId.namespace) + && Objects.equals(id, draftId.id) + && Objects.equals(owner, draftId.owner); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/DraftStoreRequest.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/DraftStoreRequest.java index 35cf8e82311d..da4654a6e114 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/DraftStoreRequest.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/draft/DraftStoreRequest.java @@ -97,12 +97,12 @@ public boolean equals(Object o) { return false; } DraftStoreRequest that = (DraftStoreRequest) o; - return Objects.equals(config, that.config) && - Objects.equals(previousHash, that.previousHash) && - Objects.equals(name, that.name) && - Objects.equals(artifact, that.artifact) && - revision == that.revision && - Objects.equals(parentVersion, that.parentVersion); + return Objects.equals(config, that.config) + && Objects.equals(previousHash, that.previousHash) + && Objects.equals(name, that.name) + && Objects.equals(artifact, that.artifact) + && revision == that.revision + && Objects.equals(parentVersion, that.parentVersion); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/ConnectionUtils.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/ConnectionUtils.java index 104109e9bf16..2f234083e88c 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/ConnectionUtils.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/ConnectionUtils.java @@ -96,8 +96,8 @@ public static SampleResponse getSampleResponse(Connector connector, ConnectorCon List sample = limitingConnector.sample(connectorContext, sampleRequest); return new SampleResponse(detail, sample.isEmpty() ? null : sample.get(0).getSchema(), sample); } - throw new ConnectionBadRequestException("Connector is not supported. " + - "The supported connector should be DirectConnector or BatchConnector."); + throw new ConnectionBadRequestException("Connector is not supported. " + + "The supported connector should be DirectConnector or BatchConnector."); } /** diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/OAuthHandler.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/OAuthHandler.java index 876ac1a5e8e8..319f6dac4f49 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/OAuthHandler.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/OAuthHandler.java @@ -147,12 +147,12 @@ public void putOAuthCredential(HttpServiceRequest request, HttpServiceResponder try { putOAuthCredentialRequest = GSON.fromJson(StandardCharsets.UTF_8.decode(request.getContent()).toString(), PutOAuthCredentialRequest.class); - if (putOAuthCredentialRequest.getOneTimeCode() == null || - putOAuthCredentialRequest.getOneTimeCode().isEmpty()) { + if (putOAuthCredentialRequest.getOneTimeCode() == null + || putOAuthCredentialRequest.getOneTimeCode().isEmpty()) { throw new OAuthServiceException(HttpURLConnection.HTTP_BAD_REQUEST, "Invalid request: missing one-time code"); } - if (putOAuthCredentialRequest.getRedirectURI() == null || - putOAuthCredentialRequest.getRedirectURI().isEmpty()) { + if (putOAuthCredentialRequest.getRedirectURI() == null + || putOAuthCredentialRequest.getRedirectURI().isEmpty()) { throw new OAuthServiceException(HttpURLConnection.HTTP_BAD_REQUEST, "Invalid request: missing redirect URI"); } } catch (JsonSyntaxException e) { diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/PipelineTriggers.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/PipelineTriggers.java index 79761f896176..212ffee672b3 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/PipelineTriggers.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/PipelineTriggers.java @@ -86,8 +86,8 @@ public static void addSchedulePropertiesMapping(Map mappings, } String sourceKey = mapping.getSource(); if (sourceKey == null) { - LOG.warn("The name of argument from the triggering pipeline cannot be null, " + - "skip this argument mapping: '{}'.", mapping); + LOG.warn("The name of argument from the triggering pipeline cannot be null, " + + "skip this argument mapping: '{}'.", mapping); continue; } String value = triggeringArguments.get(sourceKey); @@ -124,8 +124,8 @@ public static void addSchedulePropertiesMapping(Map mappings, } String sourceKey = mapping.getSource(); if (sourceKey == null) { - LOG.warn("The name of argument from the triggering pipeline cannot be null, " + - "skip this argument mapping: '{}'.", mapping); + LOG.warn("The name of argument from the triggering pipeline cannot be null, " + + "skip this argument mapping: '{}'.", mapping); continue; } String value = pluginProperties.get(sourceKey); diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/ValidationHandler.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/ValidationHandler.java index 71a11b8a1a1b..80abbaa124a8 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/ValidationHandler.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/main/java/io/cdap/cdap/datapipeline/service/ValidationHandler.java @@ -124,8 +124,8 @@ private void validateRemotely(HttpServiceRequest request, HttpServiceResponder r private int getExceptionCode(String exceptionClass, String exceptionMessage, String namespace) { if (IllegalArgumentException.class.getName().equals(exceptionClass)) { - return String.format(RemoteValidationTask.NAMESPACE_DOES_NOT_EXIST, namespace).equals(exceptionMessage) ? - HttpURLConnection.HTTP_NOT_FOUND : HttpURLConnection.HTTP_BAD_REQUEST; + return String.format(RemoteValidationTask.NAMESPACE_DOES_NOT_EXIST, namespace).equals(exceptionMessage) + ? HttpURLConnection.HTTP_NOT_FOUND : HttpURLConnection.HTTP_BAD_REQUEST; } return HttpURLConnection.HTTP_INTERNAL_ERROR; } diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/AutoJoinerTest.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/AutoJoinerTest.java index cc6e16294d0e..154deb83ffa4 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/AutoJoinerTest.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/AutoJoinerTest.java @@ -1905,8 +1905,8 @@ public void testLeftOuterComplexConditionBroadcast() throws Exception { JoinCondition.OnExpression condition = JoinCondition.onExpression() .addDatasetAlias("sales", "S") .addDatasetAlias("categories", "C") - .setExpression("S.price > 1000 and S.date > '2020-01-01 00:00:00' and " + - "(S.category = C.id or (S.category is null and S.department = C.department))") + .setExpression("S.price > 1000 and S.date > '2020-01-01 00:00:00' and " + + "(S.category = C.id or (S.category is null and S.department = C.department))") .build(); Map joinerProperties = MockAutoJoiner.getProperties(Arrays.asList("sales", "categories"), Collections.emptyList(), diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DataPipelineServiceTest.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DataPipelineServiceTest.java index af3d713cc563..a67948bb8648 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DataPipelineServiceTest.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DataPipelineServiceTest.java @@ -454,8 +454,8 @@ public void testValidationFailureForAggregator() throws Exception { public void testValidationFailureForJoiner() throws Exception { String stageName = "joiner"; // join key field t2_cust_name does not exist - ETLStage stage = new ETLStage(stageName, MockJoiner.getPlugin("t1.customer_id=t2.cust_id&" + - "t1.customer_name=t2.t2_cust_name", "t1,t2", "")); + ETLStage stage = new ETLStage(stageName, MockJoiner.getPlugin("t1.customer_id=t2.cust_id&" + + "t1.customer_name=t2.t2_cust_name", "t1,t2", "")); StageSchema inputSchema1 = new StageSchema( "t1", Schema.recordOf("id", Schema.Field.of("customer_id", Schema.of(Schema.Type.STRING)), Schema.Field.of("customer_name", Schema.of(Schema.Type.STRING)))); diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DataPipelineTest.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DataPipelineTest.java index 2b8fb22761b0..0982e3f55d37 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DataPipelineTest.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DataPipelineTest.java @@ -138,13 +138,6 @@ import io.cdap.common.http.HttpRequest; import io.cdap.common.http.HttpRequests; import io.cdap.common.http.HttpResponse; -import org.apache.twill.api.RunId; -import org.junit.After; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; - import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -164,6 +157,12 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; +import org.apache.twill.api.RunId; +import org.junit.After; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; /** * @@ -2401,8 +2400,8 @@ private void testInnerJoinWithMultiOutput(Engine engine) throws Exception { .addStage(new ETLStage("t1", IdentityTransform.getPlugin())) .addStage(new ETLStage("t2", IdentityTransform.getPlugin())) .addStage(new ETLStage("t3", IdentityTransform.getPlugin())) - .addStage(new ETLStage(joinerName, MockJoiner.getPlugin("t1.customer_id=t2.cust_id=t3.c_id&" + - "t1.customer_name=t2.cust_name=t3.c_name", + .addStage(new ETLStage(joinerName, MockJoiner.getPlugin("t1.customer_id=t2.cust_id=t3.c_id&" + + "t1.customer_name=t2.cust_name=t3.c_name", "t1,t2,t3", ""))) .addStage(new ETLStage(sinkName, MockExternalSink.getPlugin(UUID.randomUUID().toString(), "s1", output1))) .addStage(new ETLStage(sinkName2, MockExternalSink.getPlugin(UUID.randomUUID().toString(), "s2", output2))) @@ -2530,8 +2529,9 @@ private void testOuterJoin(Engine engine) throws Exception { .addStage(new ETLStage("t1", IdentityTransform.getPlugin())) .addStage(new ETLStage("t2", IdentityTransform.getPlugin())) .addStage(new ETLStage("t3", IdentityTransform.getPlugin())) - .addStage(new ETLStage(joinerName, MockJoiner.getPlugin("t1.customer_id=t2.cust_id=t3.c_id&" + - "t1.customer_name=t2.cust_name=t3.c_name", "t1", ""))) + .addStage(new ETLStage(joinerName, MockJoiner.getPlugin("t1.customer_id=t2.cust_id=t3.c_id&" + + "t1.customer_name=t2.cust_name=t3.c_name", + "t1", ""))) .addStage(new ETLStage(sinkName, MockSink.getPlugin(outputName))) .addConnection("source1", "t1") .addConnection("source2", "t2") diff --git a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DraftServiceTest.java b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DraftServiceTest.java index fb5744652f6e..b8f6a761e8ab 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DraftServiceTest.java +++ b/cdap-app-templates/cdap-etl/cdap-data-pipeline-base/src/test/java/io/cdap/cdap/datapipeline/DraftServiceTest.java @@ -419,13 +419,13 @@ private void createPipelineDraft(DraftId draftId, DraftStoreRequest draftStoreRe private boolean sameDraft(Draft d1, Draft d2) { boolean sameCreateTime = Math.abs(d1.getCreatedTimeMillis() - d2.getCreatedTimeMillis()) < 1000; boolean sameUpdateTime = Math.abs(d1.getUpdatedTimeMillis() - d2.getUpdatedTimeMillis()) < 1000; - boolean sameProperties = d1.getRevision() == d2.getRevision() && - Objects.equals(d1.getConfig(), d2.getConfig()) && - Objects.equals(d1.getPreviousHash(), d2.getPreviousHash()) && - Objects.equals(d1.getName(), d2.getName()) && - Objects.equals(d1.getDescription(), d2.getDescription()) && - Objects.equals(d1.getId(), d2.getId()) && - Objects.equals(d1.getArtifact(), d2.getArtifact()); + boolean sameProperties = d1.getRevision() == d2.getRevision() + && Objects.equals(d1.getConfig(), d2.getConfig()) + && Objects.equals(d1.getPreviousHash(), d2.getPreviousHash()) + && Objects.equals(d1.getName(), d2.getName()) + && Objects.equals(d1.getDescription(), d2.getDescription()) + && Objects.equals(d1.getId(), d2.getId()) + && Objects.equals(d1.getArtifact(), d2.getArtifact()); return sameProperties && sameCreateTime && sameUpdateTime; } diff --git a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsPipelineSpec.java b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsPipelineSpec.java index 35c5f4ce503e..f5458a7db315 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsPipelineSpec.java +++ b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsPipelineSpec.java @@ -116,14 +116,14 @@ public boolean equals(Object o) { DataStreamsPipelineSpec that = (DataStreamsPipelineSpec) o; - return batchIntervalMillis == that.batchIntervalMillis && - Objects.equals(extraJavaOpts, that.extraJavaOpts) && - stopGracefully == that.stopGracefully && - checkpointsDisabled == that.checkpointsDisabled && - isUnitTest == that.isUnitTest && - Objects.equals(stateSpec, that.stateSpec) && - Objects.equals(checkpointDirectory, that.checkpointDirectory) && - Objects.equals(pipelineId, that.pipelineId); + return batchIntervalMillis == that.batchIntervalMillis + && Objects.equals(extraJavaOpts, that.extraJavaOpts) + && stopGracefully == that.stopGracefully + && checkpointsDisabled == that.checkpointsDisabled + && isUnitTest == that.isUnitTest + && Objects.equals(stateSpec, that.stateSpec) + && Objects.equals(checkpointDirectory, that.checkpointDirectory) + && Objects.equals(pipelineId, that.pipelineId); } @Override @@ -134,16 +134,16 @@ public int hashCode() { @Override public String toString() { - return "DataStreamsPipelineSpec{" + - "batchIntervalMillis=" + batchIntervalMillis + - ", extraJavaOpts='" + extraJavaOpts + '\'' + - ", stopGracefully=" + stopGracefully + - ", checkpointsDisabled=" + checkpointsDisabled + - ", isUnitTest=" + isUnitTest + - ", checkpointDirectory='" + checkpointDirectory + '\'' + - ", pipelineId='" + pipelineId + '\'' + - ", stateSpec='" + stateSpec + '\'' + - "} " + super.toString(); + return "DataStreamsPipelineSpec{" + + "batchIntervalMillis=" + batchIntervalMillis + + ", extraJavaOpts='" + extraJavaOpts + '\'' + + ", stopGracefully=" + stopGracefully + + ", checkpointsDisabled=" + checkpointsDisabled + + ", isUnitTest=" + isUnitTest + + ", checkpointDirectory='" + checkpointDirectory + '\'' + + ", pipelineId='" + pipelineId + '\'' + + ", stateSpec='" + stateSpec + '\'' + + "} " + super.toString(); } public static Builder builder(long batchIntervalMillis) { diff --git a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsSparkLauncher.java b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsSparkLauncher.java index af40ef5e879d..f94dec78d217 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsSparkLauncher.java +++ b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsSparkLauncher.java @@ -155,8 +155,8 @@ public void initialize() throws Exception { try { int numExecutors = Integer.parseInt(property.getValue()); if (numExecutors < minExecutors) { - LOG.warn("Number of executors {} is less than the minimum number required to run the pipeline. " + - "Automatically increasing it to {}", numExecutors, minExecutors); + LOG.warn("Number of executors {} is less than the minimum number required to run the pipeline. " + + "Automatically increasing it to {}", numExecutors, minExecutors); numExecutors = minExecutors; } sparkConf.set(property.getKey(), String.valueOf(numExecutors)); diff --git a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsStateSpec.java b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsStateSpec.java index 9f90ac27505f..35eda0dd3f94 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsStateSpec.java +++ b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/DataStreamsStateSpec.java @@ -65,10 +65,10 @@ public int hashCode() { @Override public String toString() { - return "DataStreamsStateSpec{" + - "mode=" + mode + - ", checkpointDir='" + checkpointDir + '\'' + - '}'; + return "DataStreamsStateSpec{" + + "mode=" + mode + + ", checkpointDir='" + checkpointDir + '\'' + + '}'; } public static Builder getBuilder(Mode mode) { diff --git a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/SparkStreamingPipelineRunner.java b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/SparkStreamingPipelineRunner.java index 93ed1f58b3a0..171fe6030a9d 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/SparkStreamingPipelineRunner.java +++ b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/main/java/io/cdap/cdap/datastreams/SparkStreamingPipelineRunner.java @@ -139,8 +139,8 @@ private JavaDStream getDStream(StageSpec stageSpec, StageStatisticsColle // adds itself to the context dag. Yay for constructors with global side effects. // TODO: (HYDRATOR-1030) figure out how to do this at configure time instead of run time MacroEvaluator macroEvaluator = new ErrorMacroEvaluator( - "Due to spark limitations, macro evaluation is not allowed in streaming sources when checkpointing " + - "is enabled."); + "Due to spark limitations, macro evaluation is not allowed in streaming sources when checkpointing " + + "is enabled."); PluginContext pluginContext = new SparkPipelinePluginContext(sec.getPluginContext(), sec.getMetrics(), spec.isStageLoggingEnabled(), spec.isProcessTimingEnabled()); @@ -206,8 +206,8 @@ protected SparkCollection handleJoin(Map JoinDefinition joinDefinition = autoJoiner.define(autoJoinerContext); if (joinDefinition == null) { throw new IllegalStateException( - String.format("Joiner stage '%s' did not specify a join definition. " + - "Check with the plugin developer to ensure it is implemented correctly.", + String.format("Joiner stage '%s' did not specify a join definition. " + + "Check with the plugin developer to ensure it is implemented correctly.", stageName)); } joiner = new JoinerBridge(stageName, autoJoiner, joinDefinition); diff --git a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/test/java/io/cdap/cdap/datastreams/DataStreamsTest.java b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/test/java/io/cdap/cdap/datastreams/DataStreamsTest.java index 9384f5dd4a82..5432ab25b618 100644 --- a/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/test/java/io/cdap/cdap/datastreams/DataStreamsTest.java +++ b/cdap-app-templates/cdap-etl/cdap-data-streams-base/src/test/java/io/cdap/cdap/datastreams/DataStreamsTest.java @@ -372,8 +372,8 @@ private void testAggregatorJoinerMacrosWithCheckpoints(boolean isReducibleAggreg .addStage(new ETLStage("users2", MockSource.getPlugin(userSchema, users2))) .addStage(new ETLStage("sink1", MockSink.getPlugin("sink1"))) .addStage(new ETLStage("sink2", MockSink.getPlugin("sink2"))) - .addStage(new ETLStage("aggregator", isReducibleAggregator ? - FieldCountReducibleAggregator.getPlugin("${aggfield}", "${aggType}") : + .addStage(new ETLStage("aggregator", isReducibleAggregator + ? FieldCountReducibleAggregator.getPlugin("${aggfield}", "${aggType}") : FieldCountAggregator.getPlugin("${aggfield}", "${aggType}"))) .addStage(new ETLStage("dupeFlagger", DupeFlagger.getPlugin("users1", "${flagField}"))) .addConnection("users1", "aggregator") @@ -522,10 +522,10 @@ private void testParallelAggregators(boolean isReducibleAggregator) throws Excep .addStage(new ETLStage("source2", MockSource.getPlugin(inputSchema, input2))) .addStage(new ETLStage("sink1", MockSink.getPlugin(sink1Name))) .addStage(new ETLStage("sink2", MockSink.getPlugin(sink2Name))) - .addStage(new ETLStage("agg1", isReducibleAggregator ? - FieldCountReducibleAggregator.getPlugin("user", "string") : FieldCountAggregator.getPlugin("user", "string"))) - .addStage(new ETLStage("agg2", isReducibleAggregator ? - FieldCountReducibleAggregator.getPlugin("item", "long") : FieldCountAggregator.getPlugin("item", "long"))) + .addStage(new ETLStage("agg1", isReducibleAggregator + ? FieldCountReducibleAggregator.getPlugin("user", "string") : FieldCountAggregator.getPlugin("user", "string"))) + .addStage(new ETLStage("agg2", isReducibleAggregator + ? FieldCountReducibleAggregator.getPlugin("item", "long") : FieldCountAggregator.getPlugin("item", "long"))) .addConnection("source1", "agg1") .addConnection("source1", "agg2") .addConnection("source2", "agg1") @@ -1398,11 +1398,11 @@ public void testStageConsolidation() throws Exception { Set sink4Expected = new HashSet<>(Arrays.asList(item0, item2)); Set sink5Expected = new HashSet<>(Arrays.asList(item0, item1)); - Tasks.waitFor(true, () -> sink1Expected.equals(new HashSet<>(MockExternalSink.readOutput(output1, schema))) && - sink2Expected.equals(new HashSet<>(MockExternalSink.readOutput(output2, schema))) && - sink3Expected.equals(new HashSet<>(MockExternalSink.readOutput(output3, errorSchema))) && - sink4Expected.equals(new HashSet<>(MockExternalSink.readOutput(output4, schema))) && - sink5Expected.equals(new HashSet<>(MockExternalSink.readOutput(output5, schema))), + Tasks.waitFor(true, () -> sink1Expected.equals(new HashSet<>(MockExternalSink.readOutput(output1, schema))) + && sink2Expected.equals(new HashSet<>(MockExternalSink.readOutput(output2, schema))) + && sink3Expected.equals(new HashSet<>(MockExternalSink.readOutput(output3, errorSchema))) + && sink4Expected.equals(new HashSet<>(MockExternalSink.readOutput(output4, schema))) + && sink5Expected.equals(new HashSet<>(MockExternalSink.readOutput(output5, schema))), 3, TimeUnit.MINUTES); sparkManager.stop(); sparkManager.waitForStopped(1, TimeUnit.MINUTES); diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/Alert.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/Alert.java index d84b8d94783f..c8cef698dcbc 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/Alert.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/Alert.java @@ -70,9 +70,9 @@ public int hashCode() { @Override public String toString() { - return "Alert{" + - "stageName='" + stageName + '\'' + - ", payload=" + payload + - '}'; + return "Alert{" + + "stageName='" + stageName + '\'' + + ", payload=" + payload + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseDetail.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseDetail.java index 4f88b1654937..cf766f363108 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseDetail.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseDetail.java @@ -74,10 +74,10 @@ public boolean equals(Object o) { } BrowseDetail that = (BrowseDetail) o; - return totalCount == that.totalCount && - Objects.equals(sampleProperties, that.sampleProperties) && - Objects.equals(entities, that.entities) && - Objects.equals(propertyHeaders, that.propertyHeaders); + return totalCount == that.totalCount + && Objects.equals(sampleProperties, that.sampleProperties) + && Objects.equals(entities, that.entities) + && Objects.equals(propertyHeaders, that.propertyHeaders); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntity.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntity.java index dfaf8d12a15b..dff68367872b 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntity.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntity.java @@ -79,12 +79,12 @@ public boolean equals(Object o) { } BrowseEntity that = (BrowseEntity) o; - return canSample == that.canSample && - canBrowse == that.canBrowse && - Objects.equals(name, that.name) && - Objects.equals(path, that.path) && - Objects.equals(type, that.type) && - Objects.equals(properties, that.properties); + return canSample == that.canSample + && canBrowse == that.canBrowse + && Objects.equals(name, that.name) + && Objects.equals(path, that.path) + && Objects.equals(type, that.type) + && Objects.equals(properties, that.properties); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntityPropertyValue.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntityPropertyValue.java index d075a7e4caf1..0c6920e44a8b 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntityPropertyValue.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntityPropertyValue.java @@ -64,8 +64,8 @@ public boolean equals(Object o) { } BrowseEntityPropertyValue that = (BrowseEntityPropertyValue) o; - return Objects.equals(value, that.value) && - Objects.equals(type, that.type); + return Objects.equals(value, that.value) + && Objects.equals(type, that.type); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntityTypeInfo.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntityTypeInfo.java index 9d802ecdf647..262ac9001bff 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntityTypeInfo.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseEntityTypeInfo.java @@ -52,8 +52,8 @@ public boolean equals(Object o) { } BrowseEntityTypeInfo that = (BrowseEntityTypeInfo) o; - return Objects.equals(type, that.type) && - Objects.equals(properties, that.properties); + return Objects.equals(type, that.type) + && Objects.equals(properties, that.properties); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseRequest.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseRequest.java index 7730ad8fc29f..722e5580832e 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseRequest.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/BrowseRequest.java @@ -57,8 +57,8 @@ public boolean equals(Object o) { } BrowseRequest that = (BrowseRequest) o; - return Objects.equals(path, that.path) && - Objects.equals(limit, that.limit); + return Objects.equals(path, that.path) + && Objects.equals(limit, that.limit); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/ConnectorSpecRequest.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/ConnectorSpecRequest.java index 3759659e8968..6317625c4ca2 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/ConnectorSpecRequest.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/ConnectorSpecRequest.java @@ -70,9 +70,9 @@ public boolean equals(Object o) { } ConnectorSpecRequest that = (ConnectorSpecRequest) o; - return Objects.equals(path, that.path) && - Objects.equals(properties, that.properties) && - Objects.equals(connectionWithMacro, that.connectionWithMacro); + return Objects.equals(path, that.path) + && Objects.equals(properties, that.properties) + && Objects.equals(connectionWithMacro, that.connectionWithMacro); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/PluginSpec.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/PluginSpec.java index a1545ddb11cb..6c15fb172399 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/PluginSpec.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/PluginSpec.java @@ -58,9 +58,9 @@ public boolean equals(Object o) { } PluginSpec that = (PluginSpec) o; - return Objects.equals(name, that.name) && - Objects.equals(type, that.type) && - Objects.equals(properties, that.properties); + return Objects.equals(name, that.name) + && Objects.equals(type, that.type) + && Objects.equals(properties, that.properties); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SampleDetail.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SampleDetail.java index 04d942f34627..019973bcfca5 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SampleDetail.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SampleDetail.java @@ -60,8 +60,8 @@ public boolean equals(Object o) { } SampleDetail that = (SampleDetail) o; - return Objects.equals(sample, that.sample) && - Objects.equals(properties, that.properties); + return Objects.equals(sample, that.sample) + && Objects.equals(properties, that.properties); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SamplePropertyField.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SamplePropertyField.java index 5e21a3d59216..ad6150962d0b 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SamplePropertyField.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SamplePropertyField.java @@ -51,8 +51,8 @@ public boolean equals(Object o) { } SamplePropertyField that = (SamplePropertyField) o; - return Objects.equals(name, that.name) && - Objects.equals(description, that.description); + return Objects.equals(name, that.name) + && Objects.equals(description, that.description); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SampleRequest.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SampleRequest.java index 97fa7b08f4bd..d54b6140ef8f 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SampleRequest.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/connector/SampleRequest.java @@ -75,9 +75,9 @@ public boolean equals(Object o) { } SampleRequest that = (SampleRequest) o; - return limit == that.limit && - Objects.equals(path, that.path) && - Objects.equals(properties, that.properties) && + return limit == that.limit + && Objects.equals(path, that.path) + && Objects.equals(properties, that.properties) && Objects.equals(timeoutMs, that.timeoutMs); } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/engine/sql/SQLEngineInput.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/engine/sql/SQLEngineInput.java index 6bf4dbfa7476..55cc2fd2e96b 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/engine/sql/SQLEngineInput.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/engine/sql/SQLEngineInput.java @@ -69,9 +69,9 @@ public Map getArguments() { @Override public String toString() { - return "SQLEngineInput{" + - "name='" + getName() + '\'' + - ", sqlEngineClassName='" + sqlEngineClassName + '\'' + - "} "; + return "SQLEngineInput{" + + "name='" + getName() + '\'' + + ", sqlEngineClassName='" + sqlEngineClassName + '\'' + + "} "; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/engine/sql/SQLEngineOutput.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/engine/sql/SQLEngineOutput.java index dace167ba7e1..875869856b64 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/engine/sql/SQLEngineOutput.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/engine/sql/SQLEngineOutput.java @@ -67,9 +67,9 @@ public Map getArguments() { @Override public String toString() { - return "SQLEngineOutput{" + - "name='" + getName() + '\'' + - ", sqlEngineClassName='" + sqlEngineClassName + '\'' + - "} "; + return "SQLEngineOutput{" + + "name='" + getName() + '\'' + + ", sqlEngineClassName='" + sqlEngineClassName + '\'' + + "} "; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/InvalidJoinException.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/InvalidJoinException.java index 33ac8f95bef1..4134d061b21a 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/InvalidJoinException.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/InvalidJoinException.java @@ -47,8 +47,8 @@ public Collection getErrors() { private static String getMessage(Collection errors) { if (errors.isEmpty()) { - throw new IllegalStateException("An invalid join must contain at least one error, " + - "or it must provide an error message."); + throw new IllegalStateException("An invalid join must contain at least one error, " + + "or it must provide an error message."); } JoinError error = errors.iterator().next(); String message = error.getMessage(); diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinCondition.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinCondition.java index 756c748a342d..58525abfcc25 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinCondition.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinCondition.java @@ -112,8 +112,8 @@ public Collection validate(List joinStages) { if (stage.getSchema() == null) { errors.add( new ExpressionConditionError( - String.format("Input stage '%s' does not have a set schema. " + - "Advanced join conditions cannot be used with dynamic or unknown input schemas.", + String.format("Input stage '%s' does not have a set schema. " + + "Advanced join conditions cannot be used with dynamic or unknown input schemas.", stage.getStageName()))); } } @@ -192,8 +192,8 @@ public Collection validate(List joinStages) { // check that the stage for each key is in the list of stages if (joinStage == null) { errors.add(new JoinKeyError(joinKey, - String.format("Join key for stage '%s' is invalid. " + - "Stage '%s' is not an input.", joinStageName, joinStageName))); + String.format("Join key for stage '%s' is invalid. " + + "Stage '%s' is not an input.", joinStageName, joinStageName))); continue; } // this happens if the schema for that stage is unknown. @@ -211,14 +211,14 @@ public Collection validate(List joinStages) { keysCopy.removeAll(fields); if (keysCopy.size() == 1) { errors.add(new JoinKeyError(joinKey, - String.format("Join key for stage '%s' is invalid. " + - "Field '%s' does not exist in the stage.", + String.format("Join key for stage '%s' is invalid. " + + "Field '%s' does not exist in the stage.", joinStageName, keysCopy.iterator().next()))); } if (keysCopy.size() > 1) { errors.add(new JoinKeyError(joinKey, - String.format("Join key for stage '%s' is invalid. " + - "Fields %s do not exist in the stage.", + String.format("Join key for stage '%s' is invalid. " + + "Fields %s do not exist in the stage.", joinStageName, String.join(", ", keysCopy)))); } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinDefinition.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinDefinition.java index 3673132f8e44..edf688147e53 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinDefinition.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinDefinition.java @@ -279,8 +279,8 @@ private static void validateSchemaCompatibility(Schema expected, Schema provided if (expectedFieldSchema.getType() != providedFieldSchema.getType()) { errors.add(new OutputSchemaError( expectedField.getName(), expectedFieldSchema.getDisplayName(), - String.format("Provided schema does not match expected schema. " + - "Field '%s' is a '%s' but is expected to be a '%s'", + String.format("Provided schema does not match expected schema. " + + "Field '%s' is a '%s' but is expected to be a '%s'", expectedField.getName(), expectedFieldSchema.getDisplayName(), providedFieldSchema.getDisplayName()))); continue; diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinDistribution.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinDistribution.java index c9b54e4c3ef8..6a881fa494e1 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinDistribution.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinDistribution.java @@ -70,13 +70,13 @@ public Collection validate(List stages) { if (leftStage == null) { errors.add( new DistributionStageError( - String.format("Skewed stage '%s' does not match any of the specified " + - "stages", skewedStageName))); + String.format("Skewed stage '%s' does not match any of the specified " + + "stages", skewedStageName))); } else if (!leftStage.isRequired()) { errors.add( new DistributionStageError( - String.format("Distribution only supports inner or left outer joins, the skewed " + - "stage '%s' must be required", skewedStageName))); + String.format("Distribution only supports inner or left outer joins, the skewed " + + "stage '%s' must be required", skewedStageName))); } if (stages.stream().anyMatch(JoinStage::isBroadcast)) { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinField.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinField.java index 5824d31e613d..19fb38ccaa64 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinField.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinField.java @@ -62,9 +62,9 @@ public boolean equals(Object o) { return false; } JoinField field1 = (JoinField) o; - return Objects.equals(stageName, field1.stageName) && - Objects.equals(fieldName, field1.fieldName) && - Objects.equals(alias, field1.alias); + return Objects.equals(stageName, field1.stageName) + && Objects.equals(fieldName, field1.fieldName) + && Objects.equals(alias, field1.alias); } @Override @@ -74,10 +74,10 @@ public int hashCode() { @Override public String toString() { - return "JoinField{" + - "stage='" + stageName + '\'' + - ", field='" + fieldName + '\'' + - ", alias='" + alias + '\'' + - '}'; + return "JoinField{" + + "stage='" + stageName + '\'' + + ", field='" + fieldName + '\'' + + ", alias='" + alias + '\'' + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinKey.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinKey.java index 128bb864b250..aebc583288c7 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinKey.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/JoinKey.java @@ -53,8 +53,8 @@ public boolean equals(Object o) { return false; } JoinKey that = (JoinKey) o; - return Objects.equals(stageName, that.stageName) && - Objects.equals(fields, that.fields); + return Objects.equals(stageName, that.stageName) + && Objects.equals(fields, that.fields); } @Override @@ -64,9 +64,9 @@ public int hashCode() { @Override public String toString() { - return "JoinKey{" + - "stageName='" + stageName + '\'' + - ", fields=" + fields + - '}'; + return "JoinKey{" + + "stageName='" + stageName + '\'' + + ", fields=" + fields + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/JoinError.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/JoinError.java index d770f5828fd3..b168f01eb260 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/JoinError.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/JoinError.java @@ -63,9 +63,9 @@ public boolean equals(Object o) { return false; } JoinError joinError = (JoinError) o; - return type == joinError.type && - Objects.equals(message, joinError.message) && - Objects.equals(correctiveAction, joinError.correctiveAction); + return type == joinError.type + && Objects.equals(message, joinError.message) + && Objects.equals(correctiveAction, joinError.correctiveAction); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/JoinKeyFieldError.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/JoinKeyFieldError.java index 80404f2486bf..b007bab33095 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/JoinKeyFieldError.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/JoinKeyFieldError.java @@ -52,8 +52,8 @@ public boolean equals(Object o) { return false; } JoinKeyFieldError that = (JoinKeyFieldError) o; - return Objects.equals(stageName, that.stageName) && - Objects.equals(keyField, that.keyField); + return Objects.equals(stageName, that.stageName) + && Objects.equals(keyField, that.keyField); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/OutputSchemaError.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/OutputSchemaError.java index d9e2d5ccee75..0e4c0835b4eb 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/OutputSchemaError.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/join/error/OutputSchemaError.java @@ -59,8 +59,8 @@ public boolean equals(Object o) { return false; } OutputSchemaError that = (OutputSchemaError) o; - return Objects.equals(field, that.field) && - Objects.equals(expectedType, that.expectedType); + return Objects.equals(field, that.field) + && Objects.equals(expectedType, that.expectedType); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldOperation.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldOperation.java index bf5dd713fc03..7d075eb73406 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldOperation.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldOperation.java @@ -67,9 +67,9 @@ public boolean equals(Object o) { return false; } FieldOperation operation = (FieldOperation) o; - return Objects.equals(name, operation.name) && - type == operation.type && - Objects.equals(description, operation.description); + return Objects.equals(name, operation.name) + && type == operation.type + && Objects.equals(description, operation.description); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldReadOperation.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldReadOperation.java index 1d7df195522e..44a7aa69c24f 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldReadOperation.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldReadOperation.java @@ -89,8 +89,8 @@ public boolean equals(Object o) { return false; } FieldReadOperation that = (FieldReadOperation) o; - return Objects.equals(source, that.source) && - Objects.equals(outputFields, that.outputFields); + return Objects.equals(source, that.source) + && Objects.equals(outputFields, that.outputFields); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldTransformOperation.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldTransformOperation.java index 5162226805a2..747110daca68 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldTransformOperation.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldTransformOperation.java @@ -87,8 +87,8 @@ public boolean equals(Object o) { return false; } FieldTransformOperation that = (FieldTransformOperation) o; - return Objects.equals(inputFields, that.inputFields) && - Objects.equals(outputFields, that.outputFields); + return Objects.equals(inputFields, that.inputFields) + && Objects.equals(outputFields, that.outputFields); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldWriteOperation.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldWriteOperation.java index 4f8f8c270057..830aa1c88aab 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldWriteOperation.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/lineage/field/FieldWriteOperation.java @@ -87,8 +87,8 @@ public boolean equals(Object o) { return false; } FieldWriteOperation that = (FieldWriteOperation) o; - return Objects.equals(inputFields, that.inputFields) && - Objects.equals(sink, that.sink); + return Objects.equals(inputFields, that.inputFields) + && Objects.equals(sink, that.sink); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/validation/ValidationFailure.java b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/validation/ValidationFailure.java index c721c50bd955..f3119da0e4f0 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/validation/ValidationFailure.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-api/src/main/java/io/cdap/cdap/etl/api/validation/ValidationFailure.java @@ -277,8 +277,9 @@ public boolean equals(Object o) { return false; } ValidationFailure failure = (ValidationFailure) o; - return message.equals(failure.message) && - Objects.equals(correctiveAction, failure.correctiveAction) && causes.equals(failure.causes); + return message.equals(failure.message) + && Objects.equals(correctiveAction, failure.correctiveAction) && causes.equals( + failure.causes); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-archetypes/cdap-data-pipeline-plugins-archetype/src/main/resources/archetype-resources/src/main/java/ErrorCollector.java b/cdap-app-templates/cdap-etl/cdap-etl-archetypes/cdap-data-pipeline-plugins-archetype/src/main/resources/archetype-resources/src/main/java/ErrorCollector.java index 17d45e6cb627..efcd9b317f26 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-archetypes/cdap-data-pipeline-plugins-archetype/src/main/resources/archetype-resources/src/main/java/ErrorCollector.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-archetypes/cdap-data-pipeline-plugins-archetype/src/main/resources/archetype-resources/src/main/java/ErrorCollector.java @@ -110,18 +110,18 @@ private static Schema getOutputSchema(Config config, Schema inputSchema) { public static class Config extends PluginConfig { @Nullable - @Description("The name of the error message field to use in the output schema. " + - "If this not specified, the error message will be dropped.") + @Description("The name of the error message field to use in the output schema. " + + "If this not specified, the error message will be dropped.") private String messageField; @Nullable - @Description("The name of the error code field to use in the output schema. " + - "If this not specified, the error code will be dropped.") + @Description("The name of the error code field to use in the output schema. " + + "If this not specified, the error code will be dropped.") private String codeField; @Nullable - @Description("The name of the error stage field to use in the output schema. " + - "If this not specified, the error stage will be dropped.") + @Description("The name of the error stage field to use in the output schema. " + + "If this not specified, the error stage will be dropped.") private String stageField; } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-archetypes/cdap-data-pipeline-plugins-archetype/src/main/resources/archetype-resources/src/main/java/FilesetMoveAction.java b/cdap-app-templates/cdap-etl/cdap-etl-archetypes/cdap-data-pipeline-plugins-archetype/src/main/resources/archetype-resources/src/main/java/FilesetMoveAction.java index 76de221cecde..9a014931bc77 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-archetypes/cdap-data-pipeline-plugins-archetype/src/main/resources/archetype-resources/src/main/java/FilesetMoveAction.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-archetypes/cdap-data-pipeline-plugins-archetype/src/main/resources/archetype-resources/src/main/java/FilesetMoveAction.java @@ -63,8 +63,8 @@ public static class Conf extends PluginConfig { @Name(FILTER_REGEX) @Description( "Filter any files whose name matches this regex. Defaults to '^\\.', which will filter any files " - + - "that begin with a period.") + + + "that begin with a period.") private String filterRegex; // set defaults for properties in a no-argument constructor. diff --git a/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/condition/BasicConditionContext.java b/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/condition/BasicConditionContext.java index ee7ae10ad673..11db35562091 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/condition/BasicConditionContext.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/condition/BasicConditionContext.java @@ -81,9 +81,9 @@ private Map createStageStatistics(WorkflowContext conte } else { // should not happen LOG.warn(String.format( - "Ignoring key '%s' in the Workflow token while generating stage statistics " + - "because it is not in the form " + - "'stage.statistics...records'.", + "Ignoring key '%s' in the Workflow token while generating stage statistics " + + "because it is not in the form " + + "'stage.statistics...records'.", stageKey)); continue; } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/ETLMapReduce.java b/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/ETLMapReduce.java index f6f71da18528..ac559bab7a5d 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/ETLMapReduce.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/ETLMapReduce.java @@ -187,8 +187,8 @@ public void initialize() throws Exception { reducersStr.append(reducerIter.next().getName()); } throw new IllegalStateException( - "Found multiple reducers ( " + reducersStr + " ) in the same pipeline phase. " + - "This means there was a bug in planning the pipeline when it was deployed. "); + "Found multiple reducers ( " + reducersStr + " ) in the same pipeline phase. " + + "This means there was a bug in planning the pipeline when it was deployed. "); } job.setMapperClass(ETLMapper.class); diff --git a/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/MapReduceTransformExecutorFactory.java b/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/MapReduceTransformExecutorFactory.java index 2ece7d306045..52b21c27131d 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/MapReduceTransformExecutorFactory.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/MapReduceTransformExecutorFactory.java @@ -155,8 +155,8 @@ protected TrackedTransform getTransformation(StageSpec stageS String pluginType = stageSpec.getPluginType(); StageMetrics stageMetrics = new DefaultStageMetrics(metrics, stageName); TaskAttemptContext taskAttemptContext = (TaskAttemptContext) taskContext.getHadoopContext(); - StageStatisticsCollector collector = collectStageStatistics ? - new MapReduceStageStatisticsCollector(stageName, taskAttemptContext) + StageStatisticsCollector collector = collectStageStatistics + ? new MapReduceStageStatisticsCollector(stageName, taskAttemptContext) : new NoopStageStatisticsCollector(); if (BatchAggregator.PLUGIN_TYPE.equals(pluginType)) { Object plugin = pluginInstantiator.newPluginInstance(stageName, macroEvaluator); diff --git a/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/TransformRunner.java b/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/TransformRunner.java index 0853eb407340..c99b55e60416 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/TransformRunner.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-batch/src/main/java/io/cdap/cdap/etl/batch/mapreduce/TransformRunner.java @@ -127,8 +127,8 @@ private OutputWriter getSinkWriter(MapReduceTaskContext sinkOutputs = GSON.fromJson(sinkOutputsStr, ETLMapReduce.SINK_OUTPUTS_TYPE); - return hasSingleOutput(sinkOutputs) ? - new SingleOutputWriter<>(context) : new MultiOutputWriter<>(context, sinkOutputs); + return hasSingleOutput(sinkOutputs) + ? new SingleOutputWriter<>(context) : new MultiOutputWriter<>(context, sinkOutputs); } private boolean hasSingleOutput(Map sinkOutputs) { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/batch/ActionSpec.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/batch/ActionSpec.java index 4b8a2577780a..6be7394ded85 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/batch/ActionSpec.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/batch/ActionSpec.java @@ -51,8 +51,8 @@ public boolean equals(Object o) { ActionSpec that = (ActionSpec) o; - return Objects.equals(name, that.name) && - Objects.equals(plugin, that.plugin); + return Objects.equals(name, that.name) + && Objects.equals(plugin, that.plugin); } @Override @@ -62,9 +62,9 @@ public int hashCode() { @Override public String toString() { - return "ActionSpec{" + - "name='" + name + '\'' + - ", plugin=" + plugin + - '}'; + return "ActionSpec{" + + "name='" + name + '\'' + + ", plugin=" + plugin + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/batch/BatchPipelineSpec.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/batch/BatchPipelineSpec.java index 78860a854740..8d933297413d 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/batch/BatchPipelineSpec.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/batch/BatchPipelineSpec.java @@ -90,10 +90,10 @@ public int hashCode() { @Override public String toString() { - return "BatchPipelineSpec{" + - "endingActions=" + endingActions + - ", sqlEngineStageSpec=" + sqlEngineStageSpec + - "} " + super.toString(); + return "BatchPipelineSpec{" + + "endingActions=" + endingActions + + ", sqlEngineStageSpec=" + sqlEngineStageSpec + + "} " + super.toString(); } public static Builder builder() { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/AbstractServiceRetryableMacroEvaluator.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/AbstractServiceRetryableMacroEvaluator.java index f528b654bb33..de71f5bb4192 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/AbstractServiceRetryableMacroEvaluator.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/AbstractServiceRetryableMacroEvaluator.java @@ -86,13 +86,13 @@ public String evaluate(String macroFunction, String... args) throws InvalidMacro } } } catch (InterruptedException e) { - throw new RuntimeException("Thread interrupted while trying evaluate " + - "the value for '" + functionName + "' with" + - " args " + Arrays.asList(args), e); + throw new RuntimeException("Thread interrupted while trying evaluate " + + "the value for '" + functionName + "' with" + + " args " + Arrays.asList(args), e); } - throw new IllegalStateException("Timed out when trying to evaluate the " + - "value for '" + functionName + "' with " + - "args " + Arrays.asList(args)); + throw new IllegalStateException("Timed out when trying to evaluate the " + + "value for '" + functionName + "' with " + + "args " + Arrays.asList(args)); } @Override @@ -163,8 +163,8 @@ private void validateResponseCode(String serviceName, HttpURLConnection urlConn) serviceName + " service is not available with status " + responseCode); } throw new IOException( - "Failed to call " + serviceName + " service with status " + responseCode + ": " + - getError(urlConn)); + "Failed to call " + serviceName + " service with status " + responseCode + ": " + + getError(urlConn)); } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/AbstractStageContext.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/AbstractStageContext.java index 0e6789d9252d..29bf2e4669fd 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/AbstractStageContext.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/AbstractStageContext.java @@ -66,8 +66,8 @@ protected AbstractStageContext(PipelineRuntime pipelineRuntime, StageSpec stageS this.stageMetrics = new DefaultStageMetrics(pipelineRuntime.getMetrics(), stageSpec.getName()); Map inputSchemas = stageSpec.getInputSchemas(); // all plugins except joiners have just a single input schema - this.inputSchema = inputSchemas.isEmpty() ? - null : stageSpec.getInputSchemas().values().iterator().next(); + this.inputSchema = inputSchemas.isEmpty() + ? null : stageSpec.getInputSchemas().values().iterator().next(); Map portSchemas = new HashMap<>(); for (StageSpec.Port outputPort : stageSpec.getOutputPorts().values()) { if (outputPort.getPort() != null) { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ArtifactSelector.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ArtifactSelector.java index 74af52216f98..413abfab0113 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ArtifactSelector.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ArtifactSelector.java @@ -58,9 +58,9 @@ public Map.Entry select(SortedMap entry : pluginMap.descendingMap().entrySet()) { ArtifactId artifactId = entry.getKey(); - if ((scope == null || artifactId.getScope().equals(scope)) && - (name == null || artifactId.getName().equals(name)) && - (range == null || range.versionIsInRange(artifactId.getVersion()))) { + if ((scope == null || artifactId.getScope().equals(scope)) + && (name == null || artifactId.getName().equals(name)) + && (range == null || range.versionIsInRange(artifactId.getVersion()))) { return entry; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ArtifactSelectorProvider.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ArtifactSelectorProvider.java index 71df45dda29a..420579731bf1 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ArtifactSelectorProvider.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ArtifactSelectorProvider.java @@ -59,8 +59,8 @@ public PluginSelector getPluginSelector(@Nullable ArtifactSelectorConfig config) private ArtifactSelector getArtifactSelector(ArtifactSelectorConfig config) { String name = config.getName(); if (name != null && !nameMatcher.matchesAllOf(name)) { - throw new IllegalArgumentException(String.format("'%s' is an invalid artifact name. " + - "Must contain only alphanumeric, '-', '.', or '_' characters.", + throw new IllegalArgumentException(String.format("'%s' is an invalid artifact name. " + + "Must contain only alphanumeric, '-', '.', or '_' characters.", name)); } @@ -69,9 +69,9 @@ private ArtifactSelector getArtifactSelector(ArtifactSelectorConfig config) { try { range = version == null ? null : ArtifactVersionRange.parse(version); } catch (InvalidArtifactRangeException e) { - throw new IllegalArgumentException(String.format("%s is an invalid artifact version." + - "Must be an exact version or a version range " + - "with a lower and upper bound.", version)); + throw new IllegalArgumentException(String.format("%s is an invalid artifact version." + + "Must be an exact version or a version range " + + "with a lower and upper bound.", version)); } String scope = config.getScope(); diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ConnectionRegistryMacroEvaluator.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ConnectionRegistryMacroEvaluator.java index 4e5b17bcb241..bf4997b086a5 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ConnectionRegistryMacroEvaluator.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ConnectionRegistryMacroEvaluator.java @@ -54,8 +54,8 @@ public String evaluate(String macroFunction, String... args) throws InvalidMacro connectionNames.add(ConnectionId.getConnectionId(args[0])); throw new InvalidMacroException("The '" + FUNCTION_NAME - + "' macro function doesn't support evaluating the connection macro " + - "for connection '" + args[0] + "'"); + + "' macro function doesn't support evaluating the connection macro " + + "for connection '" + args[0] + "'"); } public Set getUsedConnections() { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/DefaultMacroEvaluator.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/DefaultMacroEvaluator.java index a8b8404f18f3..3d2d6225cfd9 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/DefaultMacroEvaluator.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/DefaultMacroEvaluator.java @@ -91,8 +91,8 @@ public Map evaluateMap(String macroFunction, String... arguments MacroEvaluator evaluator = getMacroEvaluator(macroFunction); if (!mapFunctions.contains(macroFunction)) { throw new InvalidMacroException( - String.format("The macro function %s cannot be evaluated as map. " + - "Please use evaluate() instead", macroFunction)); + String.format("The macro function %s cannot be evaluated as map. " + + "Please use evaluate() instead", macroFunction)); } return evaluator.evaluateMap(macroFunction, arguments); } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ExternalDatasets.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ExternalDatasets.java index c9d2222d6ff3..2dbf553204e0 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ExternalDatasets.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/ExternalDatasets.java @@ -205,8 +205,8 @@ private static void invokeMethod(String referenceName, Dataset ds, method.invoke(ds); } catch (NoSuchMethodException e) { // should never happen unless somebody changes ExternalDataset in cdap-data-fabric - LOG.warn("ExternalDataset '{}' does not have method '{}'. " + - "Can't register {} lineage for this dataset", referenceName, methodName, accessType); + LOG.warn("ExternalDataset '{}' does not have method '{}'. " + + "Can't register {} lineage for this dataset", referenceName, methodName, accessType); } catch (Exception e) { LOG.warn("Unable to register {} access for dataset {}", accessType, referenceName); } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/PipelinePhase.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/PipelinePhase.java index fcfacf71dd45..22e85ff111a1 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/PipelinePhase.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/PipelinePhase.java @@ -172,9 +172,9 @@ public boolean equals(Object o) { PipelinePhase that = (PipelinePhase) o; - return Objects.equals(stagesByType, that.stagesByType) && - Objects.equals(stagesByName, that.stagesByName) && - Objects.equals(dag, that.dag); + return Objects.equals(stagesByType, that.stagesByType) + && Objects.equals(stagesByName, that.stagesByName) + && Objects.equals(dag, that.dag); } @Override @@ -184,11 +184,11 @@ public int hashCode() { @Override public String toString() { - return "PipelinePhase{" + - "stagesByType=" + stagesByType + - ", stagesByName=" + stagesByName + - ", dag=" + dag + - '}'; + return "PipelinePhase{" + + "stagesByType=" + stagesByType + + ", stagesByName=" + stagesByName + + ", dag=" + dag + + '}'; } /** diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/macro/LogicalStartTimeMacroEvaluator.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/macro/LogicalStartTimeMacroEvaluator.java index 573320d4b503..2adf0bbcaec5 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/macro/LogicalStartTimeMacroEvaluator.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/macro/LogicalStartTimeMacroEvaluator.java @@ -83,8 +83,8 @@ public String evaluate(String macroFunction, String... arguments) throws Invalid if (arguments.length > 3) { throw new IllegalArgumentException( - "runtime macro supports at most 3 arguments - format, offset, and timezone. " + - "Formats containing a comma are not supported."); + "runtime macro supports at most 3 arguments - format, offset, and timezone. " + + "Formats containing a comma are not supported."); } dateFormat = new SimpleDateFormat(arguments[0]); diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/output/MultiRecordWriter.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/output/MultiRecordWriter.java index 67f512bfb298..9e86b77b6422 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/output/MultiRecordWriter.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/output/MultiRecordWriter.java @@ -47,10 +47,10 @@ public void write(String key, KeyValue kv) if (sinkDelegates == null) { // this means there was a bug, every sink output should be represented in the delegates map. throw new IOException(String.format( - "Unable to find a writer for output '%s'. This means there is a planner error. " + - "Please report this bug and turn off stage consolidation by setting '%s' to 'false' in the" - + - "runtime arguments for the pipeline.", key, Constants.CONSOLIDATE_STAGES)); + "Unable to find a writer for output '%s'. This means there is a planner error. " + + "Please report this bug and turn off stage consolidation by setting '%s' to 'false' in the" + + + "runtime arguments for the pipeline.", key, Constants.CONSOLIDATE_STAGES)); } for (RecordWriter delegate : sinkDelegates) { delegate.write(kv.getKey(), kv.getValue()); diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/plugin/JoinerBridge.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/plugin/JoinerBridge.java index 7b18d5d53160..7f629b5dd050 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/plugin/JoinerBridge.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/plugin/JoinerBridge.java @@ -59,11 +59,11 @@ public class JoinerBridge extends public JoinerBridge(String stageName, BatchAutoJoiner autoJoiner, JoinDefinition joinDefinition) { // if this is not an inner join and the output schema is not set, // we have no way of determining what the output schema should be and need to error out. - if (joinDefinition.getOutputSchema() == null && - joinDefinition.getStages().stream().anyMatch(s -> !s.isRequired())) { + if (joinDefinition.getOutputSchema() == null + && joinDefinition.getStages().stream().anyMatch(s -> !s.isRequired())) { throw new IllegalArgumentException( - String.format("An output schema could not be generated for joiner stage '%s'. " + - "Provide the expected output schema directly.", stageName)); + String.format("An output schema could not be generated for joiner stage '%s'. " + + "Provide the expected output schema directly.", stageName)); } this.autoJoiner = autoJoiner; this.joinDefinition = joinDefinition; @@ -120,8 +120,8 @@ public StructuredRecord joinOn(String stageName, INPUT_RECORD input) { throw new IllegalArgumentException( String.format( "Received data from stage '%s', but the stage was not included as part of the join. " - + - "Check the plugin to make sure it is including all input stages.", stageName)); + + + "Check the plugin to make sure it is including all input stages.", stageName)); } StructuredRecord inputRecord = (StructuredRecord) input; @@ -150,8 +150,8 @@ public Collection getJoinKeys(String stageName, INPUT_RECORD r throw new IllegalArgumentException( String.format( "Received data from stage '%s', but the stage was not included as part of the join. " - + - "Check the plugin to make sure it is including all input stages.", stageName)); + + + "Check the plugin to make sure it is including all input stages.", stageName)); } StructuredRecord inputRecord = (StructuredRecord) record; diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/submit/PipelinePhasePreparer.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/submit/PipelinePhasePreparer.java index 397a7ad2451f..a68cd003c18b 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/submit/PipelinePhasePreparer.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/common/submit/PipelinePhasePreparer.java @@ -110,8 +110,8 @@ public List prepare(PhaseSpec phaseSpec) pluginInstantiator.newPluginInstance(stageName, macroEvaluator); submitterPlugin = createSource(batchSource, stageSpec); } else if (BatchSink.PLUGIN_TYPE.equals(pluginType) || AlertPublisher.PLUGIN_TYPE.equals( - pluginType) || - isConnectorSink) { + pluginType) + || isConnectorSink) { BatchConfigurable batchSink = pluginInstantiator.newPluginInstance( stageName, macroEvaluator); submitterPlugin = createSink(batchSink, stageSpec); @@ -188,8 +188,8 @@ private void validateAutoJoiner(AutoJoiner autoJoiner, StageSpec stageSpec) { failureCollector.getOrThrowException(); if (joinDefinition == null) { throw new IllegalArgumentException(String.format( - "Joiner stage '%s' using plugin '%s' did not provide a join definition. " + - "Check with the plugin developer to make sure it is implemented correctly.", + "Joiner stage '%s' using plugin '%s' did not provide a join definition. " + + "Check with the plugin developer to make sure it is implemented correctly.", stageName, pluginName)); } @@ -202,8 +202,8 @@ private void validateAutoJoiner(AutoJoiner autoJoiner, StageSpec stageSpec) { if (!missingInputs.isEmpty()) { throw new IllegalArgumentException( String.format( - "Joiner stage '%s' using plugin '%s' did not include input stage %s in the join. " + - "Check with the plugin developer to make sure it is implemented correctly.", + "Joiner stage '%s' using plugin '%s' did not include input stage %s in the join. " + + "Check with the plugin developer to make sure it is implemented correctly.", stageName, pluginName, String.join(", ", missingInputs))); } Set extraInputs = Sets.difference(joinStages, inputStages); @@ -211,8 +211,8 @@ private void validateAutoJoiner(AutoJoiner autoJoiner, StageSpec stageSpec) { throw new IllegalArgumentException( String.format( "Joiner stage '%s' using plugin '%s' is trying to join stage %s, which is not an input. " - + - "Check with the plugin developer to make sure it is implemented correctly.", + + + "Check with the plugin developer to make sure it is implemented correctly.", stageName, pluginName, String.join(", ", missingInputs))); } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/exec/PipeStage.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/exec/PipeStage.java index a29a4a8e49ce..6fe751e53798 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/exec/PipeStage.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/exec/PipeStage.java @@ -52,8 +52,8 @@ public void consume(T input) { throw new StageFailureException( String.format( "Failed to execute pipeline stage '%s' with the error: %s. Please review your pipeline " - + - "configuration and check the system logs for more details.", stageName, + + + "configuration and check the system logs for more details.", stageName, rootCause.getMessage()), rootCause); } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/exec/TransformExecutorFactory.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/exec/TransformExecutorFactory.java index b2eb193ac68e..aec70bfa45e3 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/exec/TransformExecutorFactory.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/exec/TransformExecutorFactory.java @@ -88,8 +88,8 @@ private TrackedMultiOutputTransform getMultiOutputTransfo splitterTransform.initialize(transformContext); StageMetrics stageMetrics = new DefaultStageMetrics(metrics, stageName); - StageStatisticsCollector collector = collectStageStatistics ? - getStatisticsCollector(stageName) : NoopStageStatisticsCollector.INSTANCE; + StageStatisticsCollector collector = collectStageStatistics + ? getStatisticsCollector(stageName) : NoopStageStatisticsCollector.INSTANCE; return new TrackedMultiOutputTransform<>(splitterTransform, stageMetrics, getDataTracer(stageName), collector); } @@ -101,8 +101,8 @@ protected TrackedTransform getTransformation(StageSpec stageS String stageName = stageSpec.getName(); String pluginType = stageSpec.getPluginType(); StageMetrics stageMetrics = new DefaultStageMetrics(metrics, stageName); - StageStatisticsCollector collector = collectStageStatistics ? - getStatisticsCollector(stageName) : NoopStageStatisticsCollector.INSTANCE; + StageStatisticsCollector collector = collectStageStatistics + ? getStatisticsCollector(stageName) : NoopStageStatisticsCollector.INSTANCE; Transformation transformation = getInitializedTransformation(stageSpec); // we emit metrics for records into alert publishers when the actual alerts are published, @@ -128,8 +128,8 @@ public PipeTransformExecutor create(PipelinePhase pipeline) throws Exception // input. this will allow us to setup all outputs for a stage when we get to it. Dag pipelineDag = pipeline.getDag(); // dag is null if the pipeline phase contains a single stage. - List traversalOrder = pipelineDag == null ? - Collections.singletonList(pipeline.iterator().next().getName()) + List traversalOrder = pipelineDag == null + ? Collections.singletonList(pipeline.iterator().next().getName()) : pipelineDag.getTopologicalOrder(); Collections.reverse(traversalOrder); @@ -175,8 +175,8 @@ private PipeStage getPipeStage(PipelinePhase pipeline, String stageName, // ConnectorSources require a special emitter since they need to build RecordInfo from the temporary dataset PipeEmitter.Builder emitterBuilder = Constants.Connector.PLUGIN_TYPE.equals(pluginType) && pipeline.getSources() - .contains(stageName) ? - ConnectorSourceEmitter.builder(stageName) : PipeEmitter.builder(stageName); + .contains(stageName) + ? ConnectorSourceEmitter.builder(stageName) : PipeEmitter.builder(stageName); Map outputPorts = stageSpec.getOutputPorts(); for (String outputStageName : pipeline.getStageOutputs(stageName)) { @@ -194,8 +194,8 @@ private PipeStage getPipeStage(PipelinePhase pipeline, String stageName, } else { // if the output is a connector like agg5.connector, the outputPorts will contain the original 'agg5' as // a key, but not 'agg5.connector' so we need to lookup the original stage from the connector's plugin spec - String originalOutputName = Constants.Connector.PLUGIN_TYPE.equals(outputStageType) ? - outputStageSpec.getPlugin().getProperties().get(Constants.Connector.ORIGINAL_NAME) + String originalOutputName = Constants.Connector.PLUGIN_TYPE.equals(outputStageType) + ? outputStageSpec.getPlugin().getProperties().get(Constants.Connector.ORIGINAL_NAME) : outputStageName; String port = diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/lineage/InvalidFieldOperations.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/lineage/InvalidFieldOperations.java index da88d6c84e28..cb225c22622a 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/lineage/InvalidFieldOperations.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/lineage/InvalidFieldOperations.java @@ -62,8 +62,8 @@ public boolean equals(Object o) { return false; } InvalidFieldOperations that = (InvalidFieldOperations) o; - return Objects.equals(invalidInputs, that.invalidInputs) && - Objects.equals(invalidOutputs, that.invalidOutputs); + return Objects.equals(invalidInputs, that.invalidInputs) + && Objects.equals(invalidOutputs, that.invalidOutputs); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/lineage/InvalidLineageException.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/lineage/InvalidLineageException.java index a477915b4868..9f4a719dbc9f 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/lineage/InvalidLineageException.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/lineage/InvalidLineageException.java @@ -93,8 +93,8 @@ private static String invalidOutputErrorMessage( } return String.format( - "Outputs of following operations are neither used by subsequent operations " + - "in that stage nor are part of the output schema of that stage: %s. ", + "Outputs of following operations are neither used by subsequent operations " + + "in that stage nor are part of the output schema of that stage: %s. ", invalidErrorMessage(invalidOutputs)); } @@ -105,8 +105,8 @@ private static String invalidInputErrorMessage( } return String.format( - "Inputs of following operations are neither part of the input schema of a stage nor are " + - "generated by any previous operations recorded by that stage: %s. ", + "Inputs of following operations are neither part of the input schema of a stage nor are " + + "generated by any previous operations recorded by that stage: %s. ", invalidErrorMessage(invalidInputs)); } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/CombinerDag.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/CombinerDag.java index c5c97493f86c..9a02c69b3a97 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/CombinerDag.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/CombinerDag.java @@ -304,8 +304,8 @@ private void mergeToExistingGroups(Set newGroup) { int numSinks = 0; for (String groupNode : mergedGroup) { if (uncombinableNodes.contains(groupNode)) { - LOG.debug("Planner tried to create an invalid group containing uncombinable node {}. " + - "This group will be ignored.", + LOG.debug("Planner tried to create an invalid group containing uncombinable node {}. " + + "This group will be ignored.", groupNode); return; } @@ -317,24 +317,24 @@ private void mergeToExistingGroups(Set newGroup) { Set interGroupInputs = Sets.intersection(inputs, mergedGroup); Set intraGroupInputs = Sets.difference(inputs, mergedGroup); if (!interGroupInputs.isEmpty() && !intraGroupInputs.isEmpty()) { - LOG.debug("Planner tried to create an invalid group with nodes {}. " + - "Node {} has inputs from both within the group and from outside the group. " + - "This group will be ignored.", mergedGroup, groupNode); + LOG.debug("Planner tried to create an invalid group with nodes {}. " + + "Node {} has inputs from both within the group and from outside the group. " + + "This group will be ignored.", mergedGroup, groupNode); return; } Set outputs = getNodeOutputs(groupNode); if (!Sets.difference(outputs, mergedGroup).isEmpty()) { - LOG.debug("Planner tried to create an invalid group with nodes {}. " + - "Node {} is connected to a node outside the group. This group will be ignored.", + LOG.debug("Planner tried to create an invalid group with nodes {}. " + + "Node {} is connected to a node outside the group. This group will be ignored.", mergedGroup, groupNode); return; } } if (numSinks < 2) { - LOG.debug("Planner tried to create a group using nodes {}, but it only contains {} sinks. " + - "This group will be ignored.", mergedGroup, numSinks); + LOG.debug("Planner tried to create a group using nodes {}, but it only contains {} sinks. " + + "This group will be ignored.", mergedGroup, numSinks); return; } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/ConditionBranches.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/ConditionBranches.java index 658f924db807..65569810e0d8 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/ConditionBranches.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/ConditionBranches.java @@ -52,8 +52,8 @@ public boolean equals(Object o) { ConditionBranches that = (ConditionBranches) o; - return Objects.equals(trueOutput, that.trueOutput) && - Objects.equals(falseOutput, that.falseOutput); + return Objects.equals(trueOutput, that.trueOutput) + && Objects.equals(falseOutput, that.falseOutput); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/ConnectorDag.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/ConnectorDag.java index c4921fccc532..8540e245bd3c 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/ConnectorDag.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/ConnectorDag.java @@ -540,10 +540,10 @@ private void insertInFront(String name, String inFrontOf) { @Override public String toString() { - return "ConnectorDag{" + - "reduceNodes=" + reduceNodes + - ", connectors=" + connectors + - "} " + super.toString(); + return "ConnectorDag{" + + "reduceNodes=" + reduceNodes + + ", connectors=" + connectors + + "} " + super.toString(); } @Override @@ -560,8 +560,8 @@ public boolean equals(Object o) { ConnectorDag that = (ConnectorDag) o; - return Objects.equals(reduceNodes, that.reduceNodes) && - Objects.equals(connectors, that.connectors); + return Objects.equals(reduceNodes, that.reduceNodes) + && Objects.equals(connectors, that.connectors); } @Override @@ -640,8 +640,8 @@ public Builder addMultiPortNodes(Collection nodes) { public Builder addConnectors(String... nodes) { if (nodes.length % 2 != 0) { throw new IllegalArgumentException( - "must specify an even number of nodes, alternating between the " + - "connector name and the original node it was placed in front of."); + "must specify an even number of nodes, alternating between the " + + "connector name and the original node it was placed in front of."); } for (int i = 0; i < nodes.length; i += 2) { connectors.put(nodes[i], nodes[i + 1]); diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/Dag.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/Dag.java index 0b3b42d2b95b..23f009311a5a 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/Dag.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/Dag.java @@ -652,11 +652,11 @@ public boolean equals(Object o) { Dag that = (Dag) o; - return Objects.equals(nodes, that.nodes) && - Objects.equals(sources, that.sources) && - Objects.equals(sinks, that.sinks) && - Objects.equals(outgoingConnections, that.outgoingConnections) && - Objects.equals(incomingConnections, that.incomingConnections); + return Objects.equals(nodes, that.nodes) + && Objects.equals(sources, that.sources) + && Objects.equals(sinks, that.sinks) + && Objects.equals(outgoingConnections, that.outgoingConnections) + && Objects.equals(incomingConnections, that.incomingConnections); } @Override @@ -666,12 +666,12 @@ public int hashCode() { @Override public String toString() { - return "Dag{" + - "nodes=" + nodes + - ", sources=" + sources + - ", sinks=" + sinks + - ", outgoingConnections=" + outgoingConnections + - ", incomingConnections=" + incomingConnections + - '}'; + return "Dag{" + + "nodes=" + nodes + + ", sources=" + sources + + ", sinks=" + sinks + + ", outgoingConnections=" + outgoingConnections + + ", incomingConnections=" + incomingConnections + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/PipelinePlan.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/PipelinePlan.java index 9a550980f2ed..93958399d1fd 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/PipelinePlan.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/PipelinePlan.java @@ -92,8 +92,8 @@ public boolean equals(Object o) { PipelinePlan that = (PipelinePlan) o; - return Objects.equals(phases, that.phases) && - Objects.equals(phaseConnections, that.phaseConnections); + return Objects.equals(phases, that.phases) + && Objects.equals(phaseConnections, that.phaseConnections); } @Override @@ -103,9 +103,9 @@ public int hashCode() { @Override public String toString() { - return "PipelinePlan{" + - "phases=" + phases + - ", phaseConnections=" + phaseConnections + - '}'; + return "PipelinePlan{" + + "phases=" + phases + + ", phaseConnections=" + phaseConnections + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/PipelinePlanner.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/PipelinePlanner.java index 2ed60153fe60..d4188a8f2a0b 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/PipelinePlanner.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/planner/PipelinePlanner.java @@ -369,8 +369,8 @@ private PipelinePhase dagToPipeline(Dag dag, Map connectors, // add connectors String originalName = connectors.get(stageName); if (originalName != null || conditionConnectors.values().contains(stageName)) { - String connectorType = dag.getSources().contains(stageName) ? - Constants.Connector.SOURCE_TYPE : Constants.Connector.SINK_TYPE; + String connectorType = dag.getSources().contains(stageName) + ? Constants.Connector.SOURCE_TYPE : Constants.Connector.SINK_TYPE; PluginSpec connectorSpec = new PluginSpec(Constants.Connector.PLUGIN_TYPE, "connector", ImmutableMap.of(Constants.Connector.ORIGINAL_NAME, originalName != null @@ -396,9 +396,9 @@ static String getPhaseName(Dag dag) { @VisibleForTesting static String getPhaseName(Set sources, Set sinks, String tail) { // using sorted sets to guarantee the name is deterministic - return Joiner.on('.').join(new TreeSet<>(sources)) + - ".to." + - Joiner.on('.').join(new TreeSet<>(sinks)) + "." + tail; + return Joiner.on('.').join(new TreeSet<>(sources)) + + ".to." + + Joiner.on('.').join(new TreeSet<>(sinks)) + "." + tail; } @VisibleForTesting diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/spec/PipelineSpecGenerator.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/spec/PipelineSpecGenerator.java index 744a2957408e..cdce6da927af 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/spec/PipelineSpecGenerator.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/spec/PipelineSpecGenerator.java @@ -621,8 +621,8 @@ protected ValidatedPipeline validateConfig(ETLConfig config) { if (conditionStages.contains(connection.getFrom())) { if (connection.getCondition() == null) { String msg = String.format( - "For condition stage %s, the connection %s is not marked with either " + - "'true' or 'false'.", connection.getFrom(), connection); + "For condition stage %s, the connection %s is not marked with either " + + "'true' or 'false'.", connection.getFrom(), connection); throw new IllegalArgumentException(msg); } @@ -647,8 +647,8 @@ protected ValidatedPipeline validateConfig(ETLConfig config) { return new ValidatedPipeline(traversalOrder, config); } else { throw new IllegalArgumentException( - "Invalid pipeline. There are no connections between stages. " + - "This is only allowed if the pipeline consists of a single action plugin."); + "Invalid pipeline. There are no connections between stages. " + + "This is only allowed if the pipeline consists of a single action plugin."); } } @@ -784,9 +784,9 @@ private void validateConditionBranches(Set conditionStages, Dag dag) { Set outputs = dag.getNodeOutputs(conditionStage); if (outputs == null || outputs.size() > 2) { String msg = String.format( - "Condition stage in the pipeline '%s' should have at least 1 and at max 2 " + - "outgoing connections corresponding to 'true' and 'false' branches " + - "but found '%s'.", conditionStage, outputs == null ? 0 : outputs.size()); + "Condition stage in the pipeline '%s' should have at least 1 and at max 2 " + + "outgoing connections corresponding to 'true' and 'false' branches " + + "but found '%s'.", conditionStage, outputs == null ? 0 : outputs.size()); throw new IllegalArgumentException(msg); } for (String output : outputs) { @@ -817,9 +817,9 @@ private void validateSingleInput(String currentCondition, String currentStage, D paths += parent + "->" + currentStage; } String msg = String.format( - "Stage in the pipeline '%s' is on the branch of condition '%s'. However it also " + - "has following incoming paths: '%s'. Different branches of a condition cannot " + - "be inputs to the same stage.", currentStage, currentCondition, paths); + "Stage in the pipeline '%s' is on the branch of condition '%s'. However it also " + + "has following incoming paths: '%s'. Different branches of a condition cannot " + + "be inputs to the same stage.", currentStage, currentCondition, paths); throw new IllegalArgumentException(msg); } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/spec/ValidatedPipeline.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/spec/ValidatedPipeline.java index d7ed4498ef69..b6a088c21c63 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/spec/ValidatedPipeline.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/main/java/io/cdap/cdap/etl/spec/ValidatedPipeline.java @@ -59,13 +59,13 @@ public List getTraversalOrder() { } public Set getOutputs(String stageName) { - return connectionTable.containsKey(stageName) ? - connectionTable.get(stageName).keySet() : Collections.emptySet(); + return connectionTable.containsKey(stageName) + ? connectionTable.get(stageName).keySet() : Collections.emptySet(); } public Map getOutputPorts(String stageName) { - return connectionTable.containsKey(stageName) ? - connectionTable.get(stageName) : Collections.emptyMap(); + return connectionTable.containsKey(stageName) + ? connectionTable.get(stageName) : Collections.emptyMap(); } public boolean isStageLoggingEnabled() { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-core/src/test/java/io/cdap/cdap/etl/common/MockOauthHandler.java b/cdap-app-templates/cdap-etl/cdap-etl-core/src/test/java/io/cdap/cdap/etl/common/MockOauthHandler.java index 18ac27fa1c70..911593091e00 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-core/src/test/java/io/cdap/cdap/etl/common/MockOauthHandler.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-core/src/test/java/io/cdap/cdap/etl/common/MockOauthHandler.java @@ -32,24 +32,25 @@ */ public class MockOauthHandler extends AbstractHttpHandler { - private static final Gson GSON = new Gson(); - private final Map> credentials; + private static final Gson GSON = new Gson(); + private final Map> credentials; - public MockOauthHandler(Map> credentials) { - this.credentials = credentials; - } + public MockOauthHandler(Map> credentials) { + this.credentials = credentials; + } - @Path("/v3/namespaces/system/apps/" + Constants.PIPELINEID + "/services/" + - Constants.STUDIO_SERVICE_NAME + "/methods/v1/oauth/provider/{provider}/credential/{credentialId}") - @GET - public void getOAuth(HttpRequest request, HttpResponder responder, - @PathParam("provider") String provider, - @PathParam("credentialId") String credentialId) { - Map providerCredentials = credentials.get(provider); - if (providerCredentials == null) { - responder.sendStatus(HttpResponseStatus.NOT_FOUND); - return; - } + @Path("/v3/namespaces/system/apps/" + Constants.PIPELINEID + "/services/" + + Constants.STUDIO_SERVICE_NAME + + "/methods/v1/oauth/provider/{provider}/credential/{credentialId}") + @GET + public void getOAuth(HttpRequest request, HttpResponder responder, + @PathParam("provider") String provider, + @PathParam("credentialId") String credentialId) { + Map providerCredentials = credentials.get(provider); + if (providerCredentials == null) { + responder.sendStatus(HttpResponseStatus.NOT_FOUND); + return; + } OAuthInfo oAuthInfo = providerCredentials.get(credentialId); if (oAuthInfo == null) { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/ArtifactSelectorConfig.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/ArtifactSelectorConfig.java index bf97bf0c8597..2f144be1a0c8 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/ArtifactSelectorConfig.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/ArtifactSelectorConfig.java @@ -70,9 +70,9 @@ public boolean equals(Object o) { ArtifactSelectorConfig that = (ArtifactSelectorConfig) o; - return Objects.equals(scope, that.scope) && - Objects.equals(name, that.name) && - Objects.equals(version, that.version); + return Objects.equals(scope, that.scope) + && Objects.equals(name, that.name) + && Objects.equals(version, that.version); } @Override @@ -82,10 +82,10 @@ public int hashCode() { @Override public String toString() { - return "ArtifactSelectorConfig{" + - "scope='" + scope + '\'' + - ", name='" + name + '\'' + - ", version='" + version + '\'' + - '}'; + return "ArtifactSelectorConfig{" + + "scope='" + scope + '\'' + + ", name='" + name + '\'' + + ", version='" + version + '\'' + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/Connection.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/Connection.java index fc61202c9e96..447dc90463b9 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/Connection.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/Connection.java @@ -90,11 +90,11 @@ public int hashCode() { @Override public String toString() { - return "Connection{" + - "from='" + from + '\'' + - ", to='" + to + '\'' + - ", port='" + port + '\'' + - ", condition='" + condition + '\'' + - '}'; + return "Connection{" + + "from='" + from + '\'' + + ", to='" + to + '\'' + + ", port='" + port + '\'' + + ", condition='" + condition + '\'' + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/Connection.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/Connection.java index 913fbf19979e..d6716e2be5f4 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/Connection.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/Connection.java @@ -102,13 +102,13 @@ public boolean equals(Object o) { } Connection that = (Connection) o; - return preConfigured == that.preConfigured && - isDefault == that.isDefault && - Objects.equals(name, that.name) && - Objects.equals(connectionId, that.connectionId) && - Objects.equals(connectionType, that.connectionType) && - Objects.equals(description, that.description) && - Objects.equals(plugin, that.plugin); + return preConfigured == that.preConfigured + && isDefault == that.isDefault + && Objects.equals(name, that.name) + && Objects.equals(connectionId, that.connectionId) + && Objects.equals(connectionType, that.connectionType) + && Objects.equals(description, that.description) + && Objects.equals(plugin, that.plugin); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/ConnectionCreationRequest.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/ConnectionCreationRequest.java index 5d78b04f3513..c91aaef61b37 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/ConnectionCreationRequest.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/ConnectionCreationRequest.java @@ -63,9 +63,9 @@ public boolean equals(Object o) { } ConnectionCreationRequest that = (ConnectionCreationRequest) o; - return overWrite == that.overWrite && - Objects.equals(description, that.description) && - Objects.equals(plugin, that.plugin); + return overWrite == that.overWrite + && Objects.equals(description, that.description) + && Objects.equals(plugin, that.plugin); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/ConnectionId.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/ConnectionId.java index 56028eba6bfc..ee912664cc33 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/ConnectionId.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/ConnectionId.java @@ -63,8 +63,8 @@ public String getConnectionId() { public static String getConnectionId(String name) { if (MACRO_CHARS.matcher(name).find()) { throw new ConnectionBadRequestException( - String.format("The connection name %s should not contain characters " + - "'$', '{', '}', '(', ')'.", name)); + String.format("The connection name %s should not contain characters " + + "'$', '{', '}', '(', ')'.", name)); } name = name.trim(); @@ -93,9 +93,9 @@ public boolean equals(Object o) { } ConnectionId that = (ConnectionId) o; - return Objects.equals(namespace, that.namespace) && - Objects.equals(connection, that.connection) && - Objects.equals(connectionId, that.connectionId); + return Objects.equals(namespace, that.namespace) + && Objects.equals(connection, that.connection) + && Objects.equals(connectionId, that.connectionId); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/PluginMeta.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/PluginMeta.java index ca8ebc88c591..c6fb8b7e18e4 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/PluginMeta.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/PluginMeta.java @@ -66,10 +66,10 @@ public boolean equals(Object o) { } PluginMeta that = (PluginMeta) o; - return Objects.equals(name, that.name) && - Objects.equals(type, that.type) && - Objects.equals(properties, that.properties) && - Objects.equals(artifact, that.artifact); + return Objects.equals(name, that.name) + && Objects.equals(type, that.type) + && Objects.equals(properties, that.properties) + && Objects.equals(artifact, that.artifact); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/PreconfiguredConnectionCreationRequest.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/PreconfiguredConnectionCreationRequest.java index 170b04fc6159..ec6457bf93da 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/PreconfiguredConnectionCreationRequest.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/PreconfiguredConnectionCreationRequest.java @@ -55,8 +55,8 @@ public boolean equals(Object o) { } PreconfiguredConnectionCreationRequest that = (PreconfiguredConnectionCreationRequest) o; - return Objects.equals(namespace, that.namespace) && - Objects.equals(name, that.name); + return Objects.equals(namespace, that.namespace) + && Objects.equals(name, that.name); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/SampleResponse.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/SampleResponse.java index 013abd808d69..5a26c8e3ba63 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/SampleResponse.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/SampleResponse.java @@ -65,9 +65,9 @@ public boolean equals(Object o) { } SampleResponse that = (SampleResponse) o; - return Objects.equals(detail, that.detail) && - Objects.equals(schema, that.schema) && - Objects.equals(sample, that.sample); + return Objects.equals(detail, that.detail) + && Objects.equals(schema, that.schema) + && Objects.equals(sample, that.sample); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/SpecGenerationRequest.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/SpecGenerationRequest.java index b6c301122339..f05f180d78e0 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/SpecGenerationRequest.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/connection/SpecGenerationRequest.java @@ -72,10 +72,10 @@ public boolean equals(Object o) { } SpecGenerationRequest that = (SpecGenerationRequest) o; - return Objects.equals(path, that.path) && - Objects.equals(properties, that.properties) && - Objects.equals(pluginName, that.pluginName) && - Objects.equals(pluginType, that.pluginType); + return Objects.equals(path, that.path) + && Objects.equals(properties, that.properties) + && Objects.equals(pluginName, that.pluginName) + && Objects.equals(pluginType, that.pluginType); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLBatchConfig.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLBatchConfig.java index debe0adaeb6f..9e8a12d3c378 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLBatchConfig.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLBatchConfig.java @@ -103,8 +103,8 @@ public boolean equals(Object o) { ETLBatchConfig that = (ETLBatchConfig) o; - return Objects.equals(schedule, that.schedule) && - Objects.equals(actions, that.actions); + return Objects.equals(schedule, that.schedule) + && Objects.equals(actions, that.actions); } @Override @@ -114,12 +114,12 @@ public int hashCode() { @Override public String toString() { - return "ETLBatchConfig{" + - "engine=" + engine + - ", schedule='" + schedule + '\'' + - ", actions=" + actions + - ", driverResources=" + driverResources + - "} " + super.toString(); + return "ETLBatchConfig{" + + "engine=" + engine + + ", schedule='" + schedule + '\'' + + ", actions=" + actions + + ", driverResources=" + driverResources + + "} " + super.toString(); } public static Builder builder(String schedule) { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLConfig.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLConfig.java index 3187e486b997..342c0e1475ce 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLConfig.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLConfig.java @@ -152,14 +152,14 @@ protected T upgradeBase( @Override public String toString() { - return "ETLConfig{" + - "stageLoggingEnabled=" + stageLoggingEnabled + - ", source=" + source + - ", sinks=" + sinks + - ", transforms=" + transforms + - ", connections=" + connections + - ", resources=" + resources + - "} " + super.toString(); + return "ETLConfig{" + + "stageLoggingEnabled=" + stageLoggingEnabled + + ", source=" + source + + ", sinks=" + sinks + + ", transforms=" + transforms + + ", connections=" + connections + + ", resources=" + resources + + "} " + super.toString(); } @Override @@ -173,12 +173,12 @@ public boolean equals(Object o) { ETLConfig that = (ETLConfig) o; - return Objects.equals(source, that.source) && - Objects.equals(sinks, that.sinks) && - Objects.equals(transforms, that.transforms) && - Objects.equals(connections, that.connections) && - Objects.equals(resources, that.resources) && - isStageLoggingEnabled() == that.isStageLoggingEnabled(); + return Objects.equals(source, that.source) + && Objects.equals(sinks, that.sinks) + && Objects.equals(transforms, that.transforms) + && Objects.equals(connections, that.connections) + && Objects.equals(resources, that.resources) + && isStageLoggingEnabled() == that.isStageLoggingEnabled(); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLStage.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLStage.java index 1b36441ac2d8..1bb707a90593 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLStage.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/ETLStage.java @@ -62,11 +62,11 @@ public Plugin getPlugin() { @Override public String toString() { - return "ETLStage{" + - "name='" + name + '\'' + - ", plugin=" + plugin + - ", errorDatasetName='" + errorDatasetName + '\'' + - '}'; + return "ETLStage{" + + "name='" + name + '\'' + + ", plugin=" + plugin + + ", errorDatasetName='" + errorDatasetName + '\'' + + '}'; } @Override @@ -80,9 +80,9 @@ public boolean equals(Object o) { ETLStage that = (ETLStage) o; - return Objects.equals(name, that.name) && - Objects.equals(plugin, that.plugin) && - Objects.equals(errorDatasetName, that.errorDatasetName); + return Objects.equals(name, that.name) + && Objects.equals(plugin, that.plugin) + && Objects.equals(errorDatasetName, that.errorDatasetName); } @Override @@ -103,10 +103,10 @@ public io.cdap.cdap.etl.proto.v2.ETLStage upgradeStage(String type, if (errorDatasetName != null) { throw new IllegalStateException( String.format( - "Cannot upgrade stage '%s'. Error datasets have been replaced by error collectors. " + - "Please connect stage '%s' to an error collector, then connect the error collector " - + - "to a sink.", name, name)); + "Cannot upgrade stage '%s'. Error datasets have been replaced by error collectors. " + + "Please connect stage '%s' to an error collector, then connect the error collector " + + + "to a sink.", name, name)); } return new io.cdap.cdap.etl.proto.v2.ETLStage(name, etlPlugin); } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/Plugin.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/Plugin.java index 137a5830cab2..e29ce6965406 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/Plugin.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v1/Plugin.java @@ -58,11 +58,11 @@ public ArtifactSelectorConfig getArtifact() { @Override public String toString() { - return "Plugin{" + - "name='" + name + '\'' + - ", properties=" + properties + - ", artifact=" + artifact + - '}'; + return "Plugin{" + + "name='" + name + '\'' + + ", properties=" + properties + + ", artifact=" + artifact + + '}'; } @Override @@ -76,9 +76,9 @@ public boolean equals(Object o) { Plugin that = (Plugin) o; - return Objects.equals(name, that.name) && - Objects.equals(properties, that.properties) && - Objects.equals(artifact, that.artifact); + return Objects.equals(name, that.name) + && Objects.equals(properties, that.properties) + && Objects.equals(artifact, that.artifact); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ArgumentMapping.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ArgumentMapping.java index b8a4a15b5159..cf16d62befe6 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ArgumentMapping.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ArgumentMapping.java @@ -68,10 +68,10 @@ public TriggeringPipelineId getTriggeringPipelineId() { @Override public String toString() { - return "ArgumentMapping{" + - "source='" + getSource() + '\'' + - ", target='" + getTarget() + '\'' + - ", triggeringPipelineId='" + getTriggeringPipelineId() + '\'' + - '}'; + return "ArgumentMapping{" + + "source='" + getSource() + '\'' + + ", target='" + getTarget() + '\'' + + ", triggeringPipelineId='" + getTriggeringPipelineId() + '\'' + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ConnectionConfig.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ConnectionConfig.java index 16f9bff36744..1a13d624cfe8 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ConnectionConfig.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ConnectionConfig.java @@ -62,9 +62,9 @@ public boolean equals(Object o) { } ConnectionConfig that = (ConnectionConfig) o; - return Objects.equals(disabledTypes, that.disabledTypes) && - Objects.equals(connections, that.connections) && - Objects.equals(defaultConnection, that.defaultConnection); + return Objects.equals(disabledTypes, that.disabledTypes) + && Objects.equals(connections, that.connections) + && Objects.equals(defaultConnection, that.defaultConnection); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/DataStreamsConfig.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/DataStreamsConfig.java index cf63fdc75061..9420c82301ea 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/DataStreamsConfig.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/DataStreamsConfig.java @@ -90,14 +90,14 @@ public String getCheckpointDir() { @Override public String toString() { - return "DataStreamsConfig{" + - "batchInterval='" + batchInterval + '\'' + - ", extraJavaOpts='" + extraJavaOpts + '\'' + - ", disableCheckpoints=" + disableCheckpoints + - ", checkpointDir='" + checkpointDir + '\'' + - ", stopGracefully=" + stopGracefully + - ", isUnitTest=" + isUnitTest + - "} " + super.toString(); + return "DataStreamsConfig{" + + "batchInterval='" + batchInterval + '\'' + + ", extraJavaOpts='" + extraJavaOpts + '\'' + + ", disableCheckpoints=" + disableCheckpoints + + ", checkpointDir='" + checkpointDir + '\'' + + ", stopGracefully=" + stopGracefully + + ", isUnitTest=" + isUnitTest + + "} " + super.toString(); } @Override @@ -114,11 +114,11 @@ public boolean equals(Object o) { DataStreamsConfig that = (DataStreamsConfig) o; - return Objects.equals(batchInterval, that.batchInterval) && - Objects.equals(extraJavaOpts, that.extraJavaOpts) && - Objects.equals(disableCheckpoints, that.disableCheckpoints) && - Objects.equals(checkpointDir, that.checkpointDir) && - Objects.equals(stopGracefully, that.stopGracefully); + return Objects.equals(batchInterval, that.batchInterval) + && Objects.equals(extraJavaOpts, that.extraJavaOpts) + && Objects.equals(disableCheckpoints, that.disableCheckpoints) + && Objects.equals(checkpointDir, that.checkpointDir) + && Objects.equals(stopGracefully, that.stopGracefully); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLBatchConfig.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLBatchConfig.java index 5f708b354be2..d600537041a8 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLBatchConfig.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLBatchConfig.java @@ -179,12 +179,12 @@ public boolean equals(Object o) { ETLBatchConfig that = (ETLBatchConfig) o; - return Objects.equals(engine, that.engine) && - Objects.equals(schedule, that.schedule) && - Objects.equals(postActions, that.postActions) && - Objects.equals(actions, that.actions) && - Objects.equals(maxConcurrentRuns, that.maxConcurrentRuns) && - Objects.equals(transformationPushdown, that.transformationPushdown); + return Objects.equals(engine, that.engine) + && Objects.equals(schedule, that.schedule) + && Objects.equals(postActions, that.postActions) + && Objects.equals(actions, that.actions) + && Objects.equals(maxConcurrentRuns, that.maxConcurrentRuns) + && Objects.equals(transformationPushdown, that.transformationPushdown); } @@ -196,14 +196,14 @@ public int hashCode() { @Override public String toString() { - return "ETLBatchConfig{" + - "engine=" + engine + - ", schedule='" + schedule + '\'' + - ", maxConcurrentRuns=" + maxConcurrentRuns + - ", postActions=" + postActions + - ", actions=" + actions + - ", transformationPushdown=" + transformationPushdown + - "} " + super.toString(); + return "ETLBatchConfig{" + + "engine=" + engine + + ", schedule='" + schedule + '\'' + + ", maxConcurrentRuns=" + maxConcurrentRuns + + ", postActions=" + postActions + + ", actions=" + actions + + ", transformationPushdown=" + transformationPushdown + + "} " + super.toString(); } /** diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLConfig.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLConfig.java index deba49318e5d..8f651c81b023 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLConfig.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLConfig.java @@ -200,16 +200,16 @@ public boolean equals(Object o) { ETLConfig that = (ETLConfig) o; - return Objects.equals(description, that.description) && - Objects.equals(stages, that.stages) && - Objects.equals(connections, that.connections) && - Objects.equals(getResources(), that.getResources()) && - Objects.equals(getDriverResources(), that.getDriverResources()) && - Objects.equals(getClientResources(), that.getClientResources()) && - Objects.equals(getProperties(), that.getProperties()) && - isStageLoggingEnabled() == that.isStageLoggingEnabled() && - isProcessTimingEnabled() == that.isProcessTimingEnabled() && - getNumOfRecordsPreview() == that.getNumOfRecordsPreview(); + return Objects.equals(description, that.description) + && Objects.equals(stages, that.stages) + && Objects.equals(connections, that.connections) + && Objects.equals(getResources(), that.getResources()) + && Objects.equals(getDriverResources(), that.getDriverResources()) + && Objects.equals(getClientResources(), that.getClientResources()) + && Objects.equals(getProperties(), that.getProperties()) + && isStageLoggingEnabled() == that.isStageLoggingEnabled() + && isProcessTimingEnabled() == that.isProcessTimingEnabled() + && getNumOfRecordsPreview() == that.getNumOfRecordsPreview(); } @Override @@ -232,21 +232,21 @@ public UpgradeableConfig upgrade(UpgradeContext upgradeContext) { @Override public String toString() { - return "ETLConfig{" + - "description='" + description + '\'' + - ", stages=" + stages + - ", connections=" + connections + - ", resources=" + resources + - ", driverResources=" + driverResources + - ", clientResources=" + clientResources + - ", stageLoggingEnabled=" + stageLoggingEnabled + - ", processTimingEnabled=" + processTimingEnabled + - ", numOfRecordsPreview=" + numOfRecordsPreview + - ", properties=" + properties + - ", source=" + source + - ", sinks=" + sinks + - ", transforms=" + transforms + - "} " + super.toString(); + return "ETLConfig{" + + "description='" + description + '\'' + + ", stages=" + stages + + ", connections=" + connections + + ", resources=" + resources + + ", driverResources=" + driverResources + + ", clientResources=" + clientResources + + ", stageLoggingEnabled=" + stageLoggingEnabled + + ", processTimingEnabled=" + processTimingEnabled + + ", numOfRecordsPreview=" + numOfRecordsPreview + + ", properties=" + properties + + ", source=" + source + + ", sinks=" + sinks + + ", transforms=" + transforms + + "} " + super.toString(); } /** diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLPlugin.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLPlugin.java index 10ef9ed95aba..298f7fecf3c1 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLPlugin.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLPlugin.java @@ -107,12 +107,12 @@ public void validate() { @Override public String toString() { - return "Plugin{" + - "name='" + name + '\'' + - ", type='" + type + '\'' + - ", properties=" + properties + - ", artifact=" + artifact + - '}'; + return "Plugin{" + + "name='" + name + '\'' + + ", type='" + type + '\'' + + ", properties=" + properties + + ", artifact=" + artifact + + '}'; } @Override @@ -126,10 +126,10 @@ public boolean equals(Object o) { ETLPlugin that = (ETLPlugin) o; - return Objects.equals(name, that.name) && - Objects.equals(type, that.type) && - Objects.equals(properties, that.properties) && - Objects.equals(artifact, that.artifact); + return Objects.equals(name, that.name) + && Objects.equals(type, that.type) + && Objects.equals(properties, that.properties) + && Objects.equals(artifact, that.artifact); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLStage.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLStage.java index a3d8edb15d6e..c19252f5562a 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLStage.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLStage.java @@ -102,10 +102,10 @@ public void validate() { if (errorDatasetName != null) { throw new IllegalArgumentException( String.format( - "Invalid stage '%s'. Error datasets have been replaced by error collectors. " + - "Please connect stage '%s' to an error collector, then connect the error collector " - + - "to a sink.", name, name)); + "Invalid stage '%s'. Error datasets have been replaced by error collectors. " + + "Please connect stage '%s' to an error collector, then connect the error collector " + + + "to a sink.", name, name)); } plugin.validate(); } @@ -242,10 +242,10 @@ private String getUpgradedVersionString(ArtifactId newPlugin) { @Override public String toString() { - return "ETLStage{" + - "name='" + name + '\'' + - ", plugin=" + plugin + - '}'; + return "ETLStage{" + + "name='" + name + '\'' + + ", plugin=" + plugin + + '}'; } @Override @@ -259,8 +259,8 @@ public boolean equals(Object o) { ETLStage that = (ETLStage) o; - return Objects.equals(name, that.name) && - Objects.equals(plugin, that.plugin); + return Objects.equals(name, that.name) + && Objects.equals(plugin, that.plugin); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLTransformationPushdown.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLTransformationPushdown.java index d5408a900577..145e0432e704 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLTransformationPushdown.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/ETLTransformationPushdown.java @@ -58,8 +58,8 @@ public int hashCode() { @Override public String toString() { - return "ETLTransformationPushdown{" + - "plugin=" + plugin + - '}'; + return "ETLTransformationPushdown{" + + "plugin=" + plugin + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/PluginPropertyMapping.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/PluginPropertyMapping.java index a0a111e49d37..63d7974d6402 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/PluginPropertyMapping.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/PluginPropertyMapping.java @@ -49,11 +49,11 @@ public String getStageName() { @Override public String toString() { - return "PluginPropertyMapping{" + - "source='" + getSource() + '\'' + - ", target='" + getTarget() + '\'' + - ", stageName='" + getStageName() + '\'' + - ", triggeringPipelineId='" + getTriggeringPipelineId() + '\'' + - '}'; + return "PluginPropertyMapping{" + + "source='" + getSource() + '\'' + + ", target='" + getTarget() + '\'' + + ", stageName='" + getStageName() + '\'' + + ", triggeringPipelineId='" + getTriggeringPipelineId() + '\'' + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/TriggeringPipelineId.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/TriggeringPipelineId.java index 26db1284044f..6aed066c69d1 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/TriggeringPipelineId.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/TriggeringPipelineId.java @@ -53,9 +53,9 @@ public boolean equals(TriggeringPipelineId otherPipelineId) { @Override public String toString() { - return "TriggeringPipelineId{" + - "namespace='" + getNamespace() + '\'' + - ", pipelineName='" + getName() + '\'' + - '}'; + return "TriggeringPipelineId{" + + "namespace='" + getNamespace() + '\'' + + ", pipelineName='" + getName() + '\'' + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/TriggeringPropertyMapping.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/TriggeringPropertyMapping.java index 0c4f736e94fb..a97d2284b32b 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/TriggeringPropertyMapping.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/TriggeringPropertyMapping.java @@ -56,9 +56,9 @@ public List getPluginProperties() { @Override public String toString() { - return "TriggeringPropertyMapping{" + - "arguments=" + getArguments() + - ", pluginProperties=" + getPluginProperties() + - '}'; + return "TriggeringPropertyMapping{" + + "arguments=" + getArguments() + + ", pluginProperties=" + getPluginProperties() + + '}'; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/PipelineSpec.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/PipelineSpec.java index 6b07fb37b4c7..6b79fcbdb309 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/PipelineSpec.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/PipelineSpec.java @@ -133,15 +133,15 @@ public boolean equals(Object o) { PipelineSpec that = (PipelineSpec) o; - return Objects.equals(stages, that.stages) && - Objects.equals(connections, that.connections) && - Objects.equals(resources, that.resources) && - Objects.equals(driverResources, that.driverResources) && - Objects.equals(clientResources, that.clientResources) && - Objects.equals(properties, that.properties) && - stageLoggingEnabled == that.stageLoggingEnabled && - processTimingEnabled == that.processTimingEnabled && - numOfRecordsPreview == that.numOfRecordsPreview && engine == that.engine; + return Objects.equals(stages, that.stages) + && Objects.equals(connections, that.connections) + && Objects.equals(resources, that.resources) + && Objects.equals(driverResources, that.driverResources) + && Objects.equals(clientResources, that.clientResources) + && Objects.equals(properties, that.properties) + && stageLoggingEnabled == that.stageLoggingEnabled + && processTimingEnabled == that.processTimingEnabled + && numOfRecordsPreview == that.numOfRecordsPreview && engine == that.engine; } @Override @@ -152,18 +152,18 @@ public int hashCode() { @Override public String toString() { - return "PipelineSpec{" + - "stages=" + stages + - ", connections=" + connections + - ", resources=" + resources + - ", driverResources=" + driverResources + - ", clientResources=" + clientResources + - ", stageLoggingEnabled=" + stageLoggingEnabled + - ", processTimingEnabled=" + processTimingEnabled + - ", numOfRecordsPreview=" + numOfRecordsPreview + - ", properties=" + properties + - ", engine=" + engine + - "}"; + return "PipelineSpec{" + + "stages=" + stages + + ", connections=" + connections + + ", resources=" + resources + + ", driverResources=" + driverResources + + ", clientResources=" + clientResources + + ", stageLoggingEnabled=" + stageLoggingEnabled + + ", processTimingEnabled=" + processTimingEnabled + + ", numOfRecordsPreview=" + numOfRecordsPreview + + ", properties=" + properties + + ", engine=" + engine + + "}"; } public boolean isPreviewEnabled(RuntimeContext context) { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/PluginSpec.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/PluginSpec.java index 301bb74845e1..33355872c53f 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/PluginSpec.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/PluginSpec.java @@ -82,10 +82,10 @@ public boolean equals(Object o) { PluginSpec that = (PluginSpec) o; - return Objects.equals(type, that.type) && - Objects.equals(name, that.name) && - Objects.equals(properties, that.properties) && - Objects.equals(artifact, that.artifact); + return Objects.equals(type, that.type) + && Objects.equals(name, that.name) + && Objects.equals(properties, that.properties) + && Objects.equals(artifact, that.artifact); } @Override @@ -95,12 +95,12 @@ public int hashCode() { @Override public String toString() { - return "PluginSpec{" + - "type='" + type + '\'' + - ", name='" + name + '\'' + - ", properties=" + properties + - ", artifact=" + artifact + - '}'; + return "PluginSpec{" + + "type='" + type + '\'' + + ", name='" + name + '\'' + + ", properties=" + properties + + ", artifact=" + artifact + + '}'; } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/StageSpec.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/StageSpec.java index ed25e0a6399e..cbc76583cad8 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/StageSpec.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/spec/StageSpec.java @@ -142,15 +142,15 @@ public boolean equals(Object o) { StageSpec that = (StageSpec) o; - return Objects.equals(name, that.name) && - Objects.equals(plugin, that.plugin) && - Objects.equals(inputSchemas, that.inputSchemas) && - Objects.equals(getInputStages(), that.getInputStages()) && - Objects.equals(outputPorts, that.outputPorts) && - Objects.equals(outputSchema, that.outputSchema) && - Objects.equals(errorSchema, that.errorSchema) && - stageLoggingEnabled == that.stageLoggingEnabled && - processTimingEnabled == that.processTimingEnabled; + return Objects.equals(name, that.name) + && Objects.equals(plugin, that.plugin) + && Objects.equals(inputSchemas, that.inputSchemas) + && Objects.equals(getInputStages(), that.getInputStages()) + && Objects.equals(outputPorts, that.outputPorts) + && Objects.equals(outputSchema, that.outputSchema) + && Objects.equals(errorSchema, that.errorSchema) + && stageLoggingEnabled == that.stageLoggingEnabled + && processTimingEnabled == that.processTimingEnabled; } @Override @@ -161,18 +161,18 @@ public int hashCode() { @Override public String toString() { - return "StageSpec{" + - "name='" + name + '\'' + - ", plugin=" + plugin + - ", inputSchemas=" + inputSchemas + - ", inputStages=" + inputStages + - ", outputPorts=" + outputPorts + - ", outputSchema=" + outputSchema + - ", errorSchema=" + errorSchema + - ", stageLoggingEnabled=" + stageLoggingEnabled + - ", processTimingEnabled=" + processTimingEnabled + - ", maxPreviewRecords=" + maxPreviewRecords + - '}'; + return "StageSpec{" + + "name='" + name + '\'' + + ", plugin=" + plugin + + ", inputSchemas=" + inputSchemas + + ", inputStages=" + inputStages + + ", outputPorts=" + outputPorts + + ", outputSchema=" + outputSchema + + ", errorSchema=" + errorSchema + + ", stageLoggingEnabled=" + stageLoggingEnabled + + ", processTimingEnabled=" + processTimingEnabled + + ", maxPreviewRecords=" + maxPreviewRecords + + '}'; } public boolean isPreviewEnabled(RuntimeContext context) { diff --git a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/validation/StageSchema.java b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/validation/StageSchema.java index 1cf6cf5c78a5..c7e8a9260218 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/validation/StageSchema.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-proto/src/main/java/io/cdap/cdap/etl/proto/v2/validation/StageSchema.java @@ -64,8 +64,8 @@ public boolean equals(Object o) { return false; } StageSchema that = (StageSchema) o; - return Objects.equals(stage, that.stage) && - Objects.equals(schema, that.schema); + return Objects.equals(stage, that.stage) + && Objects.equals(schema, that.schema); } @Override diff --git a/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/UpgradeTool.java b/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/UpgradeTool.java index 4a4dab98dd4a..0bd4dcfe5785 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/UpgradeTool.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/UpgradeTool.java @@ -162,55 +162,60 @@ public static void main(String[] args) throws Exception { Options options = new Options() .addOption(new Option("h", "help", false, "Print this usage message.")) .addOption( - new Option("u", "uri", true, "CDAP instance URI to interact with in the format " + - "[http[s]://]:. Defaults to localhost:11015.")) + new Option("u", "uri", true, "CDAP instance URI to interact with in the format " + + "[http[s]://]:. Defaults to localhost:11015.")) .addOption(new Option("a", "accesstoken", true, - "File containing the access token to use when interacting " + - "with a secure CDAP instance.")) + "File containing the access token to use when interacting " + + "with a secure CDAP instance.")) .addOption(new Option("t", "timeout", true, - "Timeout in milliseconds to use when interacting with the " + - "CDAP RESTful APIs. Defaults to " + DEFAULT_READ_TIMEOUT_MILLIS + ".")) + "Timeout in milliseconds to use when interacting with the " + + "CDAP RESTful APIs. Defaults to " + DEFAULT_READ_TIMEOUT_MILLIS + ".")) .addOption(new Option("n", "namespace", true, - "Namespace to perform the upgrade in. If none is given, " + - "pipelines in all namespaces will be upgraded.")) + "Namespace to perform the upgrade in. If none is given, " + + "pipelines in all namespaces will be upgraded.")) .addOption(new Option("p", "pipeline", true, - "Name of the pipeline to upgrade. If specified, a namespace " + - "must also be given.")) + "Name of the pipeline to upgrade. If specified, a namespace " + + "must also be given.")) .addOption(new Option("v", "version", true, - "Pipeline version to upgrade to. This should only be specified if " + - "you want to upgrade to a version that is not the same as the version of this tool.")) - .addOption(new Option("r", "rerun", false, "Whether to re-run upgrade of pipelines. " + - "This will re-run the upgrade for any pipelines that are using the current pipeline version in addition " - + - "to running upgrade for any old pipelines.")) + "Pipeline version to upgrade to. This should only be specified if " + + "you want to upgrade to a version that is not the same as the version of this tool.")) + .addOption(new Option("r", "rerun", false, "Whether to re-run upgrade of pipelines. " + + "This will re-run the upgrade for any pipelines that are using the current pipeline version in addition " + + + "to running upgrade for any old pipelines.")) .addOption(new Option("f", "configfile", true, - "File containing old application details to update. " + - "The file contents are expected to be in the same format as the request body for creating an " - + - "ETL application from one of the etl artifacts. " + - "It is expected to be a JSON Object containing 'artifact' and 'config' fields." + - "The value for 'artifact' must be a JSON Object that specifies the artifact scope, name, and version. " - + - "The value for 'config' must be a JSON Object specifies the source, transforms, and sinks of the pipeline, " - + - "as expected by older versions of the etl artifacts.")) + "File containing old application details to update. " + + "The file contents are expected to be in the same format as the request body for creating an " + + + "ETL application from one of the etl artifacts. " + + "It is expected to be a JSON Object containing 'artifact' and 'config' fields." + + "The value for 'artifact' must be a JSON Object that specifies " + + "the artifact scope, name, and version. " + + + "The value for 'config' must be a JSON Object specifies " + + "the source, transforms, and sinks of the pipeline, " + + + "as expected by older versions of the etl artifacts.")) .addOption(new Option("o", "outputfile", true, - "File to write the converted application details provided in " + - "the configfile option. If none is given, results will be written to the input file + '.converted'. " - + - "The contents of this file can be sent directly to CDAP to update or create an application.")) + "File to write the converted application details provided in " + + "the configfile option. If none is given, results will be written " + + "to the input file + '.converted'. " + + + "The contents of this file can be sent directly to CDAP to update or create an application.")) .addOption(new Option("od", "outputdir", true, - "Directory to write the application request that would be used " + - "to upgrade the pipeline(s). This should only be used with the 'dryrun' command, not the 'upgrade' command. " - + - "The contents of the app request files can be sent directly to CDAP to update or create an application.")) + "Directory to write the application request that would be used " + + "to upgrade the pipeline(s). This should only be used with the 'dryrun' command, " + + "not the 'upgrade' command. " + + + "The contents of the app request files can be sent directly to CDAP to update " + + "or create an application.")) .addOption(new Option("e", "errorDir", true, - "Optional directory to write any upgraded pipeline configs that " + - "failed to upgrade. The problematic configs can then be manually edited and upgraded separately. " - + - "Upgrade errors may happen for pipelines that use plugins that are not backwards compatible. " - + - "This directory must be writable by the user that is running this tool.")); + "Optional directory to write any upgraded pipeline configs that " + + "failed to upgrade. The problematic configs can then be manually edited and upgraded separately. " + + + "Upgrade errors may happen for pipelines that use plugins that are not backwards compatible. " + + + "This directory must be writable by the user that is running this tool.")); CommandLineParser parser = new BasicParser(); CommandLine commandLine = parser.parse(options, args); @@ -218,19 +223,19 @@ public static void main(String[] args) throws Exception { String command = commandArgs.length > 0 ? commandArgs[0] : null; // if help is an option, or if there isn't a single 'upgrade' command, print usage and exit. - if (commandLine.hasOption("h") || commandArgs.length != 1 || - (!"downgrade".equalsIgnoreCase(command) && !"upgrade".equalsIgnoreCase(command) && - !"dryrun".equalsIgnoreCase(command))) { + if (commandLine.hasOption("h") || commandArgs.length != 1 + || (!"downgrade".equalsIgnoreCase(command) && !"upgrade".equalsIgnoreCase(command) + && !"dryrun".equalsIgnoreCase(command))) { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp( UpgradeTool.class.getName() + " upgrade|downgrade|dryrun", "Upgrades old pipelines to the current version. If the plugins used are not backward-compatible, " - + - "the attempted upgrade config will be written to the error directory for a manual upgrade. " - + - "If 'dryrun' is used as the command instead of 'upgrade', pipelines will not be upgraded, but the " - + - "application update requests will instead be written as files to the specified outputdir.", + + + "the attempted upgrade config will be written to the error directory for a manual upgrade. " + + + "If 'dryrun' is used as the command instead of 'upgrade', pipelines will not be upgraded, but the " + + + "application update requests will instead be written as files to the specified outputdir.", options, ""); System.exit(0); } @@ -334,8 +339,8 @@ private static ClientConfig getClientConfig(CommandLine commandLine) throws IOEx .setSSLEnabled(sslEnabled) .build(); - int readTimeout = commandLine.hasOption("t") ? - Integer.parseInt(commandLine.getOptionValue("t")) : DEFAULT_READ_TIMEOUT_MILLIS; + int readTimeout = commandLine.hasOption("t") + ? Integer.parseInt(commandLine.getOptionValue("t")) : DEFAULT_READ_TIMEOUT_MILLIS; ClientConfig.Builder clientConfigBuilder = ClientConfig.builder() .setDefaultReadTimeout(readTimeout) .setConnectionConfig(connectionConfig); @@ -393,8 +398,8 @@ public boolean upgrade(AppRequest appRequest) throws IOExce } }); - LOG.info("Successfully converted application details from file " + configFilePath + ". " + - "Results have been written to " + outputFilePath); + LOG.info("Successfully converted application details from file " + configFilePath + ". " + + "Results have been written to " + outputFilePath); } // class used to deserialize the old pipeline requests diff --git a/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/config/ClientUpgradeContext.java b/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/config/ClientUpgradeContext.java index f9c6573eb01c..58a53f7f5a79 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/config/ClientUpgradeContext.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/config/ClientUpgradeContext.java @@ -72,8 +72,8 @@ public ArtifactSelectorConfig getPluginArtifact(String pluginType, String plugin chosenArtifact.getName(), chosenArtifact.getVersion()); } catch (Exception e) { - LOG.warn("Unable to find an artifact for plugin of type {} and name {}. " + - "Plugin artifact section will be left empty.", pluginType, pluginName); + LOG.warn("Unable to find an artifact for plugin of type {} and name {}. " + + "Plugin artifact section will be left empty.", pluginType, pluginName); return null; } } diff --git a/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/config/Upgrader.java b/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/config/Upgrader.java index 98ed41357744..30da68e1778c 100644 --- a/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/config/Upgrader.java +++ b/cdap-app-templates/cdap-etl/cdap-etl-tools/src/main/java/io/cdap/cdap/etl/tool/config/Upgrader.java @@ -61,9 +61,9 @@ public Upgrader(NamespaceClient namespaceClient, ArtifactClient artifactClient, new ClientUpgradeContext(namespaceClient, artifactClient, DATA_PIPELINE_NAME, newVersion); this.dataStreamsContext = new ClientUpgradeContext(namespaceClient, artifactClient, DATA_STREAMS_NAME, newVersion); - this.upgradeRange = downgrade ? - new ArtifactVersionRange(new ArtifactVersion(newVersion), includeCurrentVersion, - new ArtifactVersion(ETLVersion.getVersion()), true) : + this.upgradeRange = downgrade + ? new ArtifactVersionRange(new ArtifactVersion(newVersion), includeCurrentVersion, + new ArtifactVersion(ETLVersion.getVersion()), true) : new ArtifactVersionRange(LOWEST_VERSION, true, new ArtifactVersion(newVersion), includeCurrentVersion); this.newVersion = newVersion; diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/SparkPipelineRunner.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/SparkPipelineRunner.java index fd2df4be09f5..3b85d0a3558e 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/SparkPipelineRunner.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/SparkPipelineRunner.java @@ -452,12 +452,12 @@ private Map> getInputDataCollections(PipelinePha // a key, but not 'c1.connector'. Similarly, if the input stage is a connector, it won't have any output ports // however, this is fine since we know that the output of a connector stage is always normal output, // not errors or alerts or output port records - if (!Constants.Connector.PLUGIN_TYPE.equals(inputStageSpec.getPluginType()) && - !Constants.Connector.PLUGIN_TYPE.equals(pluginType)) { + if (!Constants.Connector.PLUGIN_TYPE.equals(inputStageSpec.getPluginType()) + && !Constants.Connector.PLUGIN_TYPE.equals(pluginType)) { port = inputStageSpec.getOutputPorts().get(stageName).getPort(); } - SparkCollection inputRecords = port == null ? - emittedRecords.get(inputStageName).getOutputRecords() : + SparkCollection inputRecords = port == null + ? emittedRecords.get(inputStageName).getOutputRecords() : emittedRecords.get(inputStageName).getOutputPortRecords().get(port); inputDataCollections.put(inputStageName, inputRecords); } @@ -728,9 +728,9 @@ private SparkCollection handleAutoJoinOnKeys(String stageName, JoinDefin // when we properly propagate schema at runtime, this condition should no longer happen if (outputSchema == null) { throw new IllegalArgumentException( - String.format("Joiner stage '%s' cannot calculate its output schema because " + - "one or more inputs have dynamic or unknown schema. " + - "An output schema must be directly provided.", stageName)); + String.format("Joiner stage '%s' cannot calculate its output schema because " + + "one or more inputs have dynamic or unknown schema. " + + "An output schema must be directly provided.", stageName)); } List toJoin = new ArrayList<>(); List keySchema = null; @@ -862,15 +862,15 @@ static List deriveKeySchema(String joinerStageName, Map deriveKeySchema(String joinerStageName, Map deriveKeySchema(String joinerStageName, Map handleJoin(BatchJoiner joiner, joinedInputs = preJoinCollection.mapValues(new InitialJoinFunction<>(inputStageName)); } else { JoinFlattenFunction joinFlattenFunction = new JoinFlattenFunction<>(inputStageName); - joinedInputs = numPartitions == null ? - joinedInputs.join(preJoinCollection).mapValues(joinFlattenFunction) : + joinedInputs = numPartitions == null + ? joinedInputs.join(preJoinCollection).mapValues(joinFlattenFunction) : joinedInputs.join(preJoinCollection, numPartitions).mapValues(joinFlattenFunction); } remainingInputs.remove(inputStageName); @@ -1022,14 +1022,14 @@ protected SparkCollection handleJoin(BatchJoiner joiner, if (isFullOuter) { OuterJoinFlattenFunction flattenFunction = new OuterJoinFlattenFunction<>(inputStageName); - joinedInputs = numPartitions == null ? - joinedInputs.fullOuterJoin(preJoinStream).mapValues(flattenFunction) : + joinedInputs = numPartitions == null + ? joinedInputs.fullOuterJoin(preJoinStream).mapValues(flattenFunction) : joinedInputs.fullOuterJoin(preJoinStream, numPartitions).mapValues(flattenFunction); } else { LeftJoinFlattenFunction flattenFunction = new LeftJoinFlattenFunction<>(inputStageName); - joinedInputs = numPartitions == null ? - joinedInputs.leftOuterJoin(preJoinStream).mapValues(flattenFunction) : + joinedInputs = numPartitions == null + ? joinedInputs.leftOuterJoin(preJoinStream).mapValues(flattenFunction) : joinedInputs.leftOuterJoin(preJoinStream, numPartitions).mapValues(flattenFunction); } } diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/BaseRDDCollection.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/BaseRDDCollection.java index 591b085855a1..32fd1cb06317 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/BaseRDDCollection.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/BaseRDDCollection.java @@ -171,8 +171,8 @@ public SparkCollection> aggregate(StageSpec stageSpec, @Nulla JavaPairRDD keyedCollection = rdd.flatMapToPair(groupByFunction); - JavaPairRDD> groupedCollection = partitions == null ? - keyedCollection.groupByKey() : keyedCollection.groupByKey(partitions); + JavaPairRDD> groupedCollection = partitions == null + ? keyedCollection.groupByKey() : keyedCollection.groupByKey(partitions); FlatMapFunction>, RecordInfo> sparkAggregateFunction = new AggregatorAggregateFunction<>(pluginFunctionContext, functionCacheFactory.newCache()); @@ -195,8 +195,8 @@ public SparkCollection> reduceAggregate(StageSpec stageSpec, pluginFunctionContext, functionCacheFactory.newCache()); Function2 mergePartitionFunction = new AggregatorMergePartitionFunction<>(pluginFunctionContext, functionCacheFactory.newCache()); - JavaPairRDD groupedCollection = partitions == null ? - keyedCollection.combineByKey(initializeFunction, mergeValueFunction, mergePartitionFunction) : + JavaPairRDD groupedCollection = partitions == null + ? keyedCollection.combineByKey(initializeFunction, mergeValueFunction, mergePartitionFunction) : keyedCollection.combineByKey(initializeFunction, mergeValueFunction, mergePartitionFunction, partitions); FlatMapFunction, RecordInfo> postFunction = diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/SQLEngineCollection.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/SQLEngineCollection.java index 63acc5078f7f..912c96c5af8f 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/SQLEngineCollection.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/SQLEngineCollection.java @@ -63,8 +63,8 @@ */ public class SQLEngineCollection implements SQLBackedCollection { private static final Logger LOG = LoggerFactory.getLogger(SQLEngineCollection.class); - private static final String DIRECT_WRITE_ERROR = "Exception when trying to write to sink {} using direct output. " + - "Operation will continue with standard sink flow."; + private static final String DIRECT_WRITE_ERROR = "Exception when trying to write to sink {} using direct output. " + + "Operation will continue with standard sink flow."; private final JavaSparkExecutionContext sec; private final JavaSparkContext jsc; private final SQLContext sqlContext; diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/SparkBatchSinkFactory.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/SparkBatchSinkFactory.java index 74531a0f22ad..10ce8b9d8b2b 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/SparkBatchSinkFactory.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/batch/SparkBatchSinkFactory.java @@ -122,8 +122,8 @@ public Set writeCombinedRDD(JavaPairRDD> c Set sinkOutputNames = sinkOutputs.get(sinkName); if (sinkOutputNames == null || sinkOutputNames.isEmpty()) { // should never happen if validation happened correctly at pipeline configure time - throw new IllegalStateException(sinkName + " has no outputs. " + - "Please check that the sink calls addOutput at some point."); + throw new IllegalStateException(sinkName + " has no outputs. " + + "Please check that the sink calls addOutput at some point."); } for (String outputName : sinkOutputNames) { @@ -138,10 +138,10 @@ public Set writeCombinedRDD(JavaPairRDD> c // should never happen if planner is implemented correctly and dataset based sinks are not // grouped with other sinks throw new IllegalStateException( - String.format("sink '%s' does not use an OutputFormatProvider. " + - "This indicates that there is a planner bug. " + - "Please report the issue and turn off stage consolidation by setting '%s'" + - " to false in the runtime arguments.", sinkName, Constants.CONSOLIDATE_STAGES)); + String.format("sink '%s' does not use an OutputFormatProvider. " + + "This indicates that there is a planner bug. " + + "Please report the issue and turn off stage consolidation by setting '%s'" + + " to false in the runtime arguments.", sinkName, Constants.CONSOLIDATE_STAGES)); } lineageNames.add(outputFormatProvider.name); outputFormatProviders.put(outputName, outputFormatProvider); @@ -171,8 +171,8 @@ public Set writeFromRDD(JavaPairRDD rdd, JavaSparkExecution Set outputNames = sinkOutputs.get(sinkName); if (outputNames == null || outputNames.isEmpty()) { // should never happen if validation happened correctly at pipeline configure time - throw new IllegalArgumentException(sinkName + " has no outputs. " + - "Please check that the sink calls addOutput at some point."); + throw new IllegalArgumentException(sinkName + " has no outputs. " + + "Please check that the sink calls addOutput at some point."); } Set lineageNames = new HashSet<>(); diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/AlertPassFilter.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/AlertPassFilter.java index 0740156dc4eb..43dc7cba941d 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/AlertPassFilter.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/AlertPassFilter.java @@ -32,7 +32,7 @@ public class AlertPassFilter implements FlatMapFunction, Aler @Override public Iterator call(RecordInfo input) throws Exception { //noinspection unchecked - return input.getType() == RecordType.ALERT ? - Iterators.singletonIterator(((Alert) input.getValue())) : Iterators.emptyIterator(); + return input.getType() == RecordType.ALERT + ? Iterators.singletonIterator(((Alert) input.getValue())) : Iterators.emptyIterator(); } } diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/ErrorPassFilter.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/ErrorPassFilter.java index 7210ae18d572..f70ef7ae5d5f 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/ErrorPassFilter.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/ErrorPassFilter.java @@ -34,7 +34,7 @@ public class ErrorPassFilter implements FlatMapFunction, E @Override public Iterator> call(RecordInfo input) throws Exception { //noinspection unchecked - return input.getType() == RecordType.ERROR ? - Iterators.singletonIterator((ErrorRecord) input.getValue()) : Iterators.emptyIterator(); + return input.getType() == RecordType.ERROR + ? Iterators.singletonIterator((ErrorRecord) input.getValue()) : Iterators.emptyIterator(); } } diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/JoinMergeFunction.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/JoinMergeFunction.java index c56dfa45ce36..1ed846828c2d 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/JoinMergeFunction.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/JoinMergeFunction.java @@ -81,8 +81,8 @@ private BatchJoiner createInitializedJoiner() throws Exceptio autoJoinerContext.getFailureCollector().getOrThrowException(); if (joinDefinition == null) { throw new IllegalStateException(String.format( - "Join stage '%s' did not specify a join definition. " + - "Check with the plugin developer to ensure it is implemented correctly.", stageName)); + "Join stage '%s' did not specify a join definition. " + + "Check with the plugin developer to ensure it is implemented correctly.", stageName)); } joiner = new JoinerBridge(stageName, autoJoiner, joinDefinition); } else { diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/JoinOnFunction.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/JoinOnFunction.java index b0be4e51c455..f3b9c8795ea7 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/JoinOnFunction.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/JoinOnFunction.java @@ -87,8 +87,8 @@ private JoinOnTransform createInitializedJoinOnTransform String stageName = pluginFunctionContext.getStageName(); if (joinDefinition == null) { throw new IllegalStateException(String.format( - "Join stage '%s' did not specify a join definition. " + - "Check with the plugin developer to ensure it is implemented correctly.", stageName)); + "Join stage '%s' did not specify a join definition. " + + "Check with the plugin developer to ensure it is implemented correctly.", stageName)); } JoinCondition condition = joinDefinition.getCondition(); /* diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/MultiSinkFunction.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/MultiSinkFunction.java index 88755876100b..78bba49f3c1c 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/MultiSinkFunction.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/MultiSinkFunction.java @@ -191,9 +191,9 @@ private void initializeBranchExecutors() { branchExecutors.put(groupSource, executorFactory.create(branch)); } catch (Exception e) { throw new IllegalStateException( - String.format("Unable to get subset of pipeline starting from stage %s. " + - "This indicates a planning error. Please report this bug and turn off stage " + - "consolidation by setting %s to false in the runtime arguments.", + String.format("Unable to get subset of pipeline starting from stage %s. " + + "This indicates a planning error. Please report this bug and turn off stage " + + "consolidation by setting %s to false in the runtime arguments.", groupSource, Constants.CONSOLIDATE_STAGES), e); } @@ -260,9 +260,9 @@ public boolean equals(Object o) { return false; } InputInfo that = (InputInfo) o; - return Objects.equals(stageName, that.stageName) && - type == that.type && - Objects.equals(port, that.port); + return Objects.equals(stageName, that.stageName) + && type == that.type + && Objects.equals(port, that.port); } @Override diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/OutputPassFilter.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/OutputPassFilter.java index aa0c55d6341e..7ad3f930fe83 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/OutputPassFilter.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/function/OutputPassFilter.java @@ -43,7 +43,7 @@ public OutputPassFilter(String port) { @Override public Iterator call(RecordInfo input) throws Exception { //noinspection unchecked - return input.getType() == RecordType.OUTPUT && Objects.equals(port, input.getFromPort()) ? - Iterators.singletonIterator((T) input.getValue()) : Iterators.emptyIterator(); + return input.getType() == RecordType.OUTPUT && Objects.equals(port, input.getFromPort()) + ? Iterators.singletonIterator((T) input.getValue()) : Iterators.emptyIterator(); } } diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/DStreamCollection.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/DStreamCollection.java index 73d18631c9fb..a0b960792d62 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/DStreamCollection.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/DStreamCollection.java @@ -150,8 +150,8 @@ public SparkCollection> aggregate(StageSpec stageSpec, @Nulla JavaPairDStream keyedCollection = stream.transformToPair( new DynamicAggregatorGroupBy(dynamicDriverContext, functionCacheFactory.newCache())); - JavaPairDStream> groupedCollection = partitions == null ? - keyedCollection.groupByKey() : keyedCollection.groupByKey(partitions); + JavaPairDStream> groupedCollection = partitions == null + ? keyedCollection.groupByKey() : keyedCollection.groupByKey(partitions); return wrap(groupedCollection.transform(new DynamicAggregatorAggregate( dynamicDriverContext, functionCacheFactory.newCache()))); diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/DefaultStreamingContext.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/DefaultStreamingContext.java index 79dd55bb27b2..19cac8649d73 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/DefaultStreamingContext.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/DefaultStreamingContext.java @@ -113,8 +113,8 @@ public void run(DatasetContext context) throws Exception { Method method = dsClass.getMethod("recordRead"); method.invoke(ds); } catch (NoSuchMethodException e) { - LOG.warn("ExternalDataset '{}' does not have method 'recordRead()'. " + - "Can't register read-only lineage for this dataset", referenceName); + LOG.warn("ExternalDataset '{}' does not have method 'recordRead()'. " + + "Can't register read-only lineage for this dataset", referenceName); } } }, DatasetManagementException.class); @@ -132,8 +132,8 @@ public void execute(int timeout, TxRunnable runnable) throws TransactionFailureE @Override public void record(List operations) { - throw new UnsupportedOperationException("Field lineage recording is not supported. Please record lineage " + - "in prepareRun() stage"); + throw new UnsupportedOperationException("Field lineage recording is not supported. Please record lineage " + + "in prepareRun() stage"); } @Override diff --git a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/function/DynamicTransform.java b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/function/DynamicTransform.java index f0f46b4268f3..52ccb07073eb 100644 --- a/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/function/DynamicTransform.java +++ b/cdap-app-templates/cdap-etl/hydrator-spark-core-base/src/main/java/io/cdap/cdap/etl/spark/streaming/function/DynamicTransform.java @@ -50,8 +50,8 @@ public DynamicTransform(DynamicDriverContext dynamicDriverContext, @Override public JavaRDD> call(JavaRDD input, Time batchTime) throws Exception { if (function == null) { - function = isMultiOutput ? - new MultiOutputTransformFunction(dynamicDriverContext.getPluginFunctionContext(), functionCache) : + function = isMultiOutput + ? new MultiOutputTransformFunction(dynamicDriverContext.getPluginFunctionContext(), functionCache) : new TransformFunction(dynamicDriverContext.getPluginFunctionContext(), functionCache); } return input.flatMap(function); diff --git a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/MockSource.java b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/MockSource.java index 3cc49748e141..38695c11af85 100644 --- a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/MockSource.java +++ b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/MockSource.java @@ -312,11 +312,11 @@ private void processsMetadata(BatchSourceContext context) throws MetadataExcepti Set operations = GSON.fromJson(config.metadataOperations, SET_METADATA_OPERATION_TYPE); // must be to fetch metadata and there should be system metadata - if (currentMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty() || - currentMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty()) { + if (currentMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty() + || currentMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty()) { throw new IllegalArgumentException( - String.format("System properties or tags for '%s' is empty. " + - "Expected to have system metadata.", metadataEntity)); + String.format("System properties or tags for '%s' is empty. " + + "Expected to have system metadata.", metadataEntity)); } LOG.trace("Metadata operations {} will be applied. Current Metadata Record is {}", operations, currentMetadata); diff --git a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/MockSourceWithReadCapability.java b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/MockSourceWithReadCapability.java index a06c7ad60e35..a0fde8e1f076 100644 --- a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/MockSourceWithReadCapability.java +++ b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/MockSourceWithReadCapability.java @@ -314,11 +314,11 @@ private void processsMetadata(BatchSourceContext context) throws MetadataExcepti Set operations = GSON.fromJson(config.metadataOperations, SET_METADATA_OPERATION_TYPE); // must be to fetch metadata and there should be system metadata - if (currentMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty() || - currentMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty()) { + if (currentMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty() + || currentMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty()) { throw new IllegalArgumentException( - String.format("System properties or tags for '%s' is empty. " + - "Expected to have system metadata.", metadataEntity)); + String.format("System properties or tags for '%s' is empty. " + + "Expected to have system metadata.", metadataEntity)); } LOG.trace("Metadata operations {} will be applied. Current Metadata Record is {}", operations, currentMetadata); diff --git a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/DupeFlagger.java b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/DupeFlagger.java index dc3eed4d9137..abfd7610f990 100644 --- a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/DupeFlagger.java +++ b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/DupeFlagger.java @@ -69,8 +69,8 @@ public void configurePipeline(MultiInputPipelineConfigurer pipelineConfigurer) { Schema schema2 = schemaIterator.next(); if (!schema1.equals(schema2)) { throw new IllegalArgumentException( - "The DupeFlagger plugin must have exactly two inputs with the same schema, " + - "but the schemas are not the same."); + "The DupeFlagger plugin must have exactly two inputs with the same schema, " + + "but the schemas are not the same."); } if (!config.containsMacro("keep")) { if (!inputSchemas.keySet().contains(config.keep)) { diff --git a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/MockAutoJoiner.java b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/MockAutoJoiner.java index 4e15a5b5bcda..89c7c2b05909 100644 --- a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/MockAutoJoiner.java +++ b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/MockAutoJoiner.java @@ -74,8 +74,8 @@ public MockAutoJoiner(Conf conf) { @Override public JoinDefinition define(AutoJoinerContext context) { if (conf.containsMacro(Conf.STAGES) || conf.containsMacro(Conf.KEY) || conf.containsMacro( - Conf.REQUIRED) || - conf.containsMacro(Conf.SELECT)) { + Conf.REQUIRED) + || conf.containsMacro(Conf.SELECT)) { return null; } diff --git a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/MockJoiner.java b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/MockJoiner.java index e0ec1fb562a3..b539c672d55c 100644 --- a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/MockJoiner.java +++ b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/batch/joiner/MockJoiner.java @@ -61,8 +61,8 @@ public MockJoiner(Config config) { private void validateInputStages(Map inputSchemas, List inputStages) { if (!inputStages.containsAll(inputSchemas.keySet())) { throw new RuntimeException( - "inputStages: " + inputStages + "doesn't have all stages in inputSchemas: " + - inputSchemas.keySet()); + "inputStages: " + inputStages + "doesn't have all stages in inputSchemas: " + + inputSchemas.keySet()); } } @@ -186,8 +186,8 @@ private void validateConfig(Map inputSchemas, FailureCollector c .omitEmptyStrings().split(perStageKey)); if (stageKey.size() != 2) { collector.addFailure( - String.format("Join key is not specified in stageName.columnName " + - "format for key %s", perStageKey), + String.format("Join key is not specified in stageName.columnName " + + "format for key %s", perStageKey), "Make sure syntax for joinKeys config property is correct") .withConfigProperty("joinKeys"); } else { @@ -226,7 +226,8 @@ private void validateConfig(Map inputSchemas, FailureCollector c } /** - * Converts join keys to map of per stage join keys For example, customers.id=items.cust_id&customers.name=items.cust_name + * Converts join keys to map of per stage join keys For example, + * customers.id=items.cust_id&customers.name=items.cust_name * will get converted to customers -> (id,name) and items -> (cust_id,cust_name) * * @return map of stage to join key fields from that stage diff --git a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/spark/compute/StringValueFilterCompute.java b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/spark/compute/StringValueFilterCompute.java index 4723e9cafafc..e25ede4bb9ab 100644 --- a/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/spark/compute/StringValueFilterCompute.java +++ b/cdap-app-templates/cdap-etl/hydrator-test/src/main/java/io/cdap/cdap/etl/mock/spark/compute/StringValueFilterCompute.java @@ -70,18 +70,18 @@ public void initialize(SparkExecutionPluginContext context) throws Exception { interpreter = context.createSparkInterpreter(); interpreter.compile( - "package test\n" + - "import io.cdap.cdap.api.data.format._\n" + - "import org.apache.spark._\n" + - "import org.apache.spark.api.java._\n" + - "import org.apache.spark.rdd._\n" + - "object Compute {\n" + - " def compute(rdd: RDD[StructuredRecord]): JavaRDD[StructuredRecord] = {\n" + - " val value = \"" + conf.value + "\"\n" + - " val field = \"" + conf.field + "\"\n" + - " JavaRDD.fromRDD(rdd.filter(r => !value.equals(r.get(field))))\n" + - " }\n" + - "}" + "package test\n" + + "import io.cdap.cdap.api.data.format._\n" + + "import org.apache.spark._\n" + + "import org.apache.spark.api.java._\n" + + "import org.apache.spark.rdd._\n" + + "object Compute {\n" + + " def compute(rdd: RDD[StructuredRecord]): JavaRDD[StructuredRecord] = {\n" + + " val value = \"" + conf.value + "\"\n" + + " val field = \"" + conf.field + "\"\n" + + " JavaRDD.fromRDD(rdd.filter(r => !value.equals(r.get(field))))\n" + + " }\n" + + "}" ); computeMethod = interpreter.getClassLoader().loadClass("test.Compute") diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/ReportGenerationSpark.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/ReportGenerationSpark.java index 0e9f9dbb5641..d373c71c0b09 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/ReportGenerationSpark.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/ReportGenerationSpark.java @@ -425,8 +425,8 @@ public void getReportStatus(HttpServiceRequest request, HttpServiceResponder res } catch (IOException e) { LOG.error("Failed to check whether the location of report with {} exists", idMessage, e); responder.sendError(500, - String.format("Failed to check whether the location of report with %s exists" + - " because of error: %s", idMessage, e.getMessage())); + String.format("Failed to check whether the location of report with %s exists" + + " because of error: %s", idMessage, e.getMessage())); return; } ReportGenerationInfo reportGenerationInfo; @@ -437,8 +437,8 @@ public void getReportStatus(HttpServiceRequest request, HttpServiceResponder res reportGenerationInfo = getReportGenerationInfo(reportId, reportIdDir); } catch (Exception e) { LOG.error("Failed to get the status for report with {}.", idMessage, e); - responder.sendError(500, String.format("Failed to get the status for report with %s" + - " because of error: %s", idMessage, e.getMessage())); + responder.sendError(500, String.format("Failed to get the status for report with %s" + + " because of error: %s", idMessage, e.getMessage())); return; } // expired report is considered as deleted @@ -577,8 +577,8 @@ public void deleteReport(HttpServiceRequest request, HttpServiceResponder respon } catch (IOException e) { LOG.error("Failed to access the directory of the report with id {}", reportId, e); responder.sendError(500, - String.format("Failed to access the directory of the report with id %s " + - "because of error: %s", reportId, e.getMessage())); + String.format("Failed to access the directory of the report with id %s " + + "because of error: %s", reportId, e.getMessage())); return; } ReportStatus status; @@ -601,8 +601,8 @@ public void deleteReport(HttpServiceRequest request, HttpServiceResponder respon if (!reportIdDir.delete(true)) { // this should never happen since the directory is asserted to exist with valid path before reaching here responder.sendError(500, - String.format("Failed to delete report with id %s because the directory %s " + - "does not exist or the path is invalid", reportId, + String.format("Failed to delete report with id %s because the directory %s " + + "does not exist or the path is invalid", reportId, reportIdDir.toURI().toString())); return; } @@ -632,8 +632,8 @@ public void saveReport(HttpServiceRequest request, HttpServiceResponder responde } catch (IOException e) { LOG.error("Failed to access the directory of the report with id {}", reportId, e); responder.sendError(500, - String.format("Failed to access the directory of the report with id %s " + - "because of error: %s", reportId, e.getMessage())); + String.format("Failed to access the directory of the report with id %s " + + "because of error: %s", reportId, e.getMessage())); return; } ReportStatus status; @@ -668,13 +668,13 @@ public void saveReport(HttpServiceRequest request, HttpServiceResponder responde GSON.fromJson(readStringFromFile(reportIdDir.append(SAVED_FILE)), REPORT_SAVE_REQUEST_TYPE); responder.sendError(403, - String.format("Report with id %s is already saved with name '%s' " + - "and description '%s'. Updating the saved report is not allowed.", + String.format("Report with id %s is already saved with name '%s' " + + "and description '%s'. Updating the saved report is not allowed.", reportId, saveRequest.getName(), saveRequest.getDescription())); return; } catch (Exception e) { - LOG.warn("Failed to parse the content of the existing report saving request in {}. " + - "Will overwrite with the new saving request.", savedFile.toURI().toString(), e); + LOG.warn("Failed to parse the content of the existing report saving request in {}. " + + "Will overwrite with the new saving request.", savedFile.toURI().toString(), e); } } } catch (Exception e) { @@ -694,15 +694,15 @@ public void saveReport(HttpServiceRequest request, HttpServiceResponder responde try { if (!savedFile.createNew()) { responder.sendError(500, - String.format("Failed to create a file %s for saving the report with id %s " + - "since it already exists", savedFile.toURI().toString(), reportId)); + String.format("Failed to create a file %s for saving the report with id %s " + + "since it already exists", savedFile.toURI().toString(), reportId)); return; } } catch (IOException e) { LOG.error("Failed to save the report {} when creating the file {}", reportId, savedFile.toURI().toString(), e); - responder.sendError(500, String.format("Failed to save the report %s because of error in " + - "creating the file %s: %s", + responder.sendError(500, String.format("Failed to save the report %s because of error in " + + "creating the file %s: %s", reportId, savedFile.toURI().toString(), e.getMessage())); return; } @@ -713,14 +713,14 @@ public void saveReport(HttpServiceRequest request, HttpServiceResponder responde } catch (IOException e) { LOG.error("Failed to save the report {} when writing to the file", reportId, savedFile.toURI().toString(), e); - responder.sendError(500, String.format("Failed to save the report %s because of error " + - "in writing to the file %s: %s", + responder.sendError(500, String.format("Failed to save the report %s because of error " + + "in writing to the file %s: %s", reportId, savedFile.toURI().toString(), e.getMessage())); return; } responder.sendString(200, - String.format("Report with id %s is saved successfully with the name: '%s' " + - "and description: '%s' ", reportId, saveRequest.getName(), + String.format("Report with id %s is saved successfully with the name: '%s' " + + "and description: '%s' ", reportId, saveRequest.getName(), saveRequest.getDescription()), StandardCharsets.UTF_8); } diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/Notification.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/Notification.java index 321930b0133f..f30422cdb82f 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/Notification.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/Notification.java @@ -66,9 +66,9 @@ public int hashCode() { @Override public String toString() { - return "Notification{" + - "notificationType=" + notificationType + - ", properties=" + properties + - '}'; + return "Notification{" + + "notificationType=" + notificationType + + ", properties=" + properties + + '}'; } } diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/RunMetaFileManager.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/RunMetaFileManager.java index cdc97f05cf8b..48da7d7c8b7b 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/RunMetaFileManager.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/RunMetaFileManager.java @@ -58,12 +58,12 @@ public class RunMetaFileManager { RunMetaFileManager(Location baseLocation, Map runtimeArguments, Metrics metrics) { this.namespaceToLogFileStreamMap = new HashMap<>(); this.baseLocation = baseLocation; - this.syncIntervalBytes = runtimeArguments.containsKey(SYNC_INTERVAL) ? - Integer.parseInt(runtimeArguments.get(SYNC_INTERVAL)) : DEFAULT_SYNC_INTERVAL_BYTES; - this.maxFileSizeBytes = runtimeArguments.containsKey(MAX_FILE_SIZE_BYTES) ? - Integer.parseInt(runtimeArguments.get(MAX_FILE_SIZE_BYTES)) : DEFAULT_MAX_FILE_SIZE_BYTES; - this.maxFileOpenDurationMillis = runtimeArguments.containsKey(MAX_FILE_OPEN_DURATION_MILLIS) ? - Integer.parseInt(runtimeArguments.get(MAX_FILE_OPEN_DURATION_MILLIS)) + this.syncIntervalBytes = runtimeArguments.containsKey(SYNC_INTERVAL) + ? Integer.parseInt(runtimeArguments.get(SYNC_INTERVAL)) : DEFAULT_SYNC_INTERVAL_BYTES; + this.maxFileSizeBytes = runtimeArguments.containsKey(MAX_FILE_SIZE_BYTES) + ? Integer.parseInt(runtimeArguments.get(MAX_FILE_SIZE_BYTES)) : DEFAULT_MAX_FILE_SIZE_BYTES; + this.maxFileOpenDurationMillis = runtimeArguments.containsKey(MAX_FILE_OPEN_DURATION_MILLIS) + ? Integer.parseInt(runtimeArguments.get(MAX_FILE_OPEN_DURATION_MILLIS)) : DEFAULT_MAX_FILE_OPEN_DURATION; this.lastSyncTime = System.currentTimeMillis(); this.metrics = metrics; diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/TMSSubscriber.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/TMSSubscriber.java index 3dc12907bef0..c95cd3d3a906 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/TMSSubscriber.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/main/TMSSubscriber.java @@ -56,8 +56,8 @@ public class TMSSubscriber extends Thread { isStopped = false; this.baseLocation = baseLocation; this.runMetaFileManager = new RunMetaFileManager(baseLocation, runtimeArguments, metrics); - this.fetchSize = runtimeArguments.containsKey(FETCH_SIZE) ? - Integer.parseInt(runtimeArguments.get(FETCH_SIZE)) : DEFAULT_FETCH_SIZE; + this.fetchSize = runtimeArguments.containsKey(FETCH_SIZE) + ? Integer.parseInt(runtimeArguments.get(FETCH_SIZE)) : DEFAULT_FETCH_SIZE; this.metrics = metrics; } diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/RangeFilter.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/RangeFilter.java index 81af6010d527..bf5b9d9ab4b1 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/RangeFilter.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/RangeFilter.java @@ -78,10 +78,10 @@ public String getError() { @Override public String toString() { - return "RangeFilter{" + - "fieldName=" + getFieldName() + - ", range=" + range + - '}'; + return "RangeFilter{" + + "fieldName=" + getFieldName() + + ", range=" + range + + '}'; } /** @@ -120,10 +120,10 @@ public T getMax() { @Override public String toString() { - return "Range{" + - "min=" + min + - ", max=" + max + - '}'; + return "Range{" + + "min=" + min + + ", max=" + max + + '}'; } @Override @@ -140,8 +140,8 @@ public boolean equals(Object o) { return false; } Range that = (Range) o; - return Objects.equals(this.min, that.min) && - Objects.equals(this.max, that.max); + return Objects.equals(this.min, that.min) + && Objects.equals(this.max, that.max); } } diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ReportContent.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ReportContent.java index 42df6183f5e1..21fc6aba51f0 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ReportContent.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ReportContent.java @@ -65,12 +65,12 @@ public List getDetails() { } public String toJson() { - return "{" + - "\"offset\":" + offset + - ", \"limit\":" + limit + - ", \"total\":" + total + - ", \"details\":" + details + - // directly return details as JSON objects without stringifying them + return "{" + + "\"offset\":" + offset + + ", \"limit\":" + limit + + ", \"total\":" + total + + ", \"details\":" + details + + // directly return details as JSON objects without stringifying them '}'; } } diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ReportGenerationRequest.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ReportGenerationRequest.java index 9eda608c9807..089091060200 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ReportGenerationRequest.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ReportGenerationRequest.java @@ -199,11 +199,11 @@ public boolean equals(Object o) { } ReportGenerationRequest that = (ReportGenerationRequest) o; - return Objects.equals(this.name, that.name) && - Objects.equals(this.start, that.start) && - Objects.equals(this.end, that.end) && - Objects.equals(this.fields, that.fields) && - Objects.equals(this.sort, that.sort) && - Objects.equals(this.filters, that.filters); + return Objects.equals(this.name, that.name) + && Objects.equals(this.start, that.start) + && Objects.equals(this.end, that.end) + && Objects.equals(this.fields, that.fields) + && Objects.equals(this.sort, that.sort) + && Objects.equals(this.filters, that.filters); } } diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/Sort.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/Sort.java index 4cff3b220741..93fcbbf68e77 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/Sort.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/Sort.java @@ -64,10 +64,10 @@ public String getError() { @Override public String toString() { - return "Sort{" + - "fieldName=" + getFieldName() + - ", order=" + order + - '}'; + return "Sort{" + + "fieldName=" + getFieldName() + + ", order=" + order + + '}'; } /** diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ValueFilter.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ValueFilter.java index b3b18de839ef..af6d11bfc948 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ValueFilter.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/ValueFilter.java @@ -84,11 +84,11 @@ public boolean apply(T value) { @Override public String toString() { - return "ValueFilter{" + - "fieldName=" + getFieldName() + - ", whitelist=" + whitelist + - ", blacklist=" + blacklist + - '}'; + return "ValueFilter{" + + "fieldName=" + getFieldName() + + ", whitelist=" + whitelist + + ", blacklist=" + blacklist + + '}'; } @Override @@ -110,7 +110,7 @@ public boolean equals(Object o) { } ValueFilter that = (ValueFilter) o; - return Objects.equals(this.whitelist, that.whitelist) && - Objects.equals(this.blacklist, that.blacklist); + return Objects.equals(this.whitelist, that.whitelist) + && Objects.equals(this.blacklist, that.blacklist); } } diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/ArtifactAggregate.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/ArtifactAggregate.java index 8af34f337bb7..1f880e142610 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/ArtifactAggregate.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/ArtifactAggregate.java @@ -68,9 +68,9 @@ public boolean equals(Object o) { } ArtifactAggregate that = (ArtifactAggregate) o; - return Objects.equal(name, that.name) && - Objects.equal(version, that.version) && - Objects.equal(scope, that.scope); + return Objects.equal(name, that.name) + && Objects.equal(version, that.version) + && Objects.equal(scope, that.scope); } @Override diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/DurationStats.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/DurationStats.java index cef24000f5dc..70f77406ee20 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/DurationStats.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/DurationStats.java @@ -64,9 +64,9 @@ public boolean equals(Object o) { } DurationStats that = (DurationStats) o; - return Objects.equal(min, that.min) && - Objects.equal(max, that.max) && - Objects.equal(average, that.average); + return Objects.equal(min, that.min) + && Objects.equal(max, that.max) + && Objects.equal(average, that.average); } @Override diff --git a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/StartStats.java b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/StartStats.java index c8d91a7f617b..74b3109db66b 100644 --- a/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/StartStats.java +++ b/cdap-app-templates/cdap-program-report/src/main/java/io/cdap/cdap/report/proto/summary/StartStats.java @@ -55,8 +55,8 @@ public boolean equals(Object o) { } StartStats that = (StartStats) o; - return Objects.equal(oldest, that.oldest) && - Objects.equal(newest, that.newest); + return Objects.equal(oldest, that.oldest) + && Objects.equal(newest, that.newest); } @Override diff --git a/cdap-app-templates/cdap-program-report/src/test/java/io/cdap/cdap/report/ReportGenerationAppTest.java b/cdap-app-templates/cdap-program-report/src/test/java/io/cdap/cdap/report/ReportGenerationAppTest.java index 86cd2f557c22..26aa303f6ff5 100644 --- a/cdap-app-templates/cdap-program-report/src/test/java/io/cdap/cdap/report/ReportGenerationAppTest.java +++ b/cdap-app-templates/cdap-program-report/src/test/java/io/cdap/cdap/report/ReportGenerationAppTest.java @@ -462,8 +462,8 @@ private void validateReportContent(URL reportRunsURL) throws IOException { boolean startMethodIsCorrect = reportContent.getDetails().stream().allMatch(content -> content.contains("\"startMethod\":\"TRIGGERED\"")); if (!startMethodIsCorrect) { - Assert.fail("All report records are expected to contain startMethod TRIGGERED, " + - "but actual results do not meet this requirement: " + reportContent.getDetails()); + Assert.fail("All report records are expected to contain startMethod TRIGGERED, " + + "but actual results do not meet this requirement: " + reportContent.getDetails()); } } @@ -487,7 +487,8 @@ private static T getResponseObject(URLConnection urlConnection, Type typeOfT * @param currentTime the current time in millis */ private static void populateMetaFiles(Location metaBaseLocation, Long currentTime) throws Exception { - DatumWriter datumWriter = new GenericDatumWriter<>(ProgramRunInfoSerializer.SCHEMA); + DatumWriter datumWriter = new GenericDatumWriter<>( + ProgramRunInfoSerializer.SCHEMA); DataFileWriter dataFileWriter = new DataFileWriter<>(datumWriter); String appName = "Pipeline"; String version = "-SNAPSHOT"; @@ -495,15 +496,15 @@ private static void populateMetaFiles(Location metaBaseLocation, Long currentTim String program1 = "SmartWorkflow_1"; String program2 = "SmartWorkflow_2"; // add a schedule info with program status trigger - String scheduleInfo = "{\"name\": \"sched\",\"description\": \"desc\",\"triggerInfos\": [" + - "{\"namespace\": \"default\",\"application\": \"app\",\"version\": \"-SNAPSHOT\",\"programType\": \"WORKFLOW\"," + - "\"run\":\"randomRunId\",\"entity\": \"PROGRAM\",\"program\": \"wf\",\"programStatus\": \"KILLED\"," + - "\"type\": \"PROGRAM_STATUS\"}]}"; + String scheduleInfo = "{\"name\": \"sched\",\"description\": \"desc\",\"triggerInfos\": [" + + "{\"namespace\": \"default\",\"application\": \"app\",\"version\": \"-SNAPSHOT\"," + + "\"programType\": \"WORKFLOW\",\"run\":\"randomRunId\",\"entity\": \"PROGRAM\"," + + "\"program\": \"wf\",\"programStatus\": \"KILLED\",\"type\": \"PROGRAM_STATUS\"}]}"; ProgramStartInfo startInfo = - new ProgramStartInfo(ImmutableMap.of(), - new ArtifactId(TEST_ARTIFACT_NAME, - new ArtifactVersion("1.0.0"), ArtifactScope.USER), USER_ALICE, - ImmutableMap.of(Constants.Notification.SCHEDULE_INFO_KEY, scheduleInfo)); + new ProgramStartInfo(ImmutableMap.of(), + new ArtifactId(TEST_ARTIFACT_NAME, + new ArtifactVersion("1.0.0"), ArtifactScope.USER), USER_ALICE, + ImmutableMap.of(Constants.Notification.SCHEDULE_INFO_KEY, scheduleInfo)); long delay = TimeUnit.MINUTES.toMillis(5); int mockMessageId = 0; for (String namespace : ImmutableList.of("default", "ns1", "ns2")) { diff --git a/cdap-cli-tests/src/test/java/io/cdap/cdap/cli/CLITestBase.java b/cdap-cli-tests/src/test/java/io/cdap/cdap/cli/CLITestBase.java index 3299735cb383..d2179487ecc2 100644 --- a/cdap-cli-tests/src/test/java/io/cdap/cdap/cli/CLITestBase.java +++ b/cdap-cli-tests/src/test/java/io/cdap/cdap/cli/CLITestBase.java @@ -394,21 +394,23 @@ public void testDataset() throws Exception { CLIConfig cliConfig = getCliConfig(); DatasetTypeClient datasetTypeClient = new DatasetTypeClient(cliConfig.getClientConfig()); DatasetTypeMeta datasetType = datasetTypeClient.list(NamespaceId.DEFAULT).get(0); - testCommandOutputContains("create dataset instance " + datasetType.getName() + " " + datasetName + " \"a=1\"", - "Successfully created dataset"); + testCommandOutputContains( + "create dataset instance " + datasetType.getName() + " " + datasetName + " \"a=1\"", + "Successfully created dataset"); testCommandOutputContains("list dataset instances", FakeDataset.class.getSimpleName()); testCommandOutputContains("get dataset instance properties " + datasetName, "a,1"); // test dataset creation with owner - String commandOutput = getCommandOutput("create dataset instance " + datasetType.getName() + " " + - ownedDatasetName + " \"a=1\"" + " " + "someDescription " + - ArgumentName.PRINCIPAL + - " alice/somehost.net@somekdc.net"); + String commandOutput = getCommandOutput("create dataset instance " + datasetType.getName() + " " + + ownedDatasetName + " \"a=1\"" + " " + "someDescription " + + ArgumentName.PRINCIPAL + + " alice/somehost.net@somekdc.net"); Assert.assertTrue(commandOutput.contains("Successfully created dataset")); Assert.assertTrue(commandOutput.contains("alice/somehost.net@somekdc.net")); // test describing the table returns the given owner information - testCommandOutputContains("describe dataset instance " + ownedDatasetName, "alice/somehost.net@somekdc.net"); + testCommandOutputContains("describe dataset instance " + ownedDatasetName, + "alice/somehost.net@somekdc.net"); NamespaceClient namespaceClient = new NamespaceClient(cliConfig.getClientConfig()); NamespaceId barspace = new NamespaceId("bar"); @@ -424,19 +426,22 @@ public void testDataset() throws Exception { testCommandOutputContains("use namespace default", "Now using namespace 'default'"); try { - testCommandOutputContains("truncate dataset instance " + datasetName, "Successfully truncated"); + testCommandOutputContains("truncate dataset instance " + datasetName, + "Successfully truncated"); } finally { testCommandOutputContains("delete dataset instance " + datasetName, "Successfully deleted"); } String datasetName2 = PREFIX + "asoijm39485"; String description = "test-description-for-" + datasetName2; - testCommandOutputContains("create dataset instance " + datasetType.getName() + " " + datasetName2 + - " \"a=1\"" + " " + description, - "Successfully created dataset"); + testCommandOutputContains( + "create dataset instance " + datasetType.getName() + " " + datasetName2 + + " \"a=1\"" + " " + description, + "Successfully created dataset"); testCommandOutputContains("list dataset instances", description); testCommandOutputContains("delete dataset instance " + datasetName2, "Successfully deleted"); - testCommandOutputContains("delete dataset instance " + ownedDatasetName, "Successfully deleted"); + testCommandOutputContains("delete dataset instance " + ownedDatasetName, + "Successfully deleted"); } @Test @@ -598,24 +603,26 @@ public void testNamespaces() throws Exception { // describe non-existing namespace testCommandOutputContains(String.format("describe namespace %s", doesNotExist), - String.format("Error: 'namespace:%s' was not found", doesNotExist)); + String.format("Error: 'namespace:%s' was not found", doesNotExist)); // delete non-existing namespace // TODO: uncomment when fixed - this makes build hang since it requires confirmation from user // testCommandOutputContains(String.format("delete namespace %s", doesNotExist), // String.format("Error: namespace '%s' was not found", doesNotExist)); // create a namespace - String command = String.format("create namespace %s description %s principal %s group-name %s keytab-URI %s " + - "hbase-namespace %s hive-database %s root-directory %s %s %s", - name, description, principal, group, keytab, hbaseNamespace, - hiveDatabase, rootDirectory, ArgumentName.NAMESPACE_SCHEDULER_QUEUENAME, - schedulerQueueName); + String command = String.format( + "create namespace %s description %s principal %s group-name %s keytab-URI %s " + + "hbase-namespace %s hive-database %s root-directory %s %s %s", + name, description, principal, group, keytab, hbaseNamespace, + hiveDatabase, rootDirectory, ArgumentName.NAMESPACE_SCHEDULER_QUEUENAME, + schedulerQueueName); testCommandOutputContains(command, String.format("Namespace '%s' created successfully.", name)); NamespaceMeta expected = new NamespaceMeta.Builder() - .setName(name).setDescription(description).setPrincipal(principal).setGroupName(group).setKeytabURI(keytab) - .setHBaseNamespace(hbaseNamespace).setSchedulerQueueName(schedulerQueueName) - .setHiveDatabase(hiveDatabase).setRootDirectory(rootDirectory).build(); + .setName(name).setDescription(description).setPrincipal(principal).setGroupName(group) + .setKeytabURI(keytab) + .setHBaseNamespace(hbaseNamespace).setSchedulerQueueName(schedulerQueueName) + .setHiveDatabase(hiveDatabase).setRootDirectory(rootDirectory).build(); expectedNamespaces = Lists.newArrayList(defaultNs, expected); // list namespaces and verify testNamespacesOutput("list namespaces", expectedNamespaces); @@ -709,9 +716,12 @@ public void testWorkflows() throws Exception { testCommandOutputContains(String.format("get workflow schedules %s", workflow), "0 4 * * *"); testCommandOutputContains( - String.format("update time schedule %s for workflow %s version %s description \"testdesc\" at \"* * * * *\" " + - "concurrency 4 properties \"key=value\"", FakeWorkflow.SCHEDULE, workflow, V1_SNAPSHOT), - String.format("Successfully updated schedule '%s' in app '%s'", FakeWorkflow.SCHEDULE, FakeApp.NAME)); + String.format( + "update time schedule %s for workflow %s version %s description \"testdesc\" at \"* * * * *\" " + + "concurrency 4 properties \"key=value\"", FakeWorkflow.SCHEDULE, workflow, + V1_SNAPSHOT), + String.format("Successfully updated schedule '%s' in app '%s'", FakeWorkflow.SCHEDULE, + FakeApp.NAME)); testCommandOutputContains(String.format("get workflow schedules %s", workflow), "* * * * *"); testCommandOutputContains(String.format("get workflow schedules %s", workflow), "testdesc"); testCommandOutputContains(String.format("get workflow schedules %s", workflow), "{\"key\":\"value\"}"); diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/ArgumentName.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/ArgumentName.java index 8f20b253c383..b99b2efccc16 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/ArgumentName.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/ArgumentName.java @@ -140,38 +140,38 @@ public String toString() { return name; } - public static final String ENTITY_DESCRIPTION_TEMPLATE_STRING = "<%s> " + - "is of the form :, where is one of " + - "%s" + - "'artifact', 'application', 'dataset' or 'program'.\n" + - "\n" + - "%s" + - "For artifacts and apps, " + - " is composed of the namespace, entity name, and version, such as " + - ".. or " + - "...\n" + - "\n" + - "Note: Metadata for versioned entities is not versioned, including entities such as applications, " - + - "programs, schedules, and program runs. Additions to metadata in one version are reflected in all versions.\n" - + - "\n" + - "For programs, includes the " + - "application name and the program type: " + - ".... is one of " + - "mapreduce, service, spark, worker, or workflow.\n" + - "\n" + - "For datasets, " + - " is the namespace and entity names, such as ..\n" + - "\n" + - "Custom entities can be specified as hierarchical key-value pair with an optional type if the last key in " - + - "hierarchy is not the type of the entity. For example a 'field' in dataset can be specified as: " - + - "namespace=,dataset=,field=." + - "\n" + - "A 'jar' in a namespace can be specified as: " + - "namespace=,jar=,version=,type=jar."; + public static final String ENTITY_DESCRIPTION_TEMPLATE_STRING = "<%s> " + + "is of the form :, where is one of " + + "%s" + + "'artifact', 'application', 'dataset' or 'program'.\n" + + "\n" + + "%s" + + "For artifacts and apps, " + + " is composed of the namespace, entity name, and version, such as " + + ".. or " + + "...\n" + + "\n" + + "Note: Metadata for versioned entities is not versioned, including entities such as applications, " + + + "programs, schedules, and program runs. Additions to metadata in one version are reflected in all versions.\n" + + + "\n" + + "For programs, includes the " + + "application name and the program type: " + + ".... is one of " + + "mapreduce, service, spark, worker, or workflow.\n" + + "\n" + + "For datasets, " + + " is the namespace and entity names, such as ..\n" + + "\n" + + "Custom entities can be specified as hierarchical key-value pair with an optional type if the last key in " + + + "hierarchy is not the type of the entity. For example a 'field' in dataset can be specified as: " + + + "namespace=,dataset=,field=." + + "\n" + + "A 'jar' in a namespace can be specified as: " + + "namespace=,jar=,version=,type=jar."; public static final String ENTITY_DESCRIPTION_STRING = String.format( ENTITY_DESCRIPTION_TEMPLATE_STRING, @@ -180,13 +180,13 @@ public String toString() { public static final String ENTITY_DESCRIPTION_ALL_STRING = String.format( ENTITY_DESCRIPTION_TEMPLATE_STRING, ENTITY, "'namespace', ", - "For namespaces, '' is composed from the namespace, such as " + - "'namespace:'.\n" + - "\n"); + "For namespaces, '' is composed from the namespace, such as " + + "'namespace:'.\n" + + "\n"); public static final String ENTITY_DESCRIPTION_PERMISSIONS = - "'' is a comma-separated list of " + - "privileges, any of 'GET', 'CREATE', 'UPDATE', 'DELETE', 'LIST', 'APPLICATION.EXECUTE', " + "'' is a comma-separated list of " + + "privileges, any of 'GET', 'CREATE', 'UPDATE', 'DELETE', 'LIST', 'APPLICATION.EXECUTE', " + "'APPLICATION.PREVIEW', 'ACCESS.SET_OWNER' or 'ACCESS.IMPERSONATE'"; } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/CLIMain.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/CLIMain.java index 085ac7f1f62e..0829c08dd291 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/CLIMain.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/CLIMain.java @@ -83,22 +83,22 @@ public class CLIMain { private static final Option URI_OPTION = new Option( "u", "uri", true, - "(Deprecated. Please use option --link instead). CDAP instance URI to interact with in" + - " the format \"[http[s]://][:[/]]\"." + - " Defaults to \"" + getDefaultURI().toString() + "\"."); + "(Deprecated. Please use option --link instead). CDAP instance URI to interact with in" + + " the format \"[http[s]://][:[/]]\"." + + " Defaults to \"" + getDefaultURI().toString() + "\"."); private static final Option LINK_OPTION = new Option( - "l", "link", true, "CDAP instance URI to interact with in" + - " the format \"[http[s]://][:][/]\" ." + - " Defaults to \"" + getDefaultURI().toString() + "\"."); + "l", "link", true, "CDAP instance URI to interact with in" + + " the format \"[http[s]://][:][/]\" ." + + " Defaults to \"" + getDefaultURI().toString() + "\"."); private static final Option NAMESPACE_OPTION = new Option( - "n", "namespace", true, "CDAP Instance Namespace to connect to" + - " Defaults to \"" + NamespaceId.DEFAULT.getNamespace() + "\"."); + "n", "namespace", true, "CDAP Instance Namespace to connect to" + + " Defaults to \"" + NamespaceId.DEFAULT.getNamespace() + "\"."); private static final Option VERIFY_SSL_OPTION = new Option( - "v", "verify-ssl", true, "If \"true\", verify SSL certificate when making requests." + - " Defaults to \"" + DEFAULT_VERIFY_SSL + "\"."); + "v", "verify-ssl", true, "If \"true\", verify SSL certificate when making requests." + + " Defaults to \"" + DEFAULT_VERIFY_SSL + "\"."); private static final Option RETRIES_OPTION = new Option( "r", "retries", true, @@ -107,10 +107,10 @@ public class CLIMain { @VisibleForTesting static final Option AUTOCONNECT_OPTION = new Option( - "a", "autoconnect", true, "If \"true\", try provided connection" + - " (from " + URI_OPTION.getLongOpt() + ")" + - " upon launch or try default connection if none provided." + - " Defaults to \"" + DEFAULT_AUTOCONNECT + "\"."); + "a", "autoconnect", true, "If \"true\", try provided connection" + + " (from " + URI_OPTION.getLongOpt() + ")" + + " upon launch or try default connection if none provided." + + " Defaults to \"" + DEFAULT_AUTOCONNECT + "\"."); private static final Option DEBUG_OPTION = new Option( "d", "debug", false, "Print exception stack traces."); @@ -204,9 +204,10 @@ public boolean tryAutoconnect(CommandLine command) { String uri = options.getUri(); boolean uriParamEmpty = uri == null || uri.isEmpty(); CLIConnectionConfig connection = - uriParamEmpty ? - instanceURIParser.parseInstanceURI(options.getInstanceURI(), options.getNamespace()) : - instanceURIParser.parse(uri); + uriParamEmpty + ? instanceURIParser.parseInstanceURI(options.getInstanceURI(), options.getNamespace()) + : + instanceURIParser.parse(uri); if (!uriParamEmpty) { cliConfig.getOutput().println("-u option is deprecated. Use -l instead. "); } @@ -387,15 +388,15 @@ private static void usage() { String toolName = "cdap" + (OSDetector.isWindows() ? ".bat " : " ") + TOOL_NAME; HelpFormatter formatter = new HelpFormatter(); String args = - "[--autoconnect ] " + - "[--debug] " + - "[--help] " + - "[--verify-ssl ] " + - "[--uri ] " + - "[--link ] " + - "[--namespace ] " + - "[--script ] " + - "[-r | --retries N]"; + "[--autoconnect ] " + + "[--debug] " + + "[--help] " + + "[--verify-ssl ] " + + "[--uri ] " + + "[--link ] " + + "[--namespace ] " + + "[--script ] " + + "[-r | --retries N]"; formatter.printHelp(toolName + " " + args, getOptions()); System.exit(0); } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/CLIMainArgs.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/CLIMainArgs.java index 21e530d7ba3e..94ce374a66eb 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/CLIMainArgs.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/CLIMainArgs.java @@ -57,8 +57,8 @@ public boolean equals(Object obj) { return false; } final CLIMainArgs other = (CLIMainArgs) obj; - return Arrays.equals(this.optionTokens, other.optionTokens) && - Arrays.equals(this.commandTokens, other.commandTokens); + return Arrays.equals(this.optionTokens, other.optionTokens) + && Arrays.equals(this.commandTokens, other.commandTokens); } @Override diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/ProgramIdArgument.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/ProgramIdArgument.java index a5b652e40dee..dc76a22e3791 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/ProgramIdArgument.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/ProgramIdArgument.java @@ -49,8 +49,8 @@ public boolean equals(Object o) { } ProgramIdArgument other = (ProgramIdArgument) o; - return Objects.equal(appId, other.getAppId()) && - Objects.equal(programId, other.getProgramId()); + return Objects.equal(appId, other.getAppId()) + && Objects.equal(programId, other.getProgramId()); } @Override diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CallServiceCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CallServiceCommand.java index 3567f91640c1..39c98c012f63 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CallServiceCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CallServiceCommand.java @@ -79,8 +79,8 @@ public void perform(Arguments arguments, PrintStream output) throws Exception { Preconditions.checkNotNull(bodyString); Preconditions.checkNotNull(bodyFile); if (!bodyString.isEmpty() && !bodyFile.isEmpty()) { - String message = String.format("Please provide either [body <%s>] or [body:file <%s>], " + - "but not both", ArgumentName.HTTP_BODY.toString(), + String message = String.format("Please provide either [body <%s>] or [body:file <%s>], " + + "but not both", ArgumentName.HTTP_BODY.toString(), ArgumentName.LOCAL_FILE_PATH.toString()); throw new CommandInputError(this, message); } @@ -88,8 +88,8 @@ public void perform(Arguments arguments, PrintStream output) throws Exception { Map headerMap = GSON.fromJson(headers, new TypeToken>() { }.getType()); ServiceId service = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); - URL url = arguments.hasArgument(ArgumentName.APP_VERSION.getName()) ? - new URL(serviceClient.getVersionedServiceURL(service), path) : + URL url = arguments.hasArgument(ArgumentName.APP_VERSION.getName()) + ? new URL(serviceClient.getVersionedServiceURL(service), path) : new URL(serviceClient.getServiceURL(service), path); HttpMethod httpMethod = HttpMethod.valueOf(method); @@ -124,10 +124,10 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Calls %s endpoint. The '<%s>' are formatted as '{\"key\":\"value\", ...}'. " + - "The request body may be provided as either a string or a file. " + - "To provide the body as a string, use 'body <%s>'. " + - "To provide the body as a file, use 'body:file <%s>'.", + "Calls %s endpoint. The '<%s>' are formatted as '{\"key\":\"value\", ...}'. " + + "The request body may be provided as either a string or a file. " + + "To provide the body as a string, use 'body <%s>'. " + + "To provide the body as a file, use 'body:file <%s>'.", Fragment.of(Article.A, ElementType.SERVICE.getName()), ArgumentName.HEADERS, ArgumentName.HTTP_BODY, ArgumentName.LOCAL_FILE_PATH); } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CreateDatasetInstanceCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CreateDatasetInstanceCommand.java index a87f3ae2987d..fcf71a780e72 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CreateDatasetInstanceCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CreateDatasetInstanceCommand.java @@ -66,8 +66,8 @@ public void perform(Arguments arguments, PrintStream output) throws Exception { datasetClient.create(cliConfig.getCurrentNamespace().dataset(datasetName), datasetConfig); StringBuilder builder = new StringBuilder( - String.format("Successfully created dataset named '%s' with type " + - "'%s', properties '%s'", datasetName, datasetType, + String.format("Successfully created dataset named '%s' with type " + + "'%s', properties '%s'", datasetName, datasetType, GSON.toJson(datasetProperties))); if (datasetDescription != null) { builder.append(String.format(", description '%s'", datasetDescription)); @@ -89,10 +89,10 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Creates %s instance of the specified %s. Can optionally take %s, %s, or %s where '<%s>' " + - "is in the format 'key1=val1 key2=val2' and '<%s>' is the Kerberos principal of the owner " - + - "of the dataset.", Fragment.of(Article.A, ElementType.DATASET.getName()), + "Creates %s instance of the specified %s. Can optionally take %s, %s, or %s where '<%s>' " + + "is in the format 'key1=val1 key2=val2' and '<%s>' is the Kerberos principal of the owner " + + + "of the dataset.", Fragment.of(Article.A, ElementType.DATASET.getName()), ArgumentName.DATASET_TYPE, ArgumentName.DATASET_PROPERTIES, ArgumentName.DATASET_DESCRIPTON, ArgumentName.PRINCIPAL, ArgumentName.DATASET_PROPERTIES, ArgumentName.PRINCIPAL); } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CreateNamespaceCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CreateNamespaceCommand.java index ba71184d302f..3ea26e78d494 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CreateNamespaceCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/CreateNamespaceCommand.java @@ -69,8 +69,8 @@ public void perform(Arguments arguments, PrintStream output) throws Exception { @Override public String getPattern() { - return String.format("create namespace <%s> [%s <%s>] [%s <%s>] [%s <%s>] " + - "[%s <%s>] [%s <%s>] [%s <%s>] [%s <%s>] [%s <%s>]", ArgumentName.NAMESPACE_NAME, + return String.format("create namespace <%s> [%s <%s>] [%s <%s>] [%s <%s>] " + + "[%s <%s>] [%s <%s>] [%s <%s>] [%s <%s>] [%s <%s>]", ArgumentName.NAMESPACE_NAME, ArgumentName.DESCRIPTION, ArgumentName.DESCRIPTION, ArgumentName.PRINCIPAL, ArgumentName.PRINCIPAL, ArgumentName.NAMESPACE_GROUP_NAME, ArgumentName.NAMESPACE_GROUP_NAME, diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/BaseBatchCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/BaseBatchCommand.java index b6c71616121a..53661e7ef2a4 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/BaseBatchCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/BaseBatchCommand.java @@ -107,11 +107,10 @@ protected Set getDefaultProgramTypes() { } protected String getDescription(String action, String actionPlural) { - return String.format("Command to %s one or more programs of %s. " + - "By default, %s all services and workers. A comma-separated list of program types can be " + - "specified, which will %s all programs of those types. For example, specifying 'service,workflow' will %s " - + - "all services and workflows in the %s.", + return String.format("Command to %s one or more programs of %s. " + + "By default, %s all services and workers. A comma-separated list of program types can be " + + "specified, which will %s all programs of those types. For example, specifying 'service,workflow' " + + "will %s all services and workflows in the %s.", action, Fragment.of(Article.A, ElementType.APP.getName()), actionPlural, action, action, ElementType.APP.getName()); } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/CreateAppCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/CreateAppCommand.java index 280e6ac1d914..7254b8caa3ac 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/CreateAppCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/CreateAppCommand.java @@ -100,15 +100,15 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Creates %s from an artifact, optionally with a version. If the version is not given, " + - "a default version '%s' will be used. A configuration is also optional. If a " + - "configuration is needed, it must be given as a file whose contents are a JSON object " - + - "containing the application config. For example, the file contents could contain: " + - "'{ \"config\": { \"stream\": \"purchases\" } }'. In this case, the application would " - + - "receive '{ \"stream\": \"purchases\" }' as its config object. Finally, an optional " + - "principal may be given.", + "Creates %s from an artifact, optionally with a version. If the version is not given, " + + "a default version '%s' will be used. A configuration is also optional. If a " + + "configuration is needed, it must be given as a file whose contents are a JSON object " + + + "containing the application config. For example, the file contents could contain: " + + "'{ \"config\": { \"stream\": \"purchases\" } }'. In this case, the application would " + + + "receive '{ \"stream\": \"purchases\" }' as its config object. Finally, an optional " + + "principal may be given.", Fragment.of(Article.A, ElementType.APP.getName()), ApplicationId.DEFAULT_VERSION); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/DeleteAppCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/DeleteAppCommand.java index 7b02b141486a..941ffc3b06bd 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/DeleteAppCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/DeleteAppCommand.java @@ -62,8 +62,8 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Deletes %s with an optional version. If version is not provided, default version '%s' " + - "will be used.", Fragment.of(Article.A, ElementType.APP.getName()), + "Deletes %s with an optional version. If version is not provided, default version '%s' " + + "will be used.", Fragment.of(Article.A, ElementType.APP.getName()), ApplicationId.DEFAULT_VERSION); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/DescribeAppCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/DescribeAppCommand.java index 797c33a7562c..fe4e8fba6183 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/DescribeAppCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/app/DescribeAppCommand.java @@ -72,8 +72,8 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Describes %s with an optional version. If version is not provided, default version '%s' " + - "will be used.", Fragment.of(Article.A, ElementType.APP.getName()), + "Describes %s with an optional version. If version is not provided, default version '%s' " + + "will be used.", Fragment.of(Article.A, ElementType.APP.getName()), ApplicationId.DEFAULT_VERSION); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/DescribeArtifactCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/DescribeArtifactCommand.java index e901bbfa300f..903e6afdf561 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/DescribeArtifactCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/DescribeArtifactCommand.java @@ -91,10 +91,10 @@ public String getPattern() { public String getDescription() { return String.format( "Describes %s, including information about the application and plugin classes contained in " - + - "the artifact. If no scope is provided, the artifact is looked for first in the 'SYSTEM' " - + - "and then in the 'USER' scope.", + + + "the artifact. If no scope is provided, the artifact is looked for first in the 'SYSTEM' " + + + "and then in the 'USER' scope.", Fragment.of(Article.A, ElementType.ARTIFACT.getName())); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/DescribeArtifactPluginCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/DescribeArtifactPluginCommand.java index 162f613b1fc8..d4c9bbed80cd 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/DescribeArtifactPluginCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/DescribeArtifactPluginCommand.java @@ -89,10 +89,10 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Describes a plugin of a specific type and name available to a specific %s. " + - "Can return multiple details if there are multiple versions of the plugin. If no scope is " - + - "provided, plugins are looked for first in the 'SYSTEM' and then in the 'USER' scope.", + "Describes a plugin of a specific type and name available to a specific %s. " + + "Can return multiple details if there are multiple versions of the plugin. If no scope is " + + + "provided, plugins are looked for first in the 'SYSTEM' and then in the 'USER' scope.", ElementType.ARTIFACT.getName()); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/GetArtifactPropertiesCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/GetArtifactPropertiesCommand.java index 88e06c31a35c..5ccea9e2cbee 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/GetArtifactPropertiesCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/GetArtifactPropertiesCommand.java @@ -90,8 +90,8 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Gets the properties of %s. If no scope is provided, properties are looked for first in " + - "the 'SYSTEM' and then in the 'USER' scope.", + "Gets the properties of %s. If no scope is provided, properties are looked for first in " + + "the 'SYSTEM' and then in the 'USER' scope.", Fragment.of(Article.A, ElementType.ARTIFACT.getName())); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactPluginTypesCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactPluginTypesCommand.java index c81fe4a6faca..84d0c8038243 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactPluginTypesCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactPluginTypesCommand.java @@ -79,8 +79,8 @@ public String getPattern() { @Override public String getDescription() { - return String.format("Lists all plugin types usable by the specified %s. " + - "If no scope is provided, %s are looked for first in the 'SYSTEM' and then in the 'USER' scope.", + return String.format("Lists all plugin types usable by the specified %s. " + + "If no scope is provided, %s are looked for first in the 'SYSTEM' and then in the 'USER' scope.", ElementType.ARTIFACT.getName(), ElementType.ARTIFACT.getNamePlural()); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactPluginsCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactPluginsCommand.java index bfce1ae45c60..2f569ab4a84c 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactPluginsCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactPluginsCommand.java @@ -82,10 +82,10 @@ public String getPattern() { @Override public String getDescription() { - return String.format("Lists all plugins of a specific type available to a specific %s. " + - "Returns the type, name, classname, and description of the plugin, as well as the %s the plugin came from. " - + - "If no scope is provided, %s are looked for first in the 'SYSTEM' and then in the 'USER' scope.", + return String.format("Lists all plugins of a specific type available to a specific %s. " + + "Returns the type, name, classname, and description of the plugin, as well as " + + "the %s the plugin came from. If no scope is provided, %s are looked for first " + + "in the 'SYSTEM' and then in the 'USER' scope.", ElementType.ARTIFACT.getName(), ElementType.ARTIFACT.getName(), ElementType.ARTIFACT.getNamePlural()); } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactVersionsCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactVersionsCommand.java index e84b8441f76b..0418f7167414 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactVersionsCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactVersionsCommand.java @@ -79,8 +79,8 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Lists all versions of a specific %s. If no scope is provided, %s are looked " + - "for first in the 'SYSTEM' and then in the 'USER' scope.", + "Lists all versions of a specific %s. If no scope is provided, %s are looked " + + "for first in the 'SYSTEM' and then in the 'USER' scope.", ElementType.ARTIFACT.getName(), ElementType.ARTIFACT.getNamePlural()); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactsCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactsCommand.java index 8eca4f696cd9..2c17d0944baa 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactsCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/ListArtifactsCommand.java @@ -75,8 +75,8 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Lists all %s. If no scope is provided, artifacts in all scopes are returned. " + - "Otherwise, only artifacts in the specified scope are returned.", + "Lists all %s. If no scope is provided, artifacts in all scopes are returned. " + + "Otherwise, only artifacts in the specified scope are returned.", ElementType.ARTIFACT.getNamePlural()); } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/LoadArtifactCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/LoadArtifactCommand.java index ed1d36d50568..0c28f2468743 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/LoadArtifactCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/LoadArtifactCommand.java @@ -103,35 +103,35 @@ public String getPattern() { @Override public String getDescription() { - return "Loads an artifact into CDAP. If the artifact name and version are not both given, " + - "they will be derived from the filename of the artifact. " + - "File names are expected to be of the form '-.jar'. " + - "If the artifact contains plugins that extend another artifact, or if it contains " + - "third-party plugins, a config file must be provided. " + - "The config file must contain a JSON object that specifies the parent artifacts " + - "and any third-party plugins in the JAR.\n" + - "\n" + - "For example, if there is a config file with these contents:\n" + - "\n" + - " {\n" + - " \"parents\":[ \"app1[1.0.0,2.0.0)\", \"app2[1.2.0,1.3.0] ],\n" + - " \"plugins\":[\n" + - " { \"type\": \"jdbc\",\n" + - " \"name\": \"mysql\",\n" + - " \"className\": \"com.mysql.jdbc.Driver\"\n" + - " }\n" + - " ],\n" + - " \"properties\":{\n" + - " \"prop1\": \"val1\"\n" + - " }\n" + - " }\n" + - "\n" + - "This config specifies that the artifact contains one JDBC third-party plugin that should be " - + - "available to the 'app1' artifact (versions 1.0.0 inclusive to 2.0.0 exclusive) and 'app2' artifact " - + - "(versions 1.2.0 inclusive to 1.3.0 inclusive). The config may also include a 'properties' field specifying " - + - "properties for the artifact."; + return "Loads an artifact into CDAP. If the artifact name and version are not both given, " + + "they will be derived from the filename of the artifact. " + + "File names are expected to be of the form '-.jar'. " + + "If the artifact contains plugins that extend another artifact, or if it contains " + + "third-party plugins, a config file must be provided. " + + "The config file must contain a JSON object that specifies the parent artifacts " + + "and any third-party plugins in the JAR.\n" + + "\n" + + "For example, if there is a config file with these contents:\n" + + "\n" + + " {\n" + + " \"parents\":[ \"app1[1.0.0,2.0.0)\", \"app2[1.2.0,1.3.0] ],\n" + + " \"plugins\":[\n" + + " { \"type\": \"jdbc\",\n" + + " \"name\": \"mysql\",\n" + + " \"className\": \"com.mysql.jdbc.Driver\"\n" + + " }\n" + + " ],\n" + + " \"properties\":{\n" + + " \"prop1\": \"val1\"\n" + + " }\n" + + " }\n" + + "\n" + + "This config specifies that the artifact contains one JDBC third-party plugin that should be " + + + "available to the 'app1' artifact (versions 1.0.0 inclusive to 2.0.0 exclusive) and 'app2' artifact " + + + "(versions 1.2.0 inclusive to 1.3.0 inclusive). The config may also include a 'properties' field specifying " + + + "properties for the artifact."; } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/SetArtifactPropertiesCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/SetArtifactPropertiesCommand.java index dce464d59dfa..96a69d12def5 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/SetArtifactPropertiesCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/artifact/SetArtifactPropertiesCommand.java @@ -73,9 +73,9 @@ public void perform(Arguments arguments, PrintStream output) throws Exception { properties = GSON.fromJson(reader, ArtifactProperties.class); } catch (Exception e) { throw new RuntimeException( - "Error parsing file contents. Please check that it is a valid JSON object, " + - "and that it contains a 'properties' key whose value is a JSON object of the " + - "artifact properties.", e); + "Error parsing file contents. Please check that it is a valid JSON object, " + + "and that it contains a 'properties' key whose value is a JSON object of the " + + "artifact properties.", e); } artifactClient.writeProperties(artifactId, properties.properties); } @@ -91,10 +91,10 @@ public String getPattern() { @Override public String getDescription() { return String.format( - "Sets properties of %s. " + - "The properties file must contain a JSON object with a 'properties' key whose value is a JSON object " - + - "of the properties for the artifact.", + "Sets properties of %s. " + + "The properties file must contain a JSON object with a 'properties' key whose value is a JSON object " + + + "of the properties for the artifact.", Fragment.of(Article.A, ElementType.ARTIFACT.getName())); } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/metadata/SearchMetadataCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/metadata/SearchMetadataCommand.java index f48f28dec4ab..1b0301ce1d0d 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/metadata/SearchMetadataCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/metadata/SearchMetadataCommand.java @@ -69,9 +69,9 @@ public String getPattern() { @Override public String getDescription() { - return "Searches CDAP entities based on the metadata annotated on them. " + - "The search can be restricted by adding a comma-separated list of target types: " + - "'artifact', 'app', 'dataset', 'program', 'stream', or 'view'."; + return "Searches CDAP entities based on the metadata annotated on them. " + + "The search can be restricted by adding a comma-separated list of target types: " + + "'artifact', 'app', 'dataset', 'program', 'stream', or 'view'."; } private Set parseTargetType(String typeString) { diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/schedule/AddTimeScheduleCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/schedule/AddTimeScheduleCommand.java index 210688986067..41d668336d54 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/schedule/AddTimeScheduleCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/schedule/AddTimeScheduleCommand.java @@ -92,8 +92,8 @@ public void perform(Arguments arguments, PrintStream printStream) throws Excepti @Override public String getPattern() { - return String.format("add time schedule <%s> for workflow <%s> [version <%s>] " + - "[description <%s>] at <%s> [concurrency <%s>] [properties <%s>]", + return String.format("add time schedule <%s> for workflow <%s> [version <%s>] " + + "[description <%s>] at <%s> [concurrency <%s>] [properties <%s>]", ArgumentName.SCHEDULE_NAME, ArgumentName.PROGRAM, ArgumentName.APP_VERSION, ArgumentName.DESCRIPTION, ArgumentName.CRON_EXPRESSION, ArgumentName.CONCURRENCY, ArgumentName.SCHEDULE_PROPERTIES); diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/schedule/UpdateTimeScheduleCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/schedule/UpdateTimeScheduleCommand.java index dbeecce2ad35..fab8b0f975a1 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/schedule/UpdateTimeScheduleCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/schedule/UpdateTimeScheduleCommand.java @@ -91,8 +91,8 @@ public void perform(Arguments arguments, PrintStream printStream) throws Excepti @Override public String getPattern() { - return String.format("update time schedule <%s> for workflow <%s> [version <%s>] " + - "[description <%s>] at <%s> [concurrency <%s>] [properties <%s>]", + return String.format("update time schedule <%s> for workflow <%s> [version <%s>] " + + "[description <%s>] at <%s> [concurrency <%s>] [properties <%s>]", ArgumentName.SCHEDULE_NAME, ArgumentName.PROGRAM, ArgumentName.APP_VERSION, ArgumentName.DESCRIPTION, ArgumentName.CRON_EXPRESSION, ArgumentName.CONCURRENCY, ArgumentName.SCHEDULE_PROPERTIES); diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/security/ListRolesCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/security/ListRolesCommand.java index 7a8a049d2a29..96407541c004 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/command/security/ListRolesCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/command/security/ListRolesCommand.java @@ -79,7 +79,7 @@ public String getPattern() { public String getDescription() { return "Lists all roles, optionally for a particular principal in an authorization system for role-based " - + - "access control"; + + + "access control"; } } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/util/AbstractAuthCommand.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/util/AbstractAuthCommand.java index 8425ff23075b..b96c440d2a3d 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/util/AbstractAuthCommand.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/util/AbstractAuthCommand.java @@ -86,8 +86,8 @@ protected ProgramId parseProgramId(Arguments arguments, ElementType elementType) } protected ApplicationId parseApplicationId(Arguments arguments) { - String appVersion = arguments.hasArgument(ArgumentName.APP_VERSION.toString()) ? - arguments.get(ArgumentName.APP_VERSION.toString()) : ApplicationId.DEFAULT_VERSION; + String appVersion = arguments.hasArgument(ArgumentName.APP_VERSION.toString()) + ? arguments.get(ArgumentName.APP_VERSION.toString()) : ApplicationId.DEFAULT_VERSION; return cliConfig.getCurrentNamespace() .app(arguments.get(ArgumentName.APP.toString()), appVersion); } diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/util/ArgumentParser.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/util/ArgumentParser.java index bd8765123c2a..6869e97772d6 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/util/ArgumentParser.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/util/ArgumentParser.java @@ -83,8 +83,8 @@ public Integer apply(String input) { * @return unquoted string if quoted, otherwise the original string */ private static String extractValue(String value) { - if ((value.startsWith("'") && value.endsWith("'")) || - (value.startsWith("\"") && value.endsWith("\""))) { + if ((value.startsWith("'") && value.endsWith("'")) + || (value.startsWith("\"") && value.endsWith("\""))) { return value.substring(1, value.length() - 1); } return value; @@ -125,12 +125,12 @@ public static Map getArguments(String input, String pattern) { while (!patternTokens.isEmpty() && !inputTokens.isEmpty()) { String patternPart = patternTokens.get(0); String inputPart = inputTokens.get(0); - if (patternPart.startsWith((Character.toString(OPTIONAL_PART_BEGINNING))) && - patternPart.endsWith((Character.toString(OPTIONAL_PART_ENDING)))) { + if (patternPart.startsWith((Character.toString(OPTIONAL_PART_BEGINNING))) + && patternPart.endsWith((Character.toString(OPTIONAL_PART_ENDING)))) { arguments.putAll(parseOptional(inputTokens, getEntry(patternPart))); } else { - if (patternPart.startsWith((Character.toString(MANDATORY_ARG_BEGINNING))) && - patternPart.endsWith((Character.toString(MANDATORY_ARG_ENDING)))) { + if (patternPart.startsWith((Character.toString(MANDATORY_ARG_BEGINNING))) + && patternPart.endsWith((Character.toString(MANDATORY_ARG_ENDING)))) { arguments.put(getEntry(patternPart), tryGetInputEntry(inputPart)); } else if (!patternPart.equals(inputPart)) { return Collections.emptyMap(); @@ -161,11 +161,11 @@ private static Map parseOptional(List splitInput, String } String patternPart = splitPattern.get(0); String inputPart = tryGetInputEntry(copyInput.get(0)); - if (patternPart.startsWith((Character.toString(MANDATORY_ARG_BEGINNING))) && - patternPart.endsWith((Character.toString(MANDATORY_ARG_ENDING)))) { + if (patternPart.startsWith((Character.toString(MANDATORY_ARG_BEGINNING))) + && patternPart.endsWith((Character.toString(MANDATORY_ARG_ENDING)))) { args.put(getEntry(patternPart), inputPart); - } else if (patternPart.startsWith((Character.toString(OPTIONAL_PART_BEGINNING))) && - patternPart.endsWith((Character.toString(OPTIONAL_PART_ENDING)))) { + } else if (patternPart.startsWith((Character.toString(OPTIONAL_PART_BEGINNING))) + && patternPart.endsWith((Character.toString(OPTIONAL_PART_ENDING)))) { args.putAll(parseOptional(copyInput, getEntry(patternPart))); } else if (!patternPart.equals(inputPart)) { return Collections.emptyMap(); @@ -198,8 +198,8 @@ private static String cutNotFullyEnteredToken(String input) { * @return entry {@link String} */ private static String tryGetInputEntry(String input) { - if (input.startsWith("'") && input.endsWith("'") || - input.startsWith("\"") && input.endsWith("\"")) { + if (input.startsWith("'") && input.endsWith("'") + || input.startsWith("\"") && input.endsWith("\"")) { return getEntry(input); } return input; diff --git a/cdap-cli/src/main/java/io/cdap/cdap/cli/util/InstanceURIParser.java b/cdap-cli/src/main/java/io/cdap/cdap/cli/util/InstanceURIParser.java index 39c1430b1ca0..2ac8af649ee1 100644 --- a/cdap-cli/src/main/java/io/cdap/cdap/cli/util/InstanceURIParser.java +++ b/cdap-cli/src/main/java/io/cdap/cdap/cli/util/InstanceURIParser.java @@ -44,15 +44,15 @@ public CLIConnectionConfig parse(String uriString) { URI uri = URI.create(uriString); NamespaceId namespace = - (uri.getPath() == null || uri.getPath().isEmpty() || "/".equals(uri.getPath())) ? - NamespaceId.DEFAULT : new NamespaceId(uri.getPath().substring(1)); + (uri.getPath() == null || uri.getPath().isEmpty() || "/".equals(uri.getPath())) + ? NamespaceId.DEFAULT : new NamespaceId(uri.getPath().substring(1)); String hostname = uri.getHost(); boolean sslEnabled = "https".equals(uri.getScheme()); int port = uri.getPort(); if (port == -1) { - port = sslEnabled ? - cConf.getInt(Constants.Router.ROUTER_SSL_PORT) : + port = sslEnabled + ? cConf.getInt(Constants.Router.ROUTER_SSL_PORT) : cConf.getInt(Constants.Router.ROUTER_PORT); } diff --git a/cdap-client-tests/src/test/java/io/cdap/cdap/client/AbstractClientTest.java b/cdap-client-tests/src/test/java/io/cdap/cdap/client/AbstractClientTest.java index b800f59aa033..e9e9ca6d3975 100644 --- a/cdap-client-tests/src/test/java/io/cdap/cdap/client/AbstractClientTest.java +++ b/cdap-client-tests/src/test/java/io/cdap/cdap/client/AbstractClientTest.java @@ -211,8 +211,8 @@ public boolean equals(Object o) { return false; } ArtifactJarInfo that = (ArtifactJarInfo) o; - return Objects.equals(appClass, that.appClass) && - Objects.equals(manifest, that.manifest); + return Objects.equals(appClass, that.appClass) + && Objects.equals(manifest, that.manifest); } @Override diff --git a/cdap-client-tests/src/test/java/io/cdap/cdap/client/LineageHttpHandlerTestRun.java b/cdap-client-tests/src/test/java/io/cdap/cdap/client/LineageHttpHandlerTestRun.java index 51168a4ce2f0..21694441adf2 100644 --- a/cdap-client-tests/src/test/java/io/cdap/cdap/client/LineageHttpHandlerTestRun.java +++ b/cdap-client-tests/src/test/java/io/cdap/cdap/client/LineageHttpHandlerTestRun.java @@ -187,10 +187,11 @@ private RunId getRunId(final ProgramId program, @Nullable final RunId exclude) t AtomicReference> runRecords = new AtomicReference<>(); Tasks.waitFor(1, () -> { runRecords.set( - programClient.getProgramRuns(program, ProgramRunStatus.ALL.name(), 0, Long.MAX_VALUE, Integer.MAX_VALUE) - .stream() - .filter(record -> (exclude == null || !record.getPid().equals(exclude.getId())) && - record.getStatus() != ProgramRunStatus.PENDING) + programClient.getProgramRuns(program, ProgramRunStatus.ALL.name(), 0, Long.MAX_VALUE, + Integer.MAX_VALUE) + .stream() + .filter(record -> (exclude == null || !record.getPid().equals(exclude.getId())) + && record.getStatus() != ProgramRunStatus.PENDING) .collect(Collectors.toList())); return Iterables.size(runRecords.get()); }, 60, TimeUnit.SECONDS, 10, TimeUnit.MILLISECONDS); diff --git a/cdap-client-tests/src/test/java/io/cdap/cdap/client/MetadataHttpHandlerTestRun.java b/cdap-client-tests/src/test/java/io/cdap/cdap/client/MetadataHttpHandlerTestRun.java index c3a010802d58..a58e70bde929 100644 --- a/cdap-client-tests/src/test/java/io/cdap/cdap/client/MetadataHttpHandlerTestRun.java +++ b/cdap-client-tests/src/test/java/io/cdap/cdap/client/MetadataHttpHandlerTestRun.java @@ -572,12 +572,14 @@ public void testSystemMetadataRetrieval() throws Exception { ApplicationId app = NamespaceId.DEFAULT.app(AllProgramsApp.NAME); Assert.assertEquals( ImmutableMap.builder() - .put(ProgramType.MAPREDUCE.getPrettyName() + MetadataConstants.KEYVALUE_SEPARATOR + AllProgramsApp.NoOpMR.NAME, - AllProgramsApp.NoOpMR.NAME) - .put(ProgramType.MAPREDUCE.getPrettyName() + MetadataConstants.KEYVALUE_SEPARATOR + AllProgramsApp.NoOpMR2.NAME, - AllProgramsApp.NoOpMR2.NAME) - .put(ProgramType.SERVICE.getPrettyName() + MetadataConstants.KEYVALUE_SEPARATOR + - AllProgramsApp.NoOpService.NAME, AllProgramsApp.NoOpService.NAME) + .put(ProgramType.MAPREDUCE.getPrettyName() + MetadataConstants.KEYVALUE_SEPARATOR + + AllProgramsApp.NoOpMR.NAME, + AllProgramsApp.NoOpMR.NAME) + .put(ProgramType.MAPREDUCE.getPrettyName() + MetadataConstants.KEYVALUE_SEPARATOR + + AllProgramsApp.NoOpMR2.NAME, + AllProgramsApp.NoOpMR2.NAME) + .put(ProgramType.SERVICE.getPrettyName() + MetadataConstants.KEYVALUE_SEPARATOR + + AllProgramsApp.NoOpService.NAME, AllProgramsApp.NoOpService.NAME) .put(ProgramType.SPARK.getPrettyName() + MetadataConstants.KEYVALUE_SEPARATOR + AllProgramsApp.NoOpSpark.NAME, AllProgramsApp.NoOpSpark.NAME) .put(ProgramType.WORKER.getPrettyName() + MetadataConstants.KEYVALUE_SEPARATOR + AllProgramsApp.NoOpWorker.NAME, @@ -751,22 +753,22 @@ public void testScopeQueryParam() throws Exception { URL url = clientConfig.resolveNamespacedURLV3(NamespaceId.DEFAULT, "apps/" + AllProgramsApp.NAME + "/metadata?scope=system"); Assert.assertEquals( - HttpResponseStatus.OK.code(), - restClient.execute(HttpRequest.get(url).build()).getResponseCode() + HttpResponseStatus.OK.code(), + restClient.execute(HttpRequest.get(url).build()).getResponseCode() ); url = clientConfig.resolveNamespacedURLV3(NamespaceId.DEFAULT, - "datasets/" + AllProgramsApp.DATASET_NAME + - "/metadata/properties?scope=SySTeM"); + "datasets/" + AllProgramsApp.DATASET_NAME + + "/metadata/properties?scope=SySTeM"); Assert.assertEquals( - HttpResponseStatus.OK.code(), - restClient.execute(HttpRequest.get(url).build()).getResponseCode() + HttpResponseStatus.OK.code(), + restClient.execute(HttpRequest.get(url).build()).getResponseCode() ); url = clientConfig.resolveNamespacedURLV3(NamespaceId.DEFAULT, - "apps/" + AllProgramsApp.NAME + "/services/" + - AllProgramsApp.NoOpService.NAME + "/metadata/tags?scope=USER"); + "apps/" + AllProgramsApp.NAME + "/services/" + + AllProgramsApp.NoOpService.NAME + "/metadata/tags?scope=USER"); Assert.assertEquals( - HttpResponseStatus.OK.code(), - restClient.execute(HttpRequest.get(url).build()).getResponseCode() + HttpResponseStatus.OK.code(), + restClient.execute(HttpRequest.get(url).build()).getResponseCode() ); ApplicationDetail appDetail = appClient.get(app); app = new ApplicationId(app.getNamespace(), app.getApplication(), appDetail.getAppVersion()); diff --git a/cdap-client/src/main/java/io/cdap/cdap/client/AuthorizationClient.java b/cdap-client/src/main/java/io/cdap/cdap/client/AuthorizationClient.java index 0d6d3fdd4021..2881d1980fe2 100644 --- a/cdap-client/src/main/java/io/cdap/cdap/client/AuthorizationClient.java +++ b/cdap-client/src/main/java/io/cdap/cdap/client/AuthorizationClient.java @@ -83,16 +83,16 @@ public AuthorizationClient(ClientConfig config) { @Override public void enforce(EntityId entity, Principal principal, Set permissions) { throw new UnsupportedOperationException( - "Enforcement is not supported via Java Client. Please instead use the " + - "listPrivileges method to view the privileges for a principal."); + "Enforcement is not supported via Java Client. Please instead use the " + + "listPrivileges method to view the privileges for a principal."); } @Override public void enforceOnParent(EntityType entityType, EntityId parentId, Principal principal, Permission permission) { throw new UnsupportedOperationException( - "Enforcement is not supported via Java Client. Please instead use the " + - "listPrivileges method to view the privileges for a principal."); + "Enforcement is not supported via Java Client. Please instead use the " + + "listPrivileges method to view the privileges for a principal."); } @Override diff --git a/cdap-client/src/main/java/io/cdap/cdap/client/config/ConnectionConfig.java b/cdap-client/src/main/java/io/cdap/cdap/client/config/ConnectionConfig.java index be2599f02b41..b50f7b23f3d2 100644 --- a/cdap-client/src/main/java/io/cdap/cdap/client/config/ConnectionConfig.java +++ b/cdap-client/src/main/java/io/cdap/cdap/client/config/ConnectionConfig.java @@ -129,10 +129,10 @@ public boolean equals(Object obj) { return false; } final ConnectionConfig other = (ConnectionConfig) obj; - return Objects.equal(this.hostname, other.hostname) && - Objects.equal(this.port, other.port) && - Objects.equal(this.sslEnabled, other.sslEnabled) && - Objects.equal(this.apiPath, other.apiPath); + return Objects.equal(this.hostname, other.hostname) + && Objects.equal(this.port, other.port) + && Objects.equal(this.sslEnabled, other.sslEnabled) + && Objects.equal(this.apiPath, other.apiPath); } @Override diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/ProgramRunForbiddenException.java b/cdap-common/src/main/java/io/cdap/cdap/common/ProgramRunForbiddenException.java index e83f0bd2122f..3048c679ce87 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/ProgramRunForbiddenException.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/ProgramRunForbiddenException.java @@ -24,7 +24,7 @@ public class ProgramRunForbiddenException extends ForbiddenException { public ProgramRunForbiddenException(ProgramId programId) { - super(String.format("Program %s can not be run because launching " + - "user programs with native profile is disabled.", programId.toString())); + super(String.format("Program %s can not be run because launching " + + "user programs with native profile is disabled.", programId.toString())); } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/conf/ArtifactConfigReader.java b/cdap-common/src/main/java/io/cdap/cdap/common/conf/ArtifactConfigReader.java index 11465e1243bf..984da3690b2d 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/conf/ArtifactConfigReader.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/conf/ArtifactConfigReader.java @@ -90,8 +90,8 @@ public ArtifactConfig read(Id.Namespace namespace, File configFile) if (!NamespaceId.SYSTEM.equals(parentNamespace) && !namespace.toEntityId() .equals(parentNamespace)) { throw new InvalidArtifactException( - String.format("Invalid parent %s. Parents must be in the same " + - "namespace or a system artifact.", parent)); + String.format("Invalid parent %s. Parents must be in the same " + + "namespace or a system artifact.", parent)); } } return config; diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/conf/CConfigurationUtil.java b/cdap-common/src/main/java/io/cdap/cdap/common/conf/CConfigurationUtil.java index 139f566cd338..8658d753f0fc 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/conf/CConfigurationUtil.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/conf/CConfigurationUtil.java @@ -174,7 +174,7 @@ private static void assertAlphanumeric(CConfiguration cConf, String key) { String value = cConf.get(key); Preconditions.checkNotNull(value, "Entry of CConf with key: %s is null", key); Preconditions.checkArgument(value.matches("[a-zA-Z0-9]+"), - "CConf entry with key: %s must consist " + - "of only alphanumeric characters; it is: %s", key, value); + "CConf entry with key: %s must consist " + + "of only alphanumeric characters; it is: %s", key, value); } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/conf/Configuration.java b/cdap-common/src/main/java/io/cdap/cdap/common/conf/Configuration.java index f7a96b4ff4c2..9c5ad9ac43bd 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/conf/Configuration.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/conf/Configuration.java @@ -1031,8 +1031,8 @@ public Pattern getPattern(String name, Pattern defaultValue) { try { return Pattern.compile(valString); } catch (PatternSyntaxException pse) { - LOG.warn("Regular expression '" + valString + "' for property '" + - name + "' not valid. Using default", pse); + LOG.warn("Regular expression '" + valString + "' for property '" + + name + "' not valid. Using default", pse); return defaultValue; } } @@ -1158,8 +1158,8 @@ public IntegerRanges(String newValue) { String rng = itr.nextToken().trim(); String[] parts = rng.split("-", 3); if (parts.length < 1 || parts.length > 2) { - throw new IllegalArgumentException("integer range badly formed: " + - rng); + throw new IllegalArgumentException("integer range badly formed: " + + rng); } Range r = new Range(); r.start = convertToInt(parts[0], 0); @@ -1169,8 +1169,8 @@ public IntegerRanges(String newValue) { r.end = r.start; } if (r.start > r.end) { - throw new IllegalArgumentException("IntegerRange from " + r.start + - " to " + r.end + " is invalid"); + throw new IllegalArgumentException("IntegerRange from " + r.start + + " to " + r.end + " is invalid"); } ranges.add(r); } @@ -1975,8 +1975,8 @@ public Map getValByRegex(String regex) { Matcher m; for (Map.Entry item : getProps().entrySet()) { - if (item.getKey() instanceof String && - item.getValue() instanceof String) { + if (item.getKey() instanceof String + && item.getValue() instanceof String) { m = p.matcher((String) item.getKey()); if (m.find()) { // match result.put((String) item.getKey(), (String) item.getValue()); diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/db/DBConnectionPoolManager.java b/cdap-common/src/main/java/io/cdap/cdap/common/db/DBConnectionPoolManager.java index 9955ad1c604f..bb55167c53ae 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/db/DBConnectionPoolManager.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/db/DBConnectionPoolManager.java @@ -187,8 +187,8 @@ private Connection getConnection2(long timeoutMs) throws SQLException { throw new TimeoutException(); } } catch (InterruptedException e) { - throw new RuntimeException("Interrupted while waiting for a " + - "database connection.", e); + throw new RuntimeException("Interrupted while waiting for a " + + "database connection.", e); } boolean ok = false; @@ -273,14 +273,14 @@ public Connection getValidConnection() throws TimeoutException { try { Thread.sleep(250); } catch (InterruptedException e) { - throw new RuntimeException("Interrupted while waiting " + - "for a valid database connection.", e); + throw new RuntimeException("Interrupted while waiting " + + "for a valid database connection.", e); } } time = System.currentTimeMillis(); if (time >= timeoutTime) { - throw new TimeoutException("Timeout while waiting for a " + - "valid database connection."); + throw new TimeoutException("Timeout while waiting for a " + + "valid database connection."); } } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/id/Id.java b/cdap-common/src/main/java/io/cdap/cdap/common/id/Id.java index 64053820e638..8dc369c6218a 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/id/Id.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/id/Id.java @@ -245,8 +245,8 @@ public static Application from(String namespaceId, String applicationId) { @Override public ApplicationId toEntityId() { - return new ApplicationId(namespace.getId(), applicationId, version == null ? - ApplicationId.DEFAULT_VERSION : version); + return new ApplicationId(namespace.getId(), applicationId, version == null + ? ApplicationId.DEFAULT_VERSION : version); } public static Application fromEntityId(ApplicationId applicationId) { @@ -520,8 +520,8 @@ private DatasetModule(Namespace namespace, String moduleId) { } if (!isValidDatasetId(moduleId)) { throw new IllegalArgumentException( - "Invalid characters found in dataset module Id '" + moduleId + - "'. Allowed characters are ASCII letters, numbers, and _, -, ., or $."); + "Invalid characters found in dataset module Id '" + moduleId + + "'. Allowed characters are ASCII letters, numbers, and _, -, ., or $."); } this.namespace = namespace; this.moduleId = moduleId; diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/internal/remote/RemoteTaskExecutor.java b/cdap-common/src/main/java/io/cdap/cdap/common/internal/remote/RemoteTaskExecutor.java index e5442a6741ea..7c00a2452906 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/internal/remote/RemoteTaskExecutor.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/internal/remote/RemoteTaskExecutor.java @@ -81,8 +81,8 @@ public RemoteTaskExecutor(CConfiguration cConf, MetricsCollectionService metrics RemoteClientFactory remoteClientFactory, Type workerType, HttpRequestConfig httpRequestConfig) { this.compression = cConf.getBoolean(Constants.TaskWorker.COMPRESSION_ENABLED); - String serviceName = workerType == Type.TASK_WORKER ? - Constants.Service.TASK_WORKER : Constants.Service.SYSTEM_WORKER; + String serviceName = workerType == Type.TASK_WORKER + ? Constants.Service.TASK_WORKER : Constants.Service.SYSTEM_WORKER; this.remoteClient = remoteClientFactory.createRemoteClient(serviceName, httpRequestConfig, Constants.Gateway.INTERNAL_API_VERSION_3); diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/io/DefaultCachingPathProvider.java b/cdap-common/src/main/java/io/cdap/cdap/common/io/DefaultCachingPathProvider.java index 9d4d0e750512..2d394713eaa2 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/io/DefaultCachingPathProvider.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/io/DefaultCachingPathProvider.java @@ -168,8 +168,8 @@ public boolean equals(Object o) { return false; } CacheKey that = (CacheKey) o; - return this.lastModified == that.lastModified && - this.fileName.equals(that.fileName); + return this.lastModified == that.lastModified + && this.fileName.equals(that.fileName); } String getFileName() { diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/io/Locations.java b/cdap-common/src/main/java/io/cdap/cdap/common/io/Locations.java index 0a2adf0dd67b..4eb04253b402 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/io/Locations.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/io/Locations.java @@ -289,8 +289,8 @@ public static void unpack(Location archive, File targetDir) throws IOException { case "gz": // gz is not recommended for archiving multiple files together. So we only support .tar.gz Preconditions.checkArgument(archive.getName().endsWith(".tar.gz"), - "'.gz' format is not supported for " + - "archiving multiple files. Please use 'zip', 'jar', '.tar.gz', 'tgz' or 'tar'."); + "'.gz' format is not supported for " + + "archiving multiple files. Please use 'zip', 'jar', '.tar.gz', 'tgz' or 'tar'."); try (InputStream is = archive.getInputStream()) { expandTgz(is, targetDir); } @@ -307,8 +307,8 @@ public static void unpack(Location archive, File targetDir) throws IOException { break; default: throw new IOException( - String.format("Unsupported compression type '%s'. Only 'zip', 'jar', " + - "'tar.gz', 'tgz' and 'tar' are supported.", extension)); + String.format("Unsupported compression type '%s'. Only 'zip', 'jar', " + + "'tar.gz', 'tgz' and 'tar' are supported.", extension)); } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/logging/AuditLogConfig.java b/cdap-common/src/main/java/io/cdap/cdap/common/logging/AuditLogConfig.java index 28ee2782010c..32f0641ad291 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/logging/AuditLogConfig.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/logging/AuditLogConfig.java @@ -66,10 +66,10 @@ public boolean equals(Object o) { } AuditLogConfig other = (AuditLogConfig) o; - return Objects.equals(httpMethod, other.getHttpMethod()) && - logRequestBody == other.isLogRequestBody() && - logResponseBody == other.isLogResponseBody() && - Objects.equals(headerNames, other.getHeaderNames()); + return Objects.equals(httpMethod, other.getHttpMethod()) + && logRequestBody == other.isLogRequestBody() + && logResponseBody == other.isLogResponseBody() + && Objects.equals(headerNames, other.getHeaderNames()); } @Override @@ -79,11 +79,11 @@ public int hashCode() { @Override public String toString() { - return "AuditLogContent{" + - "httpMethod=" + httpMethod + - ", logRequestBody=" + logRequestBody + - ", logResponseBody=" + logResponseBody + - ", headerNames=" + headerNames + - '}'; + return "AuditLogContent{" + + "httpMethod=" + httpMethod + + ", logRequestBody=" + logRequestBody + + ", logResponseBody=" + logResponseBody + + ", headerNames=" + headerNames + + '}'; } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/logging/perf/Timing.java b/cdap-common/src/main/java/io/cdap/cdap/common/logging/perf/Timing.java index 404401cb8a03..03c6eab479ff 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/logging/perf/Timing.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/logging/perf/Timing.java @@ -67,15 +67,15 @@ public void end() { // report if needed if (now > lastReportedTs + reportInterval) { - LOG.info(name + " stats. " + - " total: " + - " {count: " + totalCount + - ", time since start: " + (now - startTs) + - ", avg latency: " + round(totalLatency / totalCount) + "}" + - " last interval: " + - " {count: " + currentIntervalCount + - ", time since interval start: " + (now - lastReportedTs) + - ", avg latency: " + round(currentIntervalLatency / currentIntervalCount) + "}"); + LOG.info(name + " stats. " + + " total: " + + " {count: " + totalCount + + ", time since start: " + (now - startTs) + + ", avg latency: " + round(totalLatency / totalCount) + "}" + + " last interval: " + + " {count: " + currentIntervalCount + + ", time since interval start: " + (now - lastReportedTs) + + ", avg latency: " + round(currentIntervalLatency / currentIntervalCount) + "}"); currentIntervalCount = 0; currentIntervalLatency = 0; lastReportedTs = now; diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/metadata/Cursor.java b/cdap-common/src/main/java/io/cdap/cdap/common/metadata/Cursor.java index 6d4182a75aa3..c13c5f70e9dd 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/metadata/Cursor.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/metadata/Cursor.java @@ -117,15 +117,15 @@ public boolean equals(Object o) { return false; } Cursor cursor = (Cursor) o; - return offset == cursor.offset && - limit == cursor.limit && - showHidden == cursor.showHidden && - scope == cursor.scope && - Objects.equals(namespaces, cursor.namespaces) && - Objects.equals(types, cursor.types) && - Objects.equals(sorting, cursor.sorting) && - Objects.equals(actualCursor, cursor.actualCursor) && - Objects.equals(query, cursor.query); + return offset == cursor.offset + && limit == cursor.limit + && showHidden == cursor.showHidden + && scope == cursor.scope + && Objects.equals(namespaces, cursor.namespaces) + && Objects.equals(types, cursor.types) + && Objects.equals(sorting, cursor.sorting) + && Objects.equals(actualCursor, cursor.actualCursor) + && Objects.equals(query, cursor.query); } @Override diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/metadata/MetadataRecord.java b/cdap-common/src/main/java/io/cdap/cdap/common/metadata/MetadataRecord.java index c1608e996847..47a5cd40ddfb 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/metadata/MetadataRecord.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/metadata/MetadataRecord.java @@ -120,10 +120,10 @@ public boolean equals(Object o) { MetadataRecord that = (MetadataRecord) o; - return Objects.equals(metadataEntity, that.metadataEntity) && - scope == that.scope && - Objects.equals(properties, that.properties) && - Objects.equals(tags, that.tags); + return Objects.equals(metadataEntity, that.metadataEntity) + && scope == that.scope + && Objects.equals(properties, that.properties) + && Objects.equals(tags, that.tags); } @Override @@ -133,11 +133,11 @@ public int hashCode() { @Override public String toString() { - return "MetadataRecord{" + - "metadataEntity=" + metadataEntity + - ", scope=" + scope + - ", properties=" + properties + - ", tags=" + tags + - '}'; + return "MetadataRecord{" + + "metadataEntity=" + metadataEntity + + ", scope=" + scope + + ", properties=" + properties + + ", tags=" + tags + + '}'; } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/security/AuthEnforceRewriter.java b/cdap-common/src/main/java/io/cdap/cdap/common/security/AuthEnforceRewriter.java index e55a1345a2a6..bf29bada05ed 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/security/AuthEnforceRewriter.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/security/AuthEnforceRewriter.java @@ -256,8 +256,8 @@ public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, if (Name.class.getName().equals(Type.getType(desc).getClassName())) { LOG.debug( "Updating parameter details for parameter at position '{}' for method '{}' in class '{}'. " - + - "Since method annotations is preferred annotation.", parameter, methodName, + + + "Since method annotations is preferred annotation.", parameter, methodName, className); parameterDetails.put(parameter, parameterDetail); return parameterDetail.getAnnotationNode(); @@ -291,9 +291,9 @@ public void visitEnd() { if (!fieldDetails.containsKey(name)) { // Didn't find a named method parameter or class field for the given entity name throw new IllegalArgumentException( - String.format("No named method parameter or a class field found " + - "with name '%s' in class '%s' for method '%s' " + - "whereas it was specified in '%s' annotation", name, + String.format("No named method parameter or a class field found " + + "with name '%s' in class '%s' for method '%s' " + + "whereas it was specified in '%s' annotation", name, className, methodName, AuthEnforce.class.getSimpleName())); } @@ -311,8 +311,8 @@ public void visitEnd() { private void verifyEntityParts(List entityPartDetails, Type enforceOn) { Preconditions.checkArgument(!entityPartDetails.isEmpty(), - "Entity Details for the annotation cannot be " + - "empty"); + "Entity Details for the annotation cannot be " + + "empty"); Type entityPartType = entityPartDetails.get(0).getType(); // if the first entity part is not string then it or its parent should be of same type specified in enforce on if (!entityPartType.equals(Type.getType(String.class))) { @@ -330,8 +330,8 @@ private void verifyEntityParts(List entityPartDetails, Type en } if (!AuthEnforceUtil.verifyEntityIdParents(entityPartClass, enforceOnClass)) { throw new IllegalArgumentException( - String.format("Found invalid entity type '%s' for enforceOn '%s' " + - "in annotation on '%s' method in '%s' class.", + String.format("Found invalid entity type '%s' for enforceOn '%s' " + + "in annotation on '%s' method in '%s' class.", entityPartType.getClassName(), enforceOn.getClassName(), methodName, className)); } @@ -345,15 +345,15 @@ private void verifyEntityParts(List entityPartDetails, Type en for (EntityPartDetail entityPartDetail : entityPartDetails) { entityPartType = entityPartDetail.getType(); Preconditions.checkArgument(entityPartType.equals(Type.getType(String.class)), - "Found part %s of type %s in a multiple part entity specification of " + - "AuthEnforce. Only String is supported in multiple parts.", + "Found part %s of type %s in a multiple part entity specification of " + + "AuthEnforce. Only String is supported in multiple parts.", entityPartDetail.getEntityName(), entityPartType); } int requiredSize = AuthEnforceUtil.getEntityIdPartsCount(enforceOn); Preconditions.checkArgument(requiredSize == entityPartDetails.size(), - "Found %s entity parts in " + - "AuthEnforce annotation on method %s in class %s to do enforcement on %s " + - "which requires %s entity parts or an %s", entityPartDetails.size(), + "Found %s entity parts in " + + "AuthEnforce annotation on method %s in class %s to do enforcement on %s " + + "which requires %s entity parts or an %s", entityPartDetails.size(), methodName, className, enforceOn, requiredSize, enforceOn.getClassName()); } @@ -414,8 +414,8 @@ public MethodVisitor visitMethod(int access, final String methodName, final Stri protected void onMethodEnter() { LOG.trace( "AuthEnforce annotation found in class {} on method {}. Authorization enforcement command will " - + - "be generated for Entities: {}, enforceOn: {}, permissions: {}.", className, + + + "be generated for Entities: {}, enforceOn: {}, permissions: {}.", className, methodName, annotationDetail.getEntities(), annotationDetail.getEnforceOn(), annotationDetail.getPermissions()); @@ -556,19 +556,19 @@ private static Map processParameterDetails(Map getPermissions() { @Override public String toString() { - return "AuthEnforceAnnotationNodeProcessor{" + - "permissions=" + permissions + - ", enforceOn=" + enforceOn + - ", entities=" + entities + - '}'; + return "AuthEnforceAnnotationNodeProcessor{" + + "permissions=" + permissions + + ", enforceOn=" + enforceOn + + ", entities=" + entities + + '}'; } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/security/AuthEnforceUtil.java b/cdap-common/src/main/java/io/cdap/cdap/common/security/AuthEnforceUtil.java index 2b78aeb3df03..0287e7c128a3 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/security/AuthEnforceUtil.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/security/AuthEnforceUtil.java @@ -110,8 +110,8 @@ private static EntityId getEntityId(Object[] entities, Class } throw new IllegalArgumentException( - String.format("Enforcement was specified on %s but an instance of %s was " + - "provided.", entityClass, entityId.getClass())); + String.format("Enforcement was specified on %s but an instance of %s was " + + "provided.", entityClass, entityId.getClass())); } else { return createEntityId(entityClass, entities); } @@ -147,9 +147,9 @@ static int getEntityIdPartsCount(Type enforceOn) { return CONS_CACHE.get(ProgramId.class).getParameterTypes().length; } throw new IllegalArgumentException( - String.format("Failed to determine required number of entity parts " + - "needed for %s. Please make sure its a valid %s class " + - "for authorization enforcement", + String.format("Failed to determine required number of entity parts " + + "needed for %s. Please make sure its a valid %s class " + + "for authorization enforcement", enforceOn.getClassName(), EntityId.class.getSimpleName())); } @@ -158,8 +158,8 @@ private static EntityId createEntityId(Class entityClass, Ob Constructor constructor = CONS_CACHE.get(entityClass); Preconditions.checkNotNull(constructor, - String.format("Failed to find constructor for entity class %s. Please " + - "make sure it exists.", entityClass)); + String.format("Failed to find constructor for entity class %s. Please " + + "make sure it exists.", entityClass)); // its okay to call with object [] without checking that all of these are string because if one of them is not // then newInstance call will throw IllegalArgumentException. return constructor.newInstance(args); @@ -175,8 +175,8 @@ private static Constructor findConstructor( } // since constructor was not found throw an exception throw new IllegalStateException( - String.format("Failed to find constructor for %s whose parameters are only of " + - "String type", entityClass.getName())); + String.format("Failed to find constructor for %s whose parameters are only of " + + "String type", entityClass.getName())); } /** diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/ssh/DefaultSSHSession.java b/cdap-common/src/main/java/io/cdap/cdap/common/ssh/DefaultSSHSession.java index 461977418ddd..f31401d67ea8 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/ssh/DefaultSSHSession.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/ssh/DefaultSSHSession.java @@ -165,8 +165,8 @@ public String executeAndWait(List commands) throws IOException { int exitCode = process.waitFor(); if (exitCode != 0) { throw new IOException( - "Commands execution failed with exit code (" + exitCode + ") Commands: " + - commands + ", Output: " + out + " Error: " + err); + "Commands execution failed with exit code (" + exitCode + ") Commands: " + + commands + ", Output: " + out + " Error: " + err); } return out; } catch (InterruptedException e) { diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/startup/CheckRunner.java b/cdap-common/src/main/java/io/cdap/cdap/common/startup/CheckRunner.java index f0ebb516de76..5dd2175809b4 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/startup/CheckRunner.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/startup/CheckRunner.java @@ -94,9 +94,9 @@ public Builder addChecksInPackage(String pkg) throws IOException { ClassPath classPath = getClassPath(); for (ClassPath.ClassInfo classInfo : classPath.getAllClassesRecursive(pkg)) { Class cls = classInfo.load(); - if (!Modifier.isInterface(cls.getModifiers()) && - !Modifier.isAbstract(cls.getModifiers()) && - Check.class.isAssignableFrom(cls)) { + if (!Modifier.isInterface(cls.getModifiers()) + && !Modifier.isAbstract(cls.getModifiers()) + && Check.class.isAssignableFrom(cls)) { checks.add((Check) injector.getInstance(cls)); } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/twill/AbortOnTimeoutEventHandler.java b/cdap-common/src/main/java/io/cdap/cdap/common/twill/AbortOnTimeoutEventHandler.java index ffbdb6939181..ee93640cf6af 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/twill/AbortOnTimeoutEventHandler.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/twill/AbortOnTimeoutEventHandler.java @@ -85,8 +85,8 @@ public TimeoutAction launchTimeout(Iterable timeoutEvents) { long now = System.currentTimeMillis(); for (TimeoutEvent event : timeoutEvents) { LOG.warn( - "Requested {} containers for runnable {} when running application {} with run id {}," + - " only got {} after {} ms.", + "Requested {} containers for runnable {} when running application {} with run id {}," + + " only got {} after {} ms.", event.getExpectedInstances(), event.getRunnableName(), applicationName, runId, event.getActualInstances(), System.currentTimeMillis() - event.getRequestTime()); diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/utils/TimeMathParser.java b/cdap-common/src/main/java/io/cdap/cdap/common/utils/TimeMathParser.java index 9cadf59f1153..348c3624f8bd 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/utils/TimeMathParser.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/utils/TimeMathParser.java @@ -50,8 +50,8 @@ private static long convertToMilliseconds(String op, long num, String unitStr) { } else if ("d".equals(unitStr)) { milliseconds = TimeUnit.DAYS.toMillis(num); } else { - throw new IllegalArgumentException("invalid time unit " + unitStr + - ", should be one of 'ms', 's', 'm', 'h', 'd'"); + throw new IllegalArgumentException("invalid time unit " + unitStr + + ", should be one of 'ms', 's', 'm', 'h', 'd'"); } if ("+".equals(op)) { diff --git a/cdap-common/src/main/java/io/cdap/cdap/common/zookeeper/election/LeaderElectionInfoService.java b/cdap-common/src/main/java/io/cdap/cdap/common/zookeeper/election/LeaderElectionInfoService.java index 3fd7ad1267f2..15fa2d73582f 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/common/zookeeper/election/LeaderElectionInfoService.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/zookeeper/election/LeaderElectionInfoService.java @@ -264,10 +264,10 @@ public String getHostname() { @Override public String toString() { - return "ParticipantInfo{" + - "zkPath='" + zkPath + '\'' + - ", hostname='" + hostname + '\'' + - '}'; + return "ParticipantInfo{" + + "zkPath='" + zkPath + '\'' + + ", hostname='" + hostname + '\'' + + '}'; } @Override diff --git a/cdap-common/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/ProgramRunInfo.java b/cdap-common/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/ProgramRunInfo.java index 53bf62b2a841..7d454dcd8592 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/ProgramRunInfo.java +++ b/cdap-common/src/main/java/io/cdap/cdap/internal/app/runtime/monitor/ProgramRunInfo.java @@ -86,8 +86,8 @@ public boolean equals(Object o) { } ProgramRunInfo that = (ProgramRunInfo) o; - return Objects.equals(this.getProgramRunStatus(), that.getProgramRunStatus()) && - Objects.equals(this.getTerminateTimestamp(), that.getTerminateTimestamp()); + return Objects.equals(this.getProgramRunStatus(), that.getProgramRunStatus()) + && Objects.equals(this.getTerminateTimestamp(), that.getTerminateTimestamp()); } @Override @@ -97,9 +97,9 @@ public int hashCode() { @Override public String toString() { - return "ProgramRunInfo" + - "{programRunStatus=" + programRunStatus + - ", terminateTs='" + terminateTs + - '}'; + return "ProgramRunInfo" + + "{programRunStatus=" + programRunStatus + + ", terminateTs='" + terminateTs + + '}'; } } diff --git a/cdap-common/src/main/java/io/cdap/cdap/internal/app/store/RunRecordDetail.java b/cdap-common/src/main/java/io/cdap/cdap/internal/app/store/RunRecordDetail.java index d5aa43bd5c88..4d70f44d2b5d 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/internal/app/store/RunRecordDetail.java +++ b/cdap-common/src/main/java/io/cdap/cdap/internal/app/store/RunRecordDetail.java @@ -147,21 +147,21 @@ public boolean equals(Object o) { } RunRecordDetail that = (RunRecordDetail) o; - return Objects.equal(this.getProgramRunId(), that.getProgramRunId()) && - Objects.equal(this.getStartTs(), that.getStartTs()) && - Objects.equal(this.getRunTs(), that.getRunTs()) && - Objects.equal(this.getStopTs(), that.getStopTs()) && - Objects.equal(this.getSuspendTs(), that.getSuspendTs()) && - Objects.equal(this.getResumeTs(), that.getResumeTs()) && - Objects.equal(this.getStoppingTs(), that.getStoppingTs()) && - Objects.equal(this.getTerminateTs(), that.getTerminateTs()) && - Objects.equal(this.getStatus(), that.getStatus()) && - Objects.equal(this.getProperties(), that.getProperties()) && - Objects.equal(this.getPeerName(), that.getPeerName()) && - Objects.equal(this.getTwillRunId(), that.getTwillRunId()) && - Arrays.equals(this.getSourceId(), that.getSourceId()) && - Objects.equal(this.getArtifactId(), that.getArtifactId()) && - Objects.equal(this.getPrincipal(), that.getPrincipal()); + return Objects.equal(this.getProgramRunId(), that.getProgramRunId()) + && Objects.equal(this.getStartTs(), that.getStartTs()) + && Objects.equal(this.getRunTs(), that.getRunTs()) + && Objects.equal(this.getStopTs(), that.getStopTs()) + && Objects.equal(this.getSuspendTs(), that.getSuspendTs()) + && Objects.equal(this.getResumeTs(), that.getResumeTs()) + && Objects.equal(this.getStoppingTs(), that.getStoppingTs()) + && Objects.equal(this.getTerminateTs(), that.getTerminateTs()) + && Objects.equal(this.getStatus(), that.getStatus()) + && Objects.equal(this.getProperties(), that.getProperties()) + && Objects.equal(this.getPeerName(), that.getPeerName()) + && Objects.equal(this.getTwillRunId(), that.getTwillRunId()) + && Arrays.equals(this.getSourceId(), that.getSourceId()) + && Objects.equal(this.getArtifactId(), that.getArtifactId()) + && Objects.equal(this.getPrincipal(), that.getPrincipal()); } @Override diff --git a/cdap-common/src/main/java/io/cdap/cdap/internal/io/ReflectionWriter.java b/cdap-common/src/main/java/io/cdap/cdap/internal/io/ReflectionWriter.java index a2ee796b8d51..d97ca4bf4808 100644 --- a/cdap-common/src/main/java/io/cdap/cdap/internal/io/ReflectionWriter.java +++ b/cdap-common/src/main/java/io/cdap/cdap/internal/io/ReflectionWriter.java @@ -225,8 +225,8 @@ private Map collectByMethod(TypeToken typeToken, Map\n" + - "\n" + - " \n" + - " stream.zz.threshold\n" + - " 1\n" + - " Some description\n" + - " \n" + - "\n" + - ""; - ByteArrayInputStream source = new ByteArrayInputStream(confStr.getBytes(StandardCharsets.UTF_8)); + "\n" + + "\n" + + " \n" + + " stream.zz.threshold\n" + + " 1\n" + + " Some description\n" + + " \n" + + "\n" + + ""; + ByteArrayInputStream source = new ByteArrayInputStream( + confStr.getBytes(StandardCharsets.UTF_8)); CConfiguration cConf = CConfiguration.create(source); ConfigEntry cConfEntry = new ConfigEntry("stream.zz.threshold", "1", source.toString()); @@ -50,15 +51,15 @@ public void testConfig() { // hConf Configuration hConf = new Configuration(); String hConfResourceString = - "\n" + - "\n" + - " \n" + - " stream.notification.threshold\n" + - " 3\n" + - " Some description\n" + - " \n" + - "\n" + - ""; + "\n" + + "\n" + + " \n" + + " stream.notification.threshold\n" + + " 3\n" + + " Some description\n" + + " \n" + + "\n" + + ""; source = new ByteArrayInputStream(hConfResourceString.getBytes(StandardCharsets.UTF_8)); hConf.addResource(source); diff --git a/cdap-common/src/test/java/io/cdap/cdap/io/DatumCodecTest.java b/cdap-common/src/test/java/io/cdap/cdap/io/DatumCodecTest.java index 008f3d4e3ae4..29de2914274d 100644 --- a/cdap-common/src/test/java/io/cdap/cdap/io/DatumCodecTest.java +++ b/cdap-common/src/test/java/io/cdap/cdap/io/DatumCodecTest.java @@ -86,10 +86,10 @@ public int hashCode() { @Override public String toString() { - return "Value{" + - "id=" + id + - ", name='" + name + '\'' + - '}'; + return "Value{" + + "id=" + id + + ", name='" + name + '\'' + + '}'; } } diff --git a/cdap-common/src/test/java/io/cdap/cdap/io/SchemaTest.java b/cdap-common/src/test/java/io/cdap/cdap/io/SchemaTest.java index dd6b171311ad..b5fbd761fd09 100644 --- a/cdap-common/src/test/java/io/cdap/cdap/io/SchemaTest.java +++ b/cdap-common/src/test/java/io/cdap/cdap/io/SchemaTest.java @@ -262,26 +262,27 @@ public void testFieldIgnoreCase() { @Test public void testParseFlatSQL() throws IOException { // simple, non-nested types - String schemaStr = "bool_field boolean, " + - "int_field int not null, " + - "long_field long not null, " + - "float_field float NOT NULL, " + - "double_field double NOT NULL, " + - "bytes_field bytes not null, " + - "array_field array not null, " + - "map_field map not null, " + - "record_field record, " + - "string_field string"; + String schemaStr = "bool_field boolean, " + + "int_field int not null, " + + "long_field long not null, " + + "float_field float NOT NULL, " + + "double_field double NOT NULL, " + + "bytes_field bytes not null, " + + "array_field array not null, " + + "map_field map not null, " + + "record_field record, " + + "string_field string"; Schema expected = Schema.recordOf( - "rec", - Schema.Field.of("bool_field", Schema.nullableOf(Schema.of(Schema.Type.BOOLEAN))), - Schema.Field.of("int_field", Schema.of(Schema.Type.INT)), - Schema.Field.of("long_field", Schema.of(Schema.Type.LONG)), - Schema.Field.of("float_field", Schema.of(Schema.Type.FLOAT)), - Schema.Field.of("double_field", Schema.of(Schema.Type.DOUBLE)), - Schema.Field.of("bytes_field", Schema.of(Schema.Type.BYTES)), - Schema.Field.of("array_field", Schema.arrayOf(Schema.nullableOf(Schema.of(Schema.Type.STRING)))), - Schema.Field.of("map_field", Schema.mapOf( + "rec", + Schema.Field.of("bool_field", Schema.nullableOf(Schema.of(Schema.Type.BOOLEAN))), + Schema.Field.of("int_field", Schema.of(Schema.Type.INT)), + Schema.Field.of("long_field", Schema.of(Schema.Type.LONG)), + Schema.Field.of("float_field", Schema.of(Schema.Type.FLOAT)), + Schema.Field.of("double_field", Schema.of(Schema.Type.DOUBLE)), + Schema.Field.of("bytes_field", Schema.of(Schema.Type.BYTES)), + Schema.Field.of("array_field", + Schema.arrayOf(Schema.nullableOf(Schema.of(Schema.Type.STRING)))), + Schema.Field.of("map_field", Schema.mapOf( Schema.nullableOf(Schema.of(Schema.Type.STRING)), Schema.nullableOf(Schema.of(Schema.Type.INT)))), Schema.Field.of("record_field", Schema.nullableOf(Schema.recordOf( @@ -309,47 +310,48 @@ public void testNestedSQL() throws IOException { Schema.Field.of("z", Schema.mapOf(Schema.of(Schema.Type.BYTES), Schema.of(Schema.Type.DOUBLE)))), Schema.arrayOf(Schema.recordOf( - "rec2", - Schema.Field.of("x", - // Map, Map x - Schema.mapOf(Schema.arrayOf(Schema.of(Schema.Type.BYTES)), - Schema.mapOf(Schema.of(Schema.Type.BOOLEAN), - Schema.of(Schema.Type.BYTES))) - ))) + "rec2", + Schema.Field.of("x", + // Map, Map x + Schema.mapOf(Schema.arrayOf(Schema.of(Schema.Type.BYTES)), + Schema.mapOf(Schema.of(Schema.Type.BOOLEAN), + Schema.of(Schema.Type.BYTES))) + ))) )), - Schema.Field.of("y", Schema.of(Schema.Type.INT))); + Schema.Field.of("y", Schema.of(Schema.Type.INT))); String schemaStr = - "x map<" + - "record<" + - "x:string not null," + - "y:array not null," + - "z:map not null" + - "> not null," + - "array<" + - "record<" + - "x:map<" + - "array not null," + - "map not null" + - "> not null" + - "> not null" + - "> not null" + - "> not null, y int not null"; + "x map<" + + "record<" + + "x:string not null," + + "y:array not null," + + "z:map not null" + + "> not null," + + "array<" + + "record<" + + "x:map<" + + "array not null," + + "map not null" + + "> not null" + + "> not null" + + "> not null" + + "> not null, y int not null"; Assert.assertEquals(expected, Schema.parseSQL(schemaStr)); } @Test public void testParseSQLWithWhitespace() throws IOException { - String schemaStr = "map_field map< string , int > not null,\n" + - "arr_field array< record< x:int , y:double >\t> not null"; + String schemaStr = "map_field map< string , int > not null,\n" + + "arr_field array< record< x:int , y:double >\t> not null"; Schema expectedSchema = Schema.recordOf( - "rec", - Schema.Field.of("map_field", Schema.mapOf( - Schema.nullableOf(Schema.of(Schema.Type.STRING)), Schema.nullableOf(Schema.of(Schema.Type.INT)))), - Schema.Field.of("arr_field", - Schema.arrayOf(Schema.nullableOf( - Schema.recordOf("rec1", - Schema.Field.of("x", Schema.nullableOf(Schema.of(Schema.Type.INT))), - Schema.Field.of("y", Schema.nullableOf(Schema.of(Schema.Type.DOUBLE))))))) + "rec", + Schema.Field.of("map_field", Schema.mapOf( + Schema.nullableOf(Schema.of(Schema.Type.STRING)), + Schema.nullableOf(Schema.of(Schema.Type.INT)))), + Schema.Field.of("arr_field", + Schema.arrayOf(Schema.nullableOf( + Schema.recordOf("rec1", + Schema.Field.of("x", Schema.nullableOf(Schema.of(Schema.Type.INT))), + Schema.Field.of("y", Schema.nullableOf(Schema.of(Schema.Type.DOUBLE))))))) ); Assert.assertEquals(expectedSchema, Schema.parseSQL(schemaStr)); } diff --git a/cdap-data-fabric-tests/src/test/java/io/cdap/cdap/data2/transaction/distributed/TransactionServiceTest.java b/cdap-data-fabric-tests/src/test/java/io/cdap/cdap/data2/transaction/distributed/TransactionServiceTest.java index 9edbc39e82ef..9a24101e2fe4 100644 --- a/cdap-data-fabric-tests/src/test/java/io/cdap/cdap/data2/transaction/distributed/TransactionServiceTest.java +++ b/cdap-data-fabric-tests/src/test/java/io/cdap/cdap/data2/transaction/distributed/TransactionServiceTest.java @@ -212,8 +212,8 @@ private void verifyGetAndPut(final Table table, TransactionExecutor txExecutor, txExecutor.execute(() -> { byte[] existing = table.get(Bytes.toBytes("row"), Bytes.toBytes("col")); - Assert.assertTrue((verifyGet == null && existing == null) || - Arrays.equals(Bytes.toBytes(verifyGet), existing)); + Assert.assertTrue((verifyGet == null && existing == null) + || Arrays.equals(Bytes.toBytes(verifyGet), existing)); table.put(Bytes.toBytes("row"), Bytes.toBytes("col"), Bytes.toBytes(toPut)); }); } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data/dataset/SystemDatasetInstantiator.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data/dataset/SystemDatasetInstantiator.java index 74dee679ce46..d38fc34db954 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data/dataset/SystemDatasetInstantiator.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data/dataset/SystemDatasetInstantiator.java @@ -73,9 +73,9 @@ public SystemDatasetInstantiator(DatasetFramework datasetFramework, this.owners = owners; this.classLoaderProvider = classLoaderProvider; this.datasetFramework = datasetFramework; - this.parentClassLoader = parentClassLoader == null ? - Objects.firstNonNull(Thread.currentThread().getContextClassLoader(), - getClass().getClassLoader()) : + this.parentClassLoader = parentClassLoader == null + ? Objects.firstNonNull(Thread.currentThread().getContextClassLoader(), + getClass().getClassLoader()) : parentClassLoader; } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data/runtime/DataSetsModules.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data/runtime/DataSetsModules.java index 56b7a0918248..f2ba3d6370e4 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data/runtime/DataSetsModules.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data/runtime/DataSetsModules.java @@ -181,8 +181,8 @@ public MetadataStorage get() { if (Constants.Metadata.STORAGE_PROVIDER_ELASTICSEARCH.equalsIgnoreCase(config)) { return injector.getInstance(ElasticsearchMetadataStorage.class); } - throw new IllegalArgumentException("Unsupported MetadataStorage '" + config + "'. Only '" + - Constants.Metadata.STORAGE_PROVIDER_NOSQL + "' and '" + - Constants.Metadata.STORAGE_PROVIDER_ELASTICSEARCH + "' are allowed."); + throw new IllegalArgumentException("Unsupported MetadataStorage '" + config + "'. Only '" + + Constants.Metadata.STORAGE_PROVIDER_NOSQL + "' and '" + + Constants.Metadata.STORAGE_PROVIDER_ELASTICSEARCH + "' are allowed."); } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/audit/AuditPublishers.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/audit/AuditPublishers.java index a58454ee277f..4941313331c8 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/audit/AuditPublishers.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/audit/AuditPublishers.java @@ -181,18 +181,18 @@ public boolean equals(Object obj) { } AccessAuditInfo that = (AccessAuditInfo) obj; - return Objects.equals(accessorEntity, that.accessorEntity) && - Objects.equals(accessedEntity, that.accessedEntity) && - Objects.equals(accessType, that.accessType); + return Objects.equals(accessorEntity, that.accessorEntity) + && Objects.equals(accessedEntity, that.accessedEntity) + && Objects.equals(accessType, that.accessType); } @Override public String toString() { - return "AccessedEntityInfo{" + - "accessorEntity='" + accessorEntity + '\'' + - "accessedEntity='" + accessedEntity + '\'' + - ", accessType='" + accessType + - '}'; + return "AccessedEntityInfo{" + + "accessorEntity='" + accessorEntity + '\'' + + "accessedEntity='" + accessedEntity + '\'' + + ", accessType='" + accessType + + '}'; } } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetServiceClient.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetServiceClient.java index ccead56b2842..5c26ecac0997 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetServiceClient.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetServiceClient.java @@ -393,8 +393,8 @@ private HttpRequest.Builder addUserIdHeader(HttpRequest.Builder builder) if (!kerberosEnabled || currUserShortName.equals(masterShortUserName)) { LOG.trace( "Accessing dataset in system namespace using the system principal because the current user " - + - "{} is the same as the CDAP master user {}.", + + + "{} is the same as the CDAP master user {}.", currUserShortName, masterShortUserName); userId = currUserShortName; } @@ -417,15 +417,15 @@ private static void logThreadDump() { @SuppressWarnings("StringConcatenationInsideStringBufferAppend") private static void append(StringBuilder sb, ThreadInfo threadInfo) { - sb.append("\"" + threadInfo.getThreadName() + "\"" + - " Id=" + threadInfo.getThreadId() + " " + - threadInfo.getThreadState()); + sb.append("\"" + threadInfo.getThreadName() + "\"" + + " Id=" + threadInfo.getThreadId() + " " + + threadInfo.getThreadState()); if (threadInfo.getLockName() != null) { sb.append(" on " + threadInfo.getLockName()); } if (threadInfo.getLockOwnerName() != null) { - sb.append(" owned by \"" + threadInfo.getLockOwnerName() + - "\" Id=" + threadInfo.getLockOwnerId()); + sb.append(" owned by \"" + threadInfo.getLockOwnerName() + + "\" Id=" + threadInfo.getLockOwnerId()); } if (threadInfo.isSuspended()) { sb.append(" (suspended)"); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetsUtil.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetsUtil.java index bc22d0e0fee7..48c4944afa3b 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetsUtil.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/DatasetsUtil.java @@ -181,16 +181,16 @@ public static DatasetSpecification fixOriginalProperties(@Nullable DatasetSpecif } public static boolean isUserDataset(DatasetId datasetInstanceId) { - return !NamespaceId.SYSTEM.equals(datasetInstanceId.getParent()) && - !isSystemDatasetInUserNamespace(datasetInstanceId); + return !NamespaceId.SYSTEM.equals(datasetInstanceId.getParent()) + && !isSystemDatasetInUserNamespace(datasetInstanceId); } public static boolean isSystemDatasetInUserNamespace(DatasetId datasetInstanceId) { - return !NamespaceId.SYSTEM.equals(datasetInstanceId.getParent()) && - ("system.queue.config".equals(datasetInstanceId.getEntityName()) || - datasetInstanceId.getEntityName().startsWith("system.sharded.queue") || - datasetInstanceId.getEntityName().startsWith("system.queue") || - datasetInstanceId.getEntityName().startsWith("system.stream")); + return !NamespaceId.SYSTEM.equals(datasetInstanceId.getParent()) + && ("system.queue.config".equals(datasetInstanceId.getEntityName()) + || datasetInstanceId.getEntityName().startsWith("system.sharded.queue") + || datasetInstanceId.getEntityName().startsWith("system.queue") + || datasetInstanceId.getEntityName().startsWith("system.stream")); } /** diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/RemoteDatasetFramework.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/RemoteDatasetFramework.java index 0435832dc7bd..14e0fbca6c3d 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/RemoteDatasetFramework.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/RemoteDatasetFramework.java @@ -87,8 +87,9 @@ public class RemoteDatasetFramework implements DatasetFramework { private static final Logger LOG = LoggerFactory.getLogger(RemoteDatasetFramework.class); private static final Predicate RETRYABLE_PREDICATE = t -> - t instanceof RetryableException || - (t instanceof UncheckedExecutionException && t.getCause() instanceof RetryableException); + t instanceof RetryableException + || (t instanceof UncheckedExecutionException + && t.getCause() instanceof RetryableException); private final CConfiguration cConf; private final LoadingCache clientCache; diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/service/DatasetInstanceService.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/service/DatasetInstanceService.java index 4b3d9a073c01..f4aca121cf46 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/service/DatasetInstanceService.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/service/DatasetInstanceService.java @@ -464,8 +464,8 @@ void dropAll(NamespaceId namespaceId) throws Exception { * @throws NamespaceNotFoundException if the requested namespace was not found * @throws IOException if there was a problem in checking if the namespace exists over HTTP * @throws UnauthorizedException if perimeter security and authorization are enabled, and the - * current user does not have - - *
      + * current user does not have + - *
        *
      1. {@link StandardPermission#DELETE} privileges on the dataset for "truncate"
      2. *
      3. {@link StandardPermission#UPDATE} privileges on the dataset for "upgrade"
      4. *
      5. read privileges on the dataset for "exists"
      6. diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/ConstantClassLoaderProvider.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/ConstantClassLoaderProvider.java index b1fd9c7acc88..b964107d4a4a 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/ConstantClassLoaderProvider.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/ConstantClassLoaderProvider.java @@ -36,9 +36,9 @@ public ConstantClassLoaderProvider() { } public ConstantClassLoaderProvider(@Nullable ClassLoader classLoader) { - this.classLoader = classLoader == null ? - Objects.firstNonNull(Thread.currentThread().getContextClassLoader(), - getClass().getClassLoader()) : + this.classLoader = classLoader == null + ? Objects.firstNonNull(Thread.currentThread().getContextClassLoader(), + getClass().getClassLoader()) : classLoader; } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/DatasetTypeManager.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/DatasetTypeManager.java index ca9f92a7795c..4fb895bd158d 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/DatasetTypeManager.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/DatasetTypeManager.java @@ -167,8 +167,8 @@ public void addModule(final DatasetModuleId datasetModuleId, final String classN if (!instances.isEmpty()) { throw new DatasetModuleConflictException(String.format( "Attempt to remove dataset types %s from module '%s' that have existing instances: %s. " - + - "Delete them first.", removedTypes, datasetModuleId, + + + "Delete them first.", removedTypes, datasetModuleId, instances.stream() .map(input -> input.getName() + ":" + input.getType()) .collect(Collectors.joining(", ")))); @@ -536,8 +536,8 @@ public T get(String datasetTypeName) { public boolean hasType(String datasetTypeName) { boolean hasType; try { - hasType = registry.hasType(datasetTypeName) || - datasetTypeTable.getType(getNamespaceId().datasetType(datasetTypeName)) != null; + hasType = registry.hasType(datasetTypeName) + || datasetTypeTable.getType(getNamespaceId().datasetType(datasetTypeName)) != null; } catch (IOException e) { throw new RuntimeException(e); } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/DirectoryClassLoaderProvider.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/DirectoryClassLoaderProvider.java index 38e1ef351d3e..619eb787f7c0 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/DirectoryClassLoaderProvider.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/datafabric/dataset/type/DirectoryClassLoaderProvider.java @@ -71,8 +71,9 @@ public ClassLoader get(DatasetModuleMeta moduleMeta, ClassLoader parentClassLoad throws IOException { URI jarLocation = moduleMeta.getJarLocationPath() == null ? null : URI.create(moduleMeta.getJarLocationPath()); - return jarLocation == null ? - parentClassLoader : classLoaders.getUnchecked(new CacheKey(jarLocation, parentClassLoader)); + return jarLocation == null + ? parentClassLoader + : classLoaders.getUnchecked(new CacheKey(jarLocation, parentClassLoader)); } @Override diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/DefaultDatasetRuntimeContext.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/DefaultDatasetRuntimeContext.java index 5d6da7e83e3d..aefd59eddc7e 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/DefaultDatasetRuntimeContext.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/DefaultDatasetRuntimeContext.java @@ -171,8 +171,8 @@ public void onMethodEntry(boolean constructor, @Nullable Class T getDataset(DatasetCacheKey key, boolean bypass) // this better be the same dataset, otherwise the cache did not work throw new IllegalStateException( String.format( - "Unexpected state: Cache returned %s for %s, which is different from the " + - "active transaction aware %s for the same key. This should never happen.", + "Unexpected state: Cache returned %s for %s, which is different from the " + + "active transaction aware %s for the same key. This should never happen.", dataset, key, existing)); } } @@ -287,8 +287,8 @@ private void discardSafely(Object dataset) { public TransactionContext newTransactionContext() throws TransactionFailureException { if (txContext != null && txContext.getCurrentTransaction() != null) { throw new TransactionFailureException( - "Attempted to start a transaction within active transaction " + - txContext.getCurrentTransaction().getTransactionId()); + "Attempted to start a transaction within active transaction " + + txContext.getCurrentTransaction().getTransactionId()); } dismissTransactionContext(); txContext = new DelayedDiscardingTransactionContext(txClient, activeTxAwares.values()); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/SingleTypeModule.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/SingleTypeModule.java index 1186b714caea..7a8be647977e 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/SingleTypeModule.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/SingleTypeModule.java @@ -195,16 +195,16 @@ static Constructor findSuitableCtorOrFail(Class dataSetClass) } if (suitableCtor != null) { throw new IllegalArgumentException( - String.format("Dataset class %s must have single constructor with parameter types of" + - " (DatasetSpecification, [0..n] @EmbeddedDataset Dataset) ", dataSetClass)); + String.format("Dataset class %s must have single constructor with parameter types of" + + " (DatasetSpecification, [0..n] @EmbeddedDataset Dataset) ", dataSetClass)); } suitableCtor = ctor; } if (suitableCtor == null) { throw new IllegalArgumentException( - String.format("Dataset class %s must have single constructor with parameter types of" + - " (DatasetSpecification, [0..n] @EmbeddedDataset Dataset) ", dataSetClass)); + String.format("Dataset class %s must have single constructor with parameter types of" + + " (DatasetSpecification, [0..n] @EmbeddedDataset Dataset) ", dataSetClass)); } return suitableCtor; diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/cube/DefaultCube.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/cube/DefaultCube.java index c5bd3e1d3318..0bb92c0d6ac7 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/cube/DefaultCube.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/cube/DefaultCube.java @@ -233,8 +233,8 @@ public void add(Collection facts) { if (numFacts > 0) { long avgTimestamp = sumTimestamp / numFacts; PROGRESS_LOG.debug( - "Persisted {} updates for {} facts with {} measurements for {} dimension sets " + - "from {} cube facts for timestamps {}..{} (avg {}, lag {}s)", + "Persisted {} updates for {} facts with {} measurements for {} dimension sets " + + "from {} cube facts for timestamps {}..{} (avg {}, lag {}s)", numUpdates.get(), numFacts, numMeasurements, toWrite.size(), facts.size(), minTimestamp, maxTimestamp, avgTimestamp, TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()) - avgTimestamp); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/file/FileSetDataset.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/file/FileSetDataset.java index dcba9fd11654..8668832aa2f5 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/file/FileSetDataset.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/file/FileSetDataset.java @@ -150,8 +150,8 @@ static Location determineBaseLocation(DatasetContext datasetContext, CConfigurat if (hasAbsoluteBasePathBug) { LOG.info( "Dataset {} was created with a version of FileSet that treats absolute path {} as relative. " - + - "To disable this message, upgrade the dataset properties with a relative path. ", + + + "To disable this message, upgrade the dataset properties with a relative path. ", spec.getName(), basePath); } else { String topLevelPath = locationFactory.create("/").toURI().getPath(); @@ -159,8 +159,8 @@ static Location determineBaseLocation(DatasetContext datasetContext, CConfigurat Location baseLocation = Locations.getLocationFromAbsolutePath(locationFactory, basePath); if (baseLocation.toURI().getPath().startsWith(topLevelPath)) { throw new DataSetException( - "Invalid base path '" + basePath + "' for dataset '" + spec.getName() + "'. " + - "It must not be inside the CDAP base path '" + topLevelPath + "'."); + "Invalid base path '" + basePath + "' for dataset '" + spec.getName() + "'. " + + "It must not be inside the CDAP base path '" + topLevelPath + "'."); } return baseLocation; } @@ -190,8 +190,8 @@ private Location createLocation(String relativePath) { try { return baseLocation.append(relativePath); } catch (IOException e) { - throw new DataSetException("Error constructing path from base '" + baseLocation + - "' and relative path '" + relativePath + "'", e); + throw new DataSetException("Error constructing path from base '" + baseLocation + + "' and relative path '" + relativePath + "'", e); } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/hbase/AbstractHBaseDataSetAdmin.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/hbase/AbstractHBaseDataSetAdmin.java index 5a0dd89764ab..57d524516ec4 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/hbase/AbstractHBaseDataSetAdmin.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/hbase/AbstractHBaseDataSetAdmin.java @@ -154,8 +154,8 @@ public void updateTable(boolean force) throws IOException { && hbaseVersion.equals(HBaseVersion.getVersionString()) && version.compareTo(ProjectInfo.getVersion()) >= 0) { // If neither the table spec nor the cdap version have changed, no need to update - LOG.info("Table '{}' has not changed and its version '{}' is same or greater " + - "than current CDAP version '{}'. The underlying HBase version {} has also not changed.", + LOG.info("Table '{}' has not changed and its version '{}' is same or greater " + + "than current CDAP version '{}'. The underlying HBase version {} has also not changed.", tableId, version, ProjectInfo.getVersion(), hbaseVersion); return; } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/BasicPartitionDetail.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/BasicPartitionDetail.java index af0ed4580968..b05d54600b09 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/BasicPartitionDetail.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/BasicPartitionDetail.java @@ -50,9 +50,9 @@ public boolean equals(Object o) { BasicPartitionDetail that = (BasicPartitionDetail) o; - return Objects.equal(this.metadata, that.metadata) && - Objects.equal(this.relativePath, that.relativePath) && - Objects.equal(this.key, that.key); + return Objects.equal(this.metadata, that.metadata) + && Objects.equal(this.relativePath, that.relativePath) + && Objects.equal(this.key, that.key); } @Override diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/PartitionedFileSetDataset.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/PartitionedFileSetDataset.java index a5d45dd9c3a0..4c7c897612a3 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/PartitionedFileSetDataset.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/PartitionedFileSetDataset.java @@ -313,8 +313,8 @@ public void addPartition(PartitionKey key, String path, Map meta String existingPath = Bytes.toString(row.get(RELATIVE_PATH)); if (!path.equals(existingPath)) { throw new DataSetException( - String.format("Attempting to append to Dataset '%s', to partition '%s' with a " + - "different path. Original path: '%s'. New path: '%s'", + String.format("Attempting to append to Dataset '%s', to partition '%s' with a " + + "different path. Original path: '%s'. New path: '%s'", getName(), key.toString(), existingPath, path)); } } @@ -606,8 +606,8 @@ byte[] assertNotExists(PartitionKey key, boolean supportNonTransactional) { for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) { sb.append("\n\tat ").append(stackTraceElement.toString()); } - SAMPLING_LOG.warn("Operation should be performed within a transaction. " + - "This operation may require a transaction in the future. {}", sb); + SAMPLING_LOG.warn("Operation should be performed within a transaction. " + + "This operation may require a transaction in the future. {}", sb); } // to handle backwards compatibility (user might have called PartitionedFileSet#getPartitionOutput outside // of a transaction), we can't check partition existence via the partitionsTable. As an fallback approach, @@ -1026,16 +1026,16 @@ public void consume(PartitionKey key, String path, }); } catch (TransactionConflictException e) { throw new DataSetException( - "Transaction conflict while reading partitions. This should never happen. " + - "Make sure that no other programs are using this dataset at the same time."); + "Transaction conflict while reading partitions. This should never happen. " + + "Make sure that no other programs are using this dataset at the same time."); } catch (TransactionFailureException e) { throw new DataSetException("Transaction failure: " + e.getMessage(), e.getCause()); } catch (RuntimeException e) { // this looks like duplication but is needed in case this is run from a worker: see CDAP-6837 if (e.getCause() instanceof TransactionConflictException) { throw new DataSetException( - "Transaction conflict while reading partitions. This should never happen. " + - "Make sure that no other programs are using this dataset at the same time."); + "Transaction conflict while reading partitions. This should never happen. " + + "Make sure that no other programs are using this dataset at the same time."); } else if (e.getCause() instanceof TransactionFailureException) { throw new DataSetException("Transaction failure: " + e.getMessage(), e.getCause().getCause()); @@ -1063,8 +1063,8 @@ private void warnIfInvalidPartitionFilter(PartitionFilter filter, Partitioning p if (!partitioning.getFields().containsKey(entry.getKey())) { LOG.warn( "Partition filter cannot match any partitions in dataset '{}' because it contains field '{}' " - + - "that is not a valid partitioning field", getName(), entry.getKey()); + + + "that is not a valid partitioning field", getName(), entry.getKey()); } } } @@ -1233,14 +1233,14 @@ static PartitionKey parseRowKey(byte[] rowKey, Partitioning partitioning) { if (!first) { if (offset >= rowKey.length) { throw new IllegalArgumentException( - String.format("Invalid row key: Expecting field '%s' at offset %d " + - "but the end of the row key is reached.", fieldName, offset)); + String.format("Invalid row key: Expecting field '%s' at offset %d " + + "but the end of the row key is reached.", fieldName, offset)); } if (rowKey[offset] != 0) { throw new IllegalArgumentException( String.format( - "Invalid row key: Expecting field separator \\0 before field '%s' at offset %d " + - "but found byte value %x.", fieldName, offset, rowKey[offset])); + "Invalid row key: Expecting field separator \\0 before field '%s' at offset %d " + + "but found byte value %x.", fieldName, offset, rowKey[offset])); } offset++; } @@ -1248,8 +1248,8 @@ static PartitionKey parseRowKey(byte[] rowKey, Partitioning partitioning) { int size = FieldTypes.determineLengthInBytes(rowKey, offset, fieldType); if (size + offset > rowKey.length) { throw new IllegalArgumentException( - String.format("Invalid row key: Expecting field '%s' of type %s, " + - "requiring %d bytes at offset %d, but only %d bytes remain.", + String.format("Invalid row key: Expecting field '%s' of type %s, " + + "requiring %d bytes at offset %d, but only %d bytes remain.", fieldName, fieldType.name(), size, offset, rowKey.length - offset)); } Comparable fieldValue = FieldTypes.fromBytes(rowKey, offset, size, fieldType); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/PartitionedFileSetDefinition.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/PartitionedFileSetDefinition.java index 6d91b569aefc..6f7ea6c3cd2e 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/PartitionedFileSetDefinition.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/PartitionedFileSetDefinition.java @@ -153,8 +153,8 @@ public DatasetSpecification reconfigure(String instanceName, DatasetProperties.Builder newFileProperties = DatasetProperties.builder() .addAll(properties.getProperties()); String useNameAsBasePathDefault = currentSpec.getProperty(NAME_AS_BASE_PATH_DEFAULT); - if (Boolean.parseBoolean(useNameAsBasePathDefault) && - !properties.getProperties().containsKey(FileSetProperties.BASE_PATH)) { + if (Boolean.parseBoolean(useNameAsBasePathDefault) + && !properties.getProperties().containsKey(FileSetProperties.BASE_PATH)) { newFileProperties.add(FileSetProperties.BASE_PATH, instanceName); pfsProperties.put(NAME_AS_BASE_PATH_DEFAULT, Boolean.TRUE.toString()); } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/TimePartitionedFileSetDataset.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/TimePartitionedFileSetDataset.java index d5d402af673b..644c271ce140 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/TimePartitionedFileSetDataset.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/partitioned/TimePartitionedFileSetDataset.java @@ -73,9 +73,9 @@ public TimePartitionedFileSetDataset(DatasetContext datasetContext, String name, // the first version of TPFS in CDAP 2.7 did not have the partitioning in the properties. It is not supported. if (PartitionedFileSetProperties.getPartitioning(spec.getProperties()) == null) { throw new DataSetException( - "Unsupported version of TimePartitionedFileSet. Dataset '" + name + "' is missing " + - "the partitioning property. This probably means that it was created in CDAP 2.7, " + - "which is not supported any longer."); + "Unsupported version of TimePartitionedFileSet. Dataset '" + name + "' is missing " + + "the partitioning property. This probably means that it was created in CDAP 2.7, " + + "which is not supported any longer."); } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/AbstractTable.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/AbstractTable.java index 1e20da79a232..c9ef226b41ba 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/AbstractTable.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/AbstractTable.java @@ -74,8 +74,8 @@ public abstract class AbstractTable implements Table, TransactionAware { protected AbstractTable(Map props) { this.tableSchema = TableProperties.getSchema(props); this.rowFieldName = TableProperties.getRowFieldName(props); - this.recordPutTransformer = (tableSchema == null || rowFieldName == null) ? - null : new RecordPutTransformer(rowFieldName, tableSchema); + this.recordPutTransformer = (tableSchema == null || rowFieldName == null) + ? null : new RecordPutTransformer(rowFieldName, tableSchema); } @ReadOnly @@ -88,8 +88,8 @@ public byte[] get(byte[] row, byte[] column) { @ReadOnly @Override public Row get(Get get) { - return get.getColumns() == null ? - get(get.getRow()) : + return get.getColumns() == null + ? get(get.getRow()) : get(get.getRow(), get.getColumns().toArray(new byte[get.getColumns().size()][])); } @@ -222,8 +222,8 @@ public RecordScanner createSplitRecordScanner(Split split) { public void write(StructuredRecord structuredRecord) throws IOException { if (recordPutTransformer == null) { throw new IllegalStateException( - String.format("Table must have both '%s' and '%s' properties set in " + - "order to be used as a RecordWritable.", Table.PROPERTY_SCHEMA, + String.format("Table must have both '%s' and '%s' properties set in " + + "order to be used as a RecordWritable.", Table.PROPERTY_SCHEMA, Table.PROPERTY_SCHEMA_ROW_FIELD)); } Put put = recordPutTransformer.toPut(structuredRecord); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/BufferingTable.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/BufferingTable.java index a9c8ae92668a..ed5280c3aaa1 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/BufferingTable.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/BufferingTable.java @@ -600,8 +600,8 @@ protected Row internalIncrementAndGet(byte[] row, byte[][] columns, long[] amoun rowMap = getRowMap(row, columns); reportRead(1); } catch (Exception e) { - LOG.debug("incrementAndGet failed for table: " + getTransactionAwareName() + - ", row: " + Bytes.toStringBinary(row), e); + LOG.debug("incrementAndGet failed for table: " + getTransactionAwareName() + + ", row: " + Bytes.toStringBinary(row), e); throw new DataSetException("incrementAndGet failed", e); } @@ -618,9 +618,9 @@ protected Row internalIncrementAndGet(byte[] row, byte[][] columns, long[] amoun } else { if (val.length != Bytes.SIZEOF_LONG) { throw new NumberFormatException( - "Attempted to increment a value that is not convertible to long," + - " row: " + Bytes.toStringBinary(row) + - " column: " + Bytes.toStringBinary(column)); + "Attempted to increment a value that is not convertible to long," + + " row: " + Bytes.toStringBinary(row) + + " column: " + Bytes.toStringBinary(column)); } longVal = Bytes.toLong(val); } @@ -674,8 +674,8 @@ public boolean compareAndSwap(byte[] row, byte[] column, byte[] expectedValue, b return true; } } catch (Exception e) { - LOG.debug("compareAndSwap failed for table: " + getTransactionAwareName() + - ", row: " + Bytes.toStringBinary(row), e); + LOG.debug("compareAndSwap failed for table: " + getTransactionAwareName() + + ", row: " + Bytes.toStringBinary(row), e); throw new DataSetException("compareAndSwap failed", e); } @@ -721,8 +721,8 @@ public Scanner scan(Scan scan) { try { return new BufferingScanner(bufferMap, scanPersisted(scan)); } catch (Exception e) { - LOG.debug("scan failed for table: " + getTransactionAwareName() + - ", scan: " + scan.toString(), e); + LOG.debug("scan failed for table: " + getTransactionAwareName() + + ", scan: " + scan.toString(), e); throw new DataSetException("scan failed", e); } } @@ -1121,8 +1121,8 @@ private void warnAboutEmptyValue(byte[] column) { "To reduce log verbosity, this warning will now only be logged one in %d times", warnFrequency); } - LOG.warn("Attempt to write an empty value to column '{}' of table '{}'. " + - "This will result in deleting the column. {}", Bytes.toString(column), name, + LOG.warn("Attempt to write an empty value to column '{}' of table '{}'. " + + "This will result in deleting the column. {}", Bytes.toString(column), name, additionalMessage); } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/FuzzyRowFilter.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/FuzzyRowFilter.java index 9e516e20ac8d..bcf3867a11a0 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/FuzzyRowFilter.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/FuzzyRowFilter.java @@ -120,10 +120,10 @@ public byte[] getNextRowHint(byte[] rowKey) { if (nextRowKey == null) { // SHOULD NEVER happen // TODO: is there a better way than throw exception? (stop the scanner?) - throw new IllegalStateException("No next row key that satisfies fuzzy exists when" + - " getNextKeyHint() is invoked." + - " Filter: " + this.toString() + - " RowKey: " + Bytes.toStringBinary(rowKey)); + throw new IllegalStateException("No next row key that satisfies fuzzy exists when" + + " getNextKeyHint() is invoked." + + " Filter: " + this.toString() + + " RowKey: " + Bytes.toStringBinary(rowKey)); } return nextRowKey; } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/ObjectMappedTableDataset.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/ObjectMappedTableDataset.java index 13f3d08391ca..f883e35aa054 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/ObjectMappedTableDataset.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/ObjectMappedTableDataset.java @@ -91,10 +91,10 @@ private ReflectionRowReader getReflectionRowReader() { if (missingClass != null) { LOG.error( "Cannot load dataset because class {} could not be found. This is probably because the " - + - "type parameter of the dataset is not present in the dataset's jar file. See the developer " - + - "guide for more information.", missingClass); + + + "type parameter of the dataset is not present in the dataset's jar file. See the developer " + + + "guide for more information.", missingClass); } throw e; } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/ObjectMappedTableDefinition.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/ObjectMappedTableDefinition.java index a7588338ac14..2ef9605c2314 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/ObjectMappedTableDefinition.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/ObjectMappedTableDefinition.java @@ -135,8 +135,8 @@ private void validateSchema(Schema schema) throws UnsupportedTypeException { fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (!fieldType.isSimpleType()) { throw new UnsupportedTypeException( - String.format("Field %s is of unsupported type %s." + - " Must be a simple type (boolean, int, long, float, double, string, bytes).", + String.format("Field %s is of unsupported type %s." + + " Must be a simple type (boolean, int, long, float, double, string, bytes).", field.getName(), fieldType.toString())); } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/hbase/HBaseMetricsTable.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/hbase/HBaseMetricsTable.java index 96a6dc866139..f1b90bd4970e 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/hbase/HBaseMetricsTable.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/hbase/HBaseMetricsTable.java @@ -217,8 +217,8 @@ public void increment(byte[] row, Map increments) { // currently there is not other way to extract that from the HBase exception than string match if (e.getMessage() != null && e.getMessage().contains("isn't 64 bits wide")) { throw new NumberFormatException( - "Attempted to increment a value that is not convertible to long," + - " row: " + Bytes.toStringBinary(distributedKey)); + "Attempted to increment a value that is not convertible to long," + + " row: " + Bytes.toStringBinary(distributedKey)); } throw new DataSetException("Increment failed on table " + tableId, e); } @@ -281,8 +281,8 @@ public long incrementAndGet(byte[] row, byte[] column, long delta) { // currently there is not other way to extract that from the HBase exception than string match if (e.getMessage() != null && e.getMessage().contains("isn't 64 bits wide")) { throw new NumberFormatException( - "Attempted to increment a value that is not convertible to long," + - " row: " + Bytes.toStringBinary(distributedKey) + + "Attempted to increment a value that is not convertible to long," + + " row: " + Bytes.toStringBinary(distributedKey) + " column: " + Bytes.toStringBinary(column)); } throw new DataSetException("IncrementAndGet failed on table " + tableId, e); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/hbase/HBaseMetricsTableDefinition.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/hbase/HBaseMetricsTableDefinition.java index e218aed1671e..e100e25adce5 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/hbase/HBaseMetricsTableDefinition.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/hbase/HBaseMetricsTableDefinition.java @@ -125,8 +125,8 @@ public MetricsTable getDataset(DatasetContext datasetContext, DatasetSpecificati // Log a warning if that's the case. if (cConf.getInt(Constants.Metrics.METRICS_HBASE_TABLE_SPLITS) != datasetSplits) { CONFIG_CHANGE_LOG.warn( - "Ignoring configuration {} with value {} from cdap-site.xml. " + - "The system table {} already has a splits value {}, which can not be changed.", + "Ignoring configuration {} with value {} from cdap-site.xml. " + + "The system table {} already has a splits value {}, which can not be changed.", Constants.Metrics.METRICS_HBASE_TABLE_SPLITS, cConf.getInt(Constants.Metrics.METRICS_HBASE_TABLE_SPLITS), spec.getName(), datasetSplits); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/KeyValue.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/KeyValue.java index 555cb761b6d0..f3e1e552d9fe 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/KeyValue.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/KeyValue.java @@ -71,8 +71,8 @@ public class KeyValue { // How far into the key the row starts at. First thing to read is the short // that says how long the row is. public static final int ROW_OFFSET = - Bytes.SIZEOF_INT /*keylength*/ + - Bytes.SIZEOF_INT /*valuelength*/; + Bytes.SIZEOF_INT /*keylength*/ + + Bytes.SIZEOF_INT /*valuelength*/; // Size of the length ints in a KeyValue datastructure. public static final int KEYVALUE_INFRASTRUCTURE_SIZE = ROW_OFFSET; diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/LevelDBTableCore.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/LevelDBTableCore.java index cae65d653e50..47742943dab9 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/LevelDBTableCore.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/LevelDBTableCore.java @@ -158,9 +158,9 @@ private long incrementValue(long value, @Nullable byte[] existingValue, byte[] r } if (existingValue.length != Bytes.SIZEOF_LONG) { throw new NumberFormatException( - "Attempted to increment a value that is not convertible to long," + - " row: " + Bytes.toStringBinary(row) + - " column: " + Bytes.toStringBinary(col)); + "Attempted to increment a value that is not convertible to long," + + " row: " + Bytes.toStringBinary(row) + + " column: " + Bytes.toStringBinary(col)); } return value + Bytes.toLong(existingValue); } @@ -378,8 +378,8 @@ private static ImmutablePair> getRow(DBIter // have we seen this row & column before? byte[] row = kv.getRow(); byte[] column = kv.getQualifier(); - boolean seenThisColumn = previousRow != null && Bytes.equals(previousRow, row) && - previousCol != null && Bytes.equals(previousCol, column); + boolean seenThisColumn = previousRow != null && Bytes.equals(previousRow, row) + && previousCol != null && Bytes.equals(previousCol, column); if (seenThisColumn) { continue; } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/LevelDBTableService.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/LevelDBTableService.java index 45b0b5960082..f1cae276603d 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/LevelDBTableService.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/table/leveldb/LevelDBTableService.java @@ -202,8 +202,8 @@ public void compact(String tableName) { long failedMillis = System.currentTimeMillis(); LOG.debug( "LevelDBTableService background periodic compaction on table {} failed after {} millis. " - + - "Ignore and try again later: ", failedMillis - startMillis, e); + + + "Ignore and try again later: ", failedMillis - startMillis, e); } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/timeseries/EntityTable.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/timeseries/EntityTable.java index a8c69e1918d3..13dd05ff715d 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/timeseries/EntityTable.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/timeseries/EntityTable.java @@ -178,8 +178,8 @@ public Long load(EntityName key) throws Exception { } if (key.getName() == null || key.getName().isEmpty()) { - LOG.warn("Adding mapping for " + (key.getName() == null ? "null" : "empty") + " name, " + - " with type " + key.getType() + ", new id is " + newId); + LOG.warn("Adding mapping for " + (key.getName() == null ? "null" : "empty") + " name, " + + " with type " + key.getType() + ", new id is " + newId); } // Save the mapping diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/timeseries/FactTable.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/timeseries/FactTable.java index 5763505ce293..2d7b036ffcb9 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/timeseries/FactTable.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/lib/timeseries/FactTable.java @@ -587,8 +587,8 @@ public boolean equals(Object o) { return false; } FactCacheKey that = (FactCacheKey) o; - return Objects.equals(dimensionValues, that.dimensionValues) && - Objects.equals(metricName, that.metricName); + return Objects.equals(dimensionValues, that.dimensionValues) + && Objects.equals(metricName, that.metricName); } @Override diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/preview/PreviewDatasetFramework.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/preview/PreviewDatasetFramework.java index 9781b576bc6c..2e4f9975f99c 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/preview/PreviewDatasetFramework.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/dataset2/preview/PreviewDatasetFramework.java @@ -108,8 +108,8 @@ public void addInstance(String datasetTypeName, DatasetId datasetInstanceId, @Nullable KerberosPrincipalId ownerPrincipal) throws DatasetManagementException, IOException { if (ownerPrincipal != null) { throw new UnsupportedOperationException( - "Creating dataset instance with owner is not supported in preview, " + - "please try to start the preview without the ownership"); + "Creating dataset instance with owner is not supported in preview, " + + "please try to start the preview without the ownership"); } super.addInstance(datasetTypeName, datasetInstanceId, props, null); } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataDataset.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataDataset.java index 60b5cda42ea1..3af252951073 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataDataset.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataDataset.java @@ -687,8 +687,8 @@ private ImmutablePair getFuzzyKeyFor(MetadataEntity metadataEnti /** * Searches entities that match the specified search query in the specified namespace and {@link * NamespaceId#SYSTEM} for the specified types. When using default sorting, limits, cursors, and - * offset are ignored and all results are returned. When using custom sorting, at most offset + - * limit * (numCursors + 1) results are returned. When using default sorting, results are returned + * offset are ignored and all results are returned. When using custom sorting, at most offset + + * limit * (numCursors + 1) results are returned. When using default sorting, results are returned * in whatever order is determined by the underlying storage. When using custom sorting, results * are returned sorted according to the field and order specified. When using default sorting, any * query is allowed. When using custom sorting, the query must be '*'. In all cases, duplicate @@ -713,8 +713,8 @@ public SearchResults search(SearchRequest request) throws BadRequestException { private SearchResults searchByDefaultIndex(SearchRequest request) { List results = new LinkedList<>(); - String column = request.isNamespaced() ? - DEFAULT_INDEX_COLUMN.getColumn() : DEFAULT_INDEX_COLUMN.getCrossNamespaceColumn(); + String column = request.isNamespaced() + ? DEFAULT_INDEX_COLUMN.getColumn() : DEFAULT_INDEX_COLUMN.getCrossNamespaceColumn(); for (SearchTerm searchTerm : getSearchTerms(request)) { Scanner scanner; @@ -772,8 +772,9 @@ private SearchResults searchByCustomIndex(SearchRequest request) throws BadReque byte[] namespaceStartKey = Bytes.toBytes(searchTerm.getTerm()); byte[] startKey = namespaceStartKey; if (!Strings.isNullOrEmpty(cursor)) { - String prefix = searchTerm.getNamespaceId() == null ? - "" : searchTerm.getNamespaceId().getNamespace() + MetadataConstants.KEYVALUE_SEPARATOR; + String prefix = searchTerm.getNamespaceId() == null + ? "" + : searchTerm.getNamespaceId().getNamespace() + MetadataConstants.KEYVALUE_SEPARATOR; startKey = Bytes.toBytes(prefix + cursor); } @SuppressWarnings("ConstantConditions") @@ -1292,9 +1293,9 @@ public boolean equals(Object o) { Record that = (Record) o; - return Objects.equals(metadataEntity, that.metadataEntity) && - Objects.equals(properties, that.properties) && - Objects.equals(tags, that.tags); + return Objects.equals(metadataEntity, that.metadataEntity) + && Objects.equals(properties, that.properties) + && Objects.equals(tags, that.tags); } @Override @@ -1304,11 +1305,11 @@ public int hashCode() { @Override public String toString() { - return "MetaRecord{" + - "metadataEntity=" + metadataEntity + - ", properties=" + properties + - ", tags=" + tags + - '}'; + return "MetaRecord{" + + "metadataEntity=" + metadataEntity + + ", properties=" + properties + + ", tags=" + tags + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataEntry.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataEntry.java index afce7376581d..5240d6ad7df7 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataEntry.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataEntry.java @@ -70,9 +70,9 @@ public boolean equals(Object o) { MetadataEntry that = (MetadataEntry) o; - return Objects.equals(metadataEntity, that.metadataEntity) && - Objects.equals(key, that.key) && - Objects.equals(value, that.value); + return Objects.equals(metadataEntity, that.metadataEntity) + && Objects.equals(key, that.key) + && Objects.equals(value, that.value); } @Override @@ -82,10 +82,10 @@ public int hashCode() { @Override public String toString() { - return "MetadataEntry{" + - "metadataEntity=" + metadataEntity + - ", key='" + key + '\'' + - ", value='" + value + '\'' + - '}'; + return "MetadataEntry{" + + "metadataEntity=" + metadataEntity + + ", key='" + key + '\'' + + ", value='" + value + '\'' + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataKey.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataKey.java index dbcf4abebbed..e296ed6ef80a 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataKey.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/MetadataKey.java @@ -133,8 +133,8 @@ private static MDSKey.Builder getMDSKeyPrefix(MetadataEntity metadataEntity, byt for (MetadataEntity.KeyValue keyValue : metadataEntity) { // TODO (CDAP-13597): Handle versioning of metadata entities in a better way // if it is a versioned entity then ignore the version - if (MetadataUtil.isVersionedEntityType(metadataEntity.getType()) && - keyValue.getKey().equalsIgnoreCase(MetadataEntity.VERSION)) { + if (MetadataUtil.isVersionedEntityType(metadataEntity.getType()) + && keyValue.getKey().equalsIgnoreCase(MetadataEntity.VERSION)) { continue; } builder.add(keyValue.getKey()); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/SearchRequest.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/SearchRequest.java index 2b7eb670362e..639ecdda9aa7 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/SearchRequest.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/SearchRequest.java @@ -211,16 +211,16 @@ public boolean equals(Object o) { return false; } SearchRequest that = (SearchRequest) o; - return offset == that.offset && - limit == that.limit && - numCursors == that.numCursors && - showHidden == that.showHidden && - Objects.equals(namespaceId, that.namespaceId) && - Objects.equals(query, that.query) && - Objects.equals(types, that.types) && - Objects.equals(sortInfo, that.sortInfo) && - Objects.equals(cursor, that.cursor) && - Objects.equals(entityScope, that.entityScope); + return offset == that.offset + && limit == that.limit + && numCursors == that.numCursors + && showHidden == that.showHidden + && Objects.equals(namespaceId, that.namespaceId) + && Objects.equals(query, that.query) + && Objects.equals(types, that.types) + && Objects.equals(sortInfo, that.sortInfo) + && Objects.equals(cursor, that.cursor) + && Objects.equals(entityScope, that.entityScope); } @Override @@ -232,17 +232,17 @@ public int hashCode() { @Override public String toString() { - return "SearchRequest{" + - "namespaceId=" + namespaceId + - ", query='" + query + '\'' + - ", types=" + types + - ", sortInfo=" + sortInfo + - ", offset=" + offset + - ", limit=" + limit + - ", numCursors=" + numCursors + - ", cursor='" + cursor + '\'' + - ", showHidden=" + showHidden + - ", entityScope=" + entityScope + - '}'; + return "SearchRequest{" + + "namespaceId=" + namespaceId + + ", query='" + query + '\'' + + ", types=" + types + + ", sortInfo=" + sortInfo + + ", offset=" + offset + + ", limit=" + limit + + ", numCursors=" + numCursors + + ", cursor='" + cursor + '\'' + + ", showHidden=" + showHidden + + ", entityScope=" + entityScope + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/SortInfo.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/SortInfo.java index cda0f40e4855..9e338a51ed44 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/SortInfo.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/dataset/SortInfo.java @@ -88,15 +88,15 @@ public static SortInfo of(@Nullable String sort) throws BadRequestException { throw new BadRequestException( String.format( "'sort' parameter should be a space separated string containing the field ('%s' or '%s') and " - + - "the sort order ('%s' or '%s'). Found %s.", MetadataConstants.ENTITY_NAME_KEY, + + + "the sort order ('%s' or '%s'). Found %s.", MetadataConstants.ENTITY_NAME_KEY, MetadataConstants.CREATION_TIME_KEY, SortOrder.ASC, SortOrder.DESC, sort)); } Iterator iterator = sortSplit.iterator(); String sortBy = iterator.next(); String sortOrder = iterator.next(); - if (!MetadataConstants.ENTITY_NAME_KEY.equalsIgnoreCase(sortBy) && - !MetadataConstants.CREATION_TIME_KEY.equalsIgnoreCase(sortBy)) { + if (!MetadataConstants.ENTITY_NAME_KEY.equalsIgnoreCase(sortBy) + && !MetadataConstants.CREATION_TIME_KEY.equalsIgnoreCase(sortBy)) { throw new BadRequestException( String.format("Sort field must be '%s' or '%s'. Found %s.", MetadataConstants.ENTITY_NAME_KEY, @@ -122,8 +122,8 @@ public boolean equals(Object o) { SortInfo that = (SortInfo) o; - return Objects.equals(sortBy, that.sortBy) && - Objects.equals(sortOrder, that.sortOrder); + return Objects.equals(sortBy, that.sortBy) + && Objects.equals(sortOrder, that.sortOrder); } @Override diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/indexer/MetadataEntityTypeIndexer.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/indexer/MetadataEntityTypeIndexer.java index 6aeb94470d5c..5a105cf366a4 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/indexer/MetadataEntityTypeIndexer.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/indexer/MetadataEntityTypeIndexer.java @@ -34,8 +34,8 @@ public class MetadataEntityTypeIndexer implements Indexer { public Set getIndexes(MetadataEntry entry) { Set indexes = new HashSet<>(); indexes.add( - entry.getMetadataEntity().getType().toLowerCase() + MetadataConstants.KEYVALUE_SEPARATOR + - entry.getMetadataEntity().getValue(entry.getMetadataEntity().getType())); + entry.getMetadataEntity().getType().toLowerCase() + MetadataConstants.KEYVALUE_SEPARATOR + + entry.getMetadataEntity().getValue(entry.getMetadataEntity().getType())); return indexes; } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/CollapsedRelation.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/CollapsedRelation.java index 5ebda6fa1076..cb69d167fe59 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/CollapsedRelation.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/CollapsedRelation.java @@ -75,11 +75,11 @@ public boolean equals(Object o) { return false; } CollapsedRelation that = (CollapsedRelation) o; - return Objects.equals(data, that.data) && - Objects.equals(program, that.program) && - Objects.equals(access, that.access) && - Objects.equals(runs, that.runs) && - Objects.equals(components, that.components); + return Objects.equals(data, that.data) + && Objects.equals(program, that.program) + && Objects.equals(access, that.access) + && Objects.equals(runs, that.runs) + && Objects.equals(components, that.components); } @Override @@ -89,12 +89,12 @@ public int hashCode() { @Override public String toString() { - return "CollapsedRelation{" + - "data=" + data + - ", program=" + program + - ", access=" + access + - ", runs=" + runs + - ", components=" + components + - '}'; + return "CollapsedRelation{" + + "data=" + data + + ", program=" + program + + ", access=" + access + + ", runs=" + runs + + ", components=" + components + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/Lineage.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/Lineage.java index ad5a236b4050..59b68653eefa 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/Lineage.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/Lineage.java @@ -54,8 +54,8 @@ public int hashCode() { @Override public String toString() { - return "Lineage{" + - "relations=" + relations + - '}'; + return "Lineage{" + + "relations=" + relations + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/LineageCollapser.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/LineageCollapser.java index 92e3e376655c..5742526a676e 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/LineageCollapser.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/LineageCollapser.java @@ -157,11 +157,11 @@ public boolean equals(Object o) { return false; } CollapseKey that = (CollapseKey) o; - return Objects.equals(data, that.data) && - Objects.equals(program, that.program) && - Objects.equals(access, that.access) && - Objects.equals(run, that.run) && - Objects.equals(components, that.components); + return Objects.equals(data, that.data) + && Objects.equals(program, that.program) + && Objects.equals(access, that.access) + && Objects.equals(run, that.run) + && Objects.equals(components, that.components); } @Override @@ -171,13 +171,13 @@ public int hashCode() { @Override public String toString() { - return "CollapseKey{" + - "data=" + data + - ", program=" + program + - ", access=" + access + - ", run=" + run + - ", components=" + components + - '}'; + return "CollapseKey{" + + "data=" + data + + ", program=" + program + + ", access=" + access + + ", run=" + run + + ", components=" + components + + '}'; } } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/Relation.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/Relation.java index 7f51227fdac0..5c003b802eaf 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/Relation.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/Relation.java @@ -80,11 +80,11 @@ public boolean equals(Object o) { return false; } Relation relation = (Relation) o; - return Objects.equals(data, relation.data) && - Objects.equals(program, relation.program) && - Objects.equals(access, relation.access) && - Objects.equals(run, relation.run) && - Objects.equals(components, relation.components); + return Objects.equals(data, relation.data) + && Objects.equals(program, relation.program) + && Objects.equals(access, relation.access) + && Objects.equals(run, relation.run) + && Objects.equals(components, relation.components); } @Override @@ -94,12 +94,12 @@ public int hashCode() { @Override public String toString() { - return "Relation{" + - "data=" + data + - ", program=" + program + - ", access=" + access + - ", runs=" + run + - ", components=" + components + - '}'; + return "Relation{" + + "data=" + data + + ", program=" + program + + ", access=" + access + + ", runs=" + run + + ", components=" + components + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/DefaultFieldLineageReader.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/DefaultFieldLineageReader.java index 92e63feabeb2..1654462dc351 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/DefaultFieldLineageReader.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/DefaultFieldLineageReader.java @@ -106,8 +106,8 @@ private List computeFieldOperations(boolean incoming, try { // No need to compute summaries here. FieldLineageInfo info = new FieldLineageInfo(programRunOperation.getOperations(), false); - Set fieldOperations = incoming ? - info.getIncomingOperationsForField(endPointField) + Set fieldOperations = incoming + ? info.getIncomingOperationsForField(endPointField) : info.getOutgoingOperationsForField(endPointField); ProgramRunOperations result = new ProgramRunOperations( programRunOperation.getProgramRunIds(), fieldOperations); diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/EndPointField.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/EndPointField.java index bbb1df9e09cb..76a740ed561a 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/EndPointField.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/EndPointField.java @@ -51,8 +51,8 @@ public boolean equals(Object o) { return false; } EndPointField that = (EndPointField) o; - return Objects.equals(endPoint, that.endPoint) && - Objects.equals(field, that.field); + return Objects.equals(endPoint, that.endPoint) + && Objects.equals(field, that.field); } @Override @@ -65,10 +65,10 @@ public int hashCode() { @Override public String toString() { - return "EndPointField{" + - "endPoint=" + endPoint + - ", field='" + field + '\'' + - '}'; + return "EndPointField{" + + "endPoint=" + endPoint + + ", field='" + field + '\'' + + '}'; } /** @@ -82,10 +82,10 @@ public String toString() { * @return true if an EndPointField is valid, false otherwise */ public boolean isValid() { - return endPoint != null && - endPoint.getName() != null && - endPoint.getNamespace() != null && - !endPoint.getProperties().isEmpty() && - field != null; + return endPoint != null + && endPoint.getName() != null + && endPoint.getNamespace() != null + && !endPoint.getProperties().isEmpty() + && field != null; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/FieldLineageInfo.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/FieldLineageInfo.java index ad939f78b483..16dd02fafef4 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/FieldLineageInfo.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/FieldLineageInfo.java @@ -159,9 +159,9 @@ private void computeAndValidateFieldLineageInfo(Collection for (Operation operation : operations) { if (operationsMap.containsKey(operation.getName())) { throw new IllegalArgumentException( - String.format("All operations provided for creating field " + - "level lineage info must have unique names. " + - "Operation name '%s' is repeated.", operation.getName())); + String.format("All operations provided for creating field " + + "level lineage info must have unique names. " + + "Operation name '%s' is repeated.", operation.getName())); } @@ -173,8 +173,8 @@ private void computeAndValidateFieldLineageInfo(Collection EndPoint source = read.getSource(); if (source == null) { throw new IllegalArgumentException( - String.format("Source endpoint cannot be null for the read " + - "operation '%s'.", read.getName())); + String.format("Source endpoint cannot be null for the read " + + "operation '%s'.", read.getName())); } readOperations.add(read); break; @@ -198,8 +198,8 @@ private void computeAndValidateFieldLineageInfo(Collection EndPoint destination = write.getDestination(); if (destination == null) { throw new IllegalArgumentException( - String.format("Destination endpoint cannot be null for the write " + - "operation '%s'.", write.getName())); + String.format("Destination endpoint cannot be null for the write " + + "operation '%s'.", write.getName())); } origins = write.getInputs().stream().map(InputField::getOrigin) @@ -562,8 +562,8 @@ Set getOutgoingOperationsForField(EndPointField sourceField) { Set visitedOperations = new HashSet<>(); for (ReadOperation readOperation : readOperations) { - if (!(readOperation.getSource().equals(sourceField.getEndPoint()) && - readOperation.getOutputs().contains(sourceField.getField()))) { + if (!(readOperation.getSource().equals(sourceField.getEndPoint()) + && readOperation.getOutputs().contains(sourceField.getField()))) { continue; } // the read operation is for the dataset to which the sourceField belong and it did read the sourceField for diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/FieldLineageTable.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/FieldLineageTable.java index 21c9dd82f145..7a3f5cc4dff6 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/FieldLineageTable.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/lineage/field/FieldLineageTable.java @@ -547,8 +547,8 @@ public List getEndpoints(String namespaceId, ProgramReference programR Map existingProperties = GSON.fromJson( row.getString(StoreDefinition.FieldLineageStore.ENDPOINT_PROPERTIES_FIELD), MAP_STRING_TYPE); - EndPoint matchingEndPoint = EndPoint.of(namespace, name, existingProperties != null ? - existingProperties : Collections.emptyMap()); + EndPoint matchingEndPoint = EndPoint.of(namespace, name, existingProperties != null + ? existingProperties : Collections.emptyMap()); result.add(matchingEndPoint); } } @@ -557,8 +557,8 @@ public List getEndpoints(String namespaceId, ProgramReference programR private boolean programRunMatches(ProgramRunId programRunId, ProgramReference programReference, RunId runId) { - return programRunId.getParent().getProgramReference().equals(programReference) && - RunIds.fromString(programRunId.getRun()).equals(runId); + return programRunId.getParent().getProgramReference().equals(programReference) + && RunIds.fromString(programRunId.getRun()).equals(runId); } private Range getNamespaceIncomingRange(String namespaceId) { diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/system/DatasetSystemMetadataProvider.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/system/DatasetSystemMetadataProvider.java index a56c4fa3aaa1..c1a389bc6b73 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/system/DatasetSystemMetadataProvider.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/system/DatasetSystemMetadataProvider.java @@ -107,8 +107,8 @@ public Map getSystemPropertiesToAdd() { @Override public Set getSystemTagsToAdd() { Set tags = new HashSet<>(); - if (dataset instanceof BatchReadable || dataset instanceof BatchWritable || - dataset instanceof InputFormatProvider || dataset instanceof OutputFormatProvider) { + if (dataset instanceof BatchReadable || dataset instanceof BatchWritable + || dataset instanceof InputFormatProvider || dataset instanceof OutputFormatProvider) { tags.add(BATCH_TAG); } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/system/SystemMetadataProvider.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/system/SystemMetadataProvider.java index 4ce949492db0..49f93fca5728 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/system/SystemMetadataProvider.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/system/SystemMetadataProvider.java @@ -69,8 +69,8 @@ static void addPlugin(PluginClass pluginClass, @Nullable String version, ); if (version != null) { properties.put( - PLUGIN_VERSION_KEY_PREFIX + MetadataConstants.KEYVALUE_SEPARATOR + name + - MetadataConstants.KEYVALUE_SEPARATOR + type, + PLUGIN_VERSION_KEY_PREFIX + MetadataConstants.KEYVALUE_SEPARATOR + name + + MetadataConstants.KEYVALUE_SEPARATOR + type, name + MetadataConstants.KEYVALUE_SEPARATOR + version ); } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/DataAccessLineage.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/DataAccessLineage.java index 1a36716a1f69..43c7e68b1d2f 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/DataAccessLineage.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/DataAccessLineage.java @@ -110,11 +110,11 @@ public NamespacedEntityId getComponentId() { @Override public String toString() { - return "DataAccessLineage{" + - "accessTime=" + accessTime + - ", accessType=" + accessType + - ", datasetId=" + datasetId + - ", componentId=" + getComponentId() + - '}'; + return "DataAccessLineage{" + + "accessTime=" + accessTime + + ", accessType=" + accessType + + ", datasetId=" + datasetId + + ", componentId=" + getComponentId() + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MessagingLineageWriter.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MessagingLineageWriter.java index f40542e69b5b..46d6502d7a85 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MessagingLineageWriter.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MessagingLineageWriter.java @@ -96,8 +96,8 @@ private void publish(MetadataMessage message) { publishSizeLimit); isLineageWarningLogged = true; } - LOG.trace("Size of lineage message is {} bytes, which is larger than the limit {}.\n" + - "Therefore the lineage will not be published.", lineageSize, publishSizeLimit); + LOG.trace("Size of lineage message is {} bytes, which is larger than the limit {}.\n" + + "Therefore the lineage will not be published.", lineageSize, publishSizeLimit); } else { StoreRequest request = StoreRequestBuilder.of(topic).addPayload(messageJson).build(); try { @@ -107,8 +107,8 @@ private void publish(MetadataMessage message) { LOG.trace("Failed to publish metadata message: {}", message); ProgramRunId programRunId = (ProgramRunId) message.getEntityId(); throw new RuntimeException( - String.format("Failed to publish metadata message of type '%s' for program " + - "run '%s'.", message.getType(), programRunId), e); + String.format("Failed to publish metadata message of type '%s' for program " + + "run '%s'.", message.getType(), programRunId), e); } } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MetadataMessage.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MetadataMessage.java index ef844784995f..587d1b97d01d 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MetadataMessage.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MetadataMessage.java @@ -96,10 +96,10 @@ public JsonElement getRawPayload() { @Override public String toString() { - return "MetadataMessage{" + - "type=" + type + - ", entityId=" + entityId + - ", payload=" + payload + - '}'; + return "MetadataMessage{" + + "type=" + type + + ", entityId=" + entityId + + ", payload=" + payload + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MetadataOperation.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MetadataOperation.java index 75b48aef591e..63bf4c2962e7 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MetadataOperation.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/metadata/writer/MetadataOperation.java @@ -136,12 +136,12 @@ public int hashCode() { @Override public String toString() { - return "Create{" + - "type=" + type + - ", entity=" + entity + - ", properties=" + properties + - ", tags=" + tags + - '}'; + return "Create{" + + "type=" + type + + ", entity=" + entity + + ", properties=" + properties + + ", tags=" + tags + + '}'; } } @@ -160,10 +160,10 @@ public Drop(MetadataEntity entity) { @Override public String toString() { - return "Drop{" + - "type=" + type + - ", entity=" + entity + - '}'; + return "Drop{" + + "type=" + type + + ", entity=" + entity + + '}'; } } @@ -254,13 +254,13 @@ public int hashCode() { @Override public String toString() { - return "Put{" + - "type=" + type + - ", entity=" + entity + - ", scope=" + scope + - ", properties=" + properties + - ", tags=" + tags + - '}'; + return "Put{" + + "type=" + type + + ", entity=" + entity + + ", scope=" + scope + + ", properties=" + properties + + ", tags=" + tags + + '}'; } } @@ -321,13 +321,13 @@ public int hashCode() { @Override public String toString() { - return "Delete{" + - "type=" + type + - ", entity=" + entity + - ", scope=" + scope + - ", properties=" + properties + - ", tags=" + tags + - '}'; + return "Delete{" + + "type=" + type + + ", entity=" + entity + + ", scope=" + scope + + ", properties=" + properties + + ", tags=" + tags + + '}'; } } @@ -355,11 +355,11 @@ public DeleteAll(MetadataEntity entity, MetadataScope scope) { @Override public String toString() { - return "DeleteAll{" + - "type=" + type + - ", entity=" + entity + - ", scope=" + scope + - '}'; + return "DeleteAll{" + + "type=" + type + + ", entity=" + entity + + ", scope=" + scope + + '}'; } } @@ -387,11 +387,11 @@ public DeleteAllProperties(MetadataEntity entity, MetadataScope scope) { @Override public String toString() { - return "DeleteAllProperties{" + - "type=" + type + - ", entity=" + entity + - ", scope=" + scope + - '}'; + return "DeleteAllProperties{" + + "type=" + type + + ", entity=" + entity + + ", scope=" + scope + + '}'; } } @@ -419,11 +419,11 @@ public DeleteAllTags(MetadataEntity entity, MetadataScope scope) { @Override public String toString() { - return "DeleteAllTags{" + - "type=" + type + - ", entity=" + entity + - ", scope=" + scope + - '}'; + return "DeleteAllTags{" + + "type=" + type + + ", entity=" + entity + + ", scope=" + scope + + '}'; } } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/registry/DatasetUsage.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/registry/DatasetUsage.java index 69d6f691f4a3..f48d649fb896 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/registry/DatasetUsage.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/registry/DatasetUsage.java @@ -42,8 +42,8 @@ public DatasetId getDatasetId() { @Override public String toString() { - return "DatasetUsage{" + - "datasetId=" + datasetId + - '}'; + return "DatasetUsage{" + + "datasetId=" + datasetId + + '}'; } } diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/registry/DatasetUsageKey.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/registry/DatasetUsageKey.java index 5b5f649a5751..b7801cafac20 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/registry/DatasetUsageKey.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/registry/DatasetUsageKey.java @@ -51,8 +51,8 @@ public boolean equals(Object o) { return false; } DatasetUsageKey that = (DatasetUsageKey) o; - return Objects.equal(dataset, that.dataset) && - Objects.equal(owner, that.owner); + return Objects.equal(dataset, that.dataset) + && Objects.equal(owner, that.owner); } @Override diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/transaction/DistributedTransactionSystemClientService.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/transaction/DistributedTransactionSystemClientService.java index 94a0f75ef5ce..39c54ad6dd90 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/transaction/DistributedTransactionSystemClientService.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/transaction/DistributedTransactionSystemClientService.java @@ -80,8 +80,8 @@ public Boolean call() throws Exception { } catch (TimeoutException e) { // its not a nice message... throw one with a better message throw new TimeoutException(String.format( - "Timed out after %d seconds while waiting to discover the %s service. " + - "Check the logs for the service to see what went wrong.", + "Timed out after %d seconds while waiting to discover the %s service. " + + "Check the logs for the service to see what went wrong.", timeout, Constants.Service.TRANSACTION)); } catch (InterruptedException e) { throw new RuntimeException( diff --git a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/transaction/TransactionManagerDebuggerMain.java b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/transaction/TransactionManagerDebuggerMain.java index e0d166f6b23f..9d7ec7d6aa40 100644 --- a/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/transaction/TransactionManagerDebuggerMain.java +++ b/cdap-data-fabric/src/main/java/io/cdap/cdap/data2/transaction/TransactionManagerDebuggerMain.java @@ -122,25 +122,25 @@ private void buildOptions() { options = new Options(); options.addOption(null, HOST_OPTION, true, "To specify the hostname of the router"); options.addOption(null, FILENAME_OPTION, true, - "To specify a file to load a snapshot from in view mode. " + - "If the host option is specified, filename will be ignored"); + "To specify a file to load a snapshot from in view mode. " + + "If the host option is specified, filename will be ignored"); options.addOption(null, SAVE_OPTION, true, - "To specify where the snapshot downloaded on hostname --host " + - "should be persisted on your disk when using the view mode"); - options.addOption(null, IDS_OPTION, false, "To view all the transaction IDs contained in the " + - "snapshot when using the view mode"); + "To specify where the snapshot downloaded on hostname --host " + + "should be persisted on your disk when using the view mode"); + options.addOption(null, IDS_OPTION, false, "To view all the transaction IDs contained in the " + + "snapshot when using the view mode"); options.addOption(null, TRANSACTION_OPTION, true, - "To specify a transaction ID. Mandatory in invalidate mode, " + - "optional in view mode"); + "To specify a transaction ID. Mandatory in invalidate mode, " + + "optional in view mode"); options.addOption(null, PORT_OPTION, true, - "To specify the port to use. The default value is --port " + - Constants.Router.DEFAULT_ROUTER_PORT); + "To specify the port to use. The default value is --port " + + Constants.Router.DEFAULT_ROUTER_PORT); options.addOption(null, HELP_OPTION, false, "To print this message"); options.addOption(null, TOKEN_OPTION, true, "To specify the access token for secure connections"); options.addOption(null, TOKEN_FILE_OPTION, true, - "Alternative to --token, to specify a file that contains " + - "the access token for a secure connection"); + "Alternative to --token, to specify a file that contains " + + "the access token for a secure connection"); } /** @@ -189,8 +189,8 @@ private boolean parseArgsAndExecMode(String[] args, Configuration conf) { switch (this.mode) { case VIEW: if (!line.hasOption(HOST_OPTION) && !line.hasOption(FILENAME_OPTION)) { - usage("Either specify a hostname to download a new snapshot, " + - "or a filename of an existing snapshot."); + usage("Either specify a hostname to download a new snapshot, " + + "or a filename of an existing snapshot."); return false; } // Execute mode @@ -244,9 +244,9 @@ private void printUsage(boolean error) { } String toolName = "cdap" + (OSDetector.isWindows() ? ".bat " : " ") + TOOL_NAME; - pw.println("Usage:" + - "\n\t " + toolName + " view [