Github user ijokarumawak commented on a diff in the pull request:
https://github.com/apache/nifi/pull/3182#discussion_r237317639
--- Diff:
nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/AbstractKiteProcessor.java
---
@@ -101,38 +100,38 @@ protected static Schema getSchema(String
uriOrLiteral, Configuration conf) {
return parseSchema(uriOrLiteral);
}
+ if(uri.getScheme() == null) {
+ throw new SchemaNotFoundException("If the schema is not a JSON
string, a scheme must be specified in the URI "
+ + "(ex: dataset:, view:, resource:, file:, hdfs:,
etc).");
+ }
+
try {
if ("dataset".equals(uri.getScheme()) ||
"view".equals(uri.getScheme())) {
return
Datasets.load(uri).getDataset().getDescriptor().getSchema();
} else if ("resource".equals(uri.getScheme())) {
- try (InputStream in =
Resources.getResource(uri.getSchemeSpecificPart())
- .openStream()) {
+ try (InputStream in =
Resources.getResource(uri.getSchemeSpecificPart()).openStream()) {
return parseSchema(uri, in);
}
} else {
// try to open the file
Path schemaPath = new Path(uri);
- FileSystem fs = schemaPath.getFileSystem(conf);
- try (InputStream in = fs.open(schemaPath)) {
+ try (InputStream in =
schemaPath.getFileSystem(conf).open(schemaPath)) {
--- End diff --
This statement doesn't make FileSystem.close gets called. Please change it
to
```
try (FileSystem fs = schemaPath.getFileSystem(conf); InputStream in =
fs.open(schemaPath)) {
```
This way, both in.close() and fs.close() will be called.
---