Source:
private IMetadataTable buildMetadata(final String schema) { if (schema == null || schema.trim().isEmpty()) { return null; } Collection<MetadataColumn> jsonColumns = new HashSet<>(); final Jsonb jsonb = JsonbBuilder.create(); final String[] lines = schema.split("\n"); for (String line : lines) { try { Collection<MetadataColumn> columns = jsonb.fromJson(line, new ParameterizedType() { @Override public Type[] getActualTypeArguments() { return new Type[] { MetadataColumn.class }; } @Override public Type getRawType() { return Collection.class; } @Override public Type getOwnerType() { return null; } }); if (columns != null && !columns.isEmpty()) { jsonColumns.addAll(columns); } } catch (final Exception e) { ExceptionHandler.process(e); } } try { jsonb.close(); } catch (Exception e1) { ExceptionHandler.process(e1); } if (jsonColumns.isEmpty()) { return null; } final List<String> columnLabels = new ArrayList<>(); final List<IMetadataColumn> columns = new ArrayList<>(); int i = -1; for (final IMetadataColumn oneColumn : jsonColumns) { i++; oneColumn.setLabel(getLabel(columnLabels, i, oneColumn)); oneColumn.setOriginalDbColumnName(oneColumn.getLabel()); oneColumn.setPrecision(0); oneColumn.setLength(0); columns.add(oneColumn); columnLabels.add(oneColumn.getLabel()); } if (!columns.isEmpty()) { IElementParameter dqRule = elem.getElementParameter("DQRULES_LIST"); if (dqRule != null) { ITDQRuleService ruleService = null; try { ruleService = (ITDQRuleService) GlobalServiceRegister.getDefault().getService(ITDQRuleService.class); } catch (RuntimeException e) { } IElementParameter queryParam = elem.getElementParameter("QUERY"); if (ruleService != null && queryParam != null) { ruleService.updateOriginalColumnNames(columns, queryParam); } } } IMetadataTable metadataTable = new MetadataTable(); metadataTable.setTableName(elementParameter.getContext()); metadataTable.setListColumns(columns); return metadataTable; }

Target:
private IMetadataTable buildMetadata(final String schema) { if (schema == null || schema.trim().isEmpty()) { return null; } Collection<MetadataColumn> jsonColumns = new HashSet<>(); final String[] lines = schema.split("\n"); for (String line : lines) { try (final Jsonb jsonb = JsonbBuilder.create()) { Collection<MetadataColumn> columns = jsonb.fromJson(line, new ParameterizedType() { @Override public Type[] getActualTypeArguments() { return new Type[] { MetadataColumn.class }; } @Override public Type getRawType() { return Collection.class; } @Override public Type getOwnerType() { return null; } }); if (columns != null && !columns.isEmpty()) { jsonColumns.addAll(columns); } } catch (final Exception e) { ExceptionHandler.process(e); } } if (jsonColumns.isEmpty()) { return null; } final List<String> columnLabels = new ArrayList<>(); final List<IMetadataColumn> columns = new ArrayList<>(); int i = -1; for (final IMetadataColumn oneColumn : jsonColumns) { i++; oneColumn.setLabel(getLabel(columnLabels, i, oneColumn)); oneColumn.setOriginalDbColumnName(oneColumn.getLabel()); oneColumn.setPrecision(0); oneColumn.setLength(0); columns.add(oneColumn); columnLabels.add(oneColumn.getLabel()); } if (!columns.isEmpty()) { IElementParameter dqRule = elem.getElementParameter("DQRULES_LIST"); if (dqRule != null) { ITDQRuleService ruleService = null; try { ruleService = (ITDQRuleService) GlobalServiceRegister.getDefault().getService(ITDQRuleService.class); } catch (RuntimeException e) { } IElementParameter queryParam = elem.getElementParameter("QUERY"); if (ruleService != null && queryParam != null) { ruleService.updateOriginalColumnNames(columns, queryParam); } } } IMetadataTable metadataTable = new MetadataTable(); metadataTable.setTableName(elementParameter.getContext()); metadataTable.setListColumns(columns); return metadataTable; }