From e35b43bd982ca8f24a629b8ad7cf17ffced0d541 Mon Sep 17 00:00:00 2001 From: sajid riaz Date: Mon, 8 Jan 2024 11:55:41 +0100 Subject: [PATCH] fix checkstyle warining --- .../EccYamlToMarkdownConverter.java | 52 ++++++++++++++----- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/EccYamlToMarkdownConverter.java b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/EccYamlToMarkdownConverter.java index 1ef6b2a18..f3b796138 100644 --- a/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/EccYamlToMarkdownConverter.java +++ b/application/src/main/java/com/ericsson/bss/cassandra/ecchronos/application/EccYamlToMarkdownConverter.java @@ -1,22 +1,40 @@ +/* + * Copyright 2024 Telefonaktiebolaget LM Ericsson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.ericsson.bss.cassandra.ecchronos.application; -import java.io.*; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.nio.file.Paths; -public class EccYamlToMarkdownConverter +public final class EccYamlToMarkdownConverter { - public static void main(String[] args) - { - String relativePathToDocs = "docs/autogenerated"; - String markdownFileName = "EccYamlFile.md"; - String yamlFilePath = "/ecc.yml"; // Resource path in the classpath - String currentWorkingDir = System.getProperty("user.dir"); - String markdownFilePath = Paths.get(currentWorkingDir, relativePathToDocs, markdownFileName).toString(); + private EccYamlToMarkdownConverter() + { + } + public static void main(final String[] args) + { try { - convertYamlToMarkdown(yamlFilePath, markdownFilePath); + convertYamlToMarkdown(); } catch (IOException e) { @@ -24,11 +42,17 @@ public static void main(String[] args) } } - private static void convertYamlToMarkdown(String yamlFilePath, String markdownFilePath) throws IOException + private static void convertYamlToMarkdown() throws IOException { + final String relativePathToDocs = "docs/autogenerated"; + final String markdownFileName = "EccYamlFile.md"; + final String yamlFilePath = "/ecc.yml"; // Resource path in the classpath + + final String currentWorkingDir = System.getProperty("user.dir"); + String markdownFilePath = Paths.get(currentWorkingDir, relativePathToDocs, markdownFileName).toString(); try (InputStream inputStream = EccYamlToMarkdownConverter.class.getResourceAsStream(yamlFilePath); - BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); - BufferedWriter writer = new BufferedWriter(new FileWriter(markdownFilePath))) + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + BufferedWriter writer = new BufferedWriter(new FileWriter(markdownFilePath))) { if (inputStream == null) @@ -53,7 +77,7 @@ private static void convertYamlToMarkdown(String yamlFilePath, String markdownFi } } - private static String convertLineToMarkdown(String line) + private static String convertLineToMarkdown(final String line) { String trimmedLine = line.trim();