Skip to content

Commit

Permalink
catch
Browse files Browse the repository at this point in the history
  • Loading branch information
jacopocarlini committed May 30, 2024
1 parent a06d4af commit c3a7804
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ private PaymentNoticeGenerationRequestClientImpl() {
CodecRegistry pojoCodecRegistry = fromRegistries(getDefaultCodecRegistry(),
fromProviders(pojoCodecProvider));
MongoClient mongoClient = MongoClients.create(connectionString);
MongoDatabase database = mongoClient.getDatabase(databaseName)
.withCodecRegistry(pojoCodecRegistry);
MongoDatabase database;
try {
database = mongoClient.getDatabase(databaseName)
.withCodecRegistry(pojoCodecRegistry);
} catch (Exception e) {
mongoClient.close();
throw e;
}
mongoCollection = database.getCollection(collectionName, PaymentNoticeGenerationRequest.class);

}
Expand All @@ -45,7 +51,7 @@ private PaymentNoticeGenerationRequestClientImpl() {
}

public static PaymentNoticeGenerationRequestClientImpl getInstance() {
if (instance == null) {
if(instance == null) {
instance = new PaymentNoticeGenerationRequestClientImpl();
}

Expand Down

0 comments on commit c3a7804

Please sign in to comment.