Source:
<code>public Optional<MetaData> meta(Map<String, Object> parameters) { Map<String, String> textParameters = cast(parameters); LOGGER.debug("Fetching mongodb meta information with params: {}", textParameters); MongoConfiguration mongoConf = new MongoConfiguration(textParameters); MongoClientURI connectionURI = new MongoClientURI(mongoConf.getMongoClientURI()); <START> JsonNode collectionInfoRoot = null; <END> try (MongoClient mongoConnection = new MongoClient(connectionURI)) { Document collectionInfo = mongoConnection.getDatabase(textParameters.get("database")) .listCollections() .filter(Filters.eq("name", textParameters.get("collection"))).first(); LOGGER.debug("Collection info: {}", collectionInfo); if (collectionInfo == null) { LOGGER.error("Cannot read information for collection {}.{}", textParameters.get("database"), textParameters.get("collection")); return Optional.empty(); } String collectionInfoJson = collectionInfo.toJson(); collectionInfoRoot = objectMapper.readTree(collectionInfoJson.replaceAll("bsonType", "type")); } catch (IOException e) { LOGGER.error("Error occurred while reading schema information", e); return Optional.empty(); } JsonNode schemaRoot = collectionInfoRoot.path("options").path("validator").path("$jsonSchema"); if (!schemaRoot.isMissingNode()) { ObjectNode root = (ObjectNode) schemaRoot; root.put("$schema", "<LINK_0>"); root.put("id", String.format("urn:jsonschema:%s:%s:%s)", "org:apache:camel:component:mongodb", textParameters.get("database"), textParameters.get("collection"))); return Optional.of( MetaDataBuilder.on(getCamelContext()) .withAttribute(MetaData.CONTENT_TYPE, "application/schema+json") .withAttribute(MetaData.JAVA_TYPE, JsonNode.class) .withPayload(root) .build() ); } else { LOGGER.warn("Cannot retrieve info for : {}.{} collection. Likely the collection has not been provided with a validator", textParameters.get("database"), textParameters.get("collection")); return Optional.empty(); } }</code><technical_language>nit: I need initialize null suggestion JsonNode collectionInfoRoot;</technical_language>

Target:
public Optional<MetaData> meta(Map<String, Object> parameters) { Map<String, String> textParameters = cast(parameters); LOGGER.debug("Fetching mongodb meta information with params: {}", textParameters); ConnectionParamsConfiguration mongoConf = new ConnectionParamsConfiguration(textParameters); MongoClientURI connectionURI = new MongoClientURI(mongoConf.getMongoClientURI()); JsonNode collectionInfoRoot; try (MongoClient mongoConnection = new MongoClient(connectionURI)) { Document collectionInfo = mongoConnection.getDatabase(textParameters.get("database")) .listCollections() .filter(Filters.eq("name", textParameters.get("collection"))) .first(); LOGGER.debug("Collection info: {}", collectionInfo); if (collectionInfo == null) { LOGGER.error( "Cannot read information for collection {}.{}", textParameters.get("database"), textParameters.get("collection")); return Optional.empty(); } String collectionInfoJson = collectionInfo.toJson(); collectionInfoRoot = objectMapper.readTree(collectionInfoJson.replaceAll("bsonType", "type")); } catch (IOException e) { LOGGER.error("Error occurred while reading schema information", e); return Optional.empty(); } JsonNode schemaRoot = collectionInfoRoot.path("options").path("validator").path("$jsonSchema"); if (!schemaRoot.isMissingNode()) { ObjectNode root = (ObjectNode) schemaRoot; root.put("$schema", "<LINK_0>"); root.put("id", String.format("urn:jsonschema:%s:%s:%s)", "org:apache:camel:component:mongodb", textParameters.get("database"), textParameters.get("collection"))); return Optional.of( MetaDataBuilder.on(getCamelContext()) .withAttribute(MetaData.CONTENT_TYPE, "application/schema+json") .withAttribute(MetaData.JAVA_TYPE, JsonNode.class) .withPayload(root) .build() ); } else { LOGGER.warn("Cannot retrieve info for : {}.{} collection. Likely the collection has not been provided with a validator", textParameters.get("database"), textParameters.get("collection")); return Optional.empty(); } }