try-with resource & logging issues fixed
file name: YamlUtil.java
Change-Id: Ib3ad9afad0b11ce3ba8bf3805c55a4247f86cc0e
Issue-ID: VFC-803
Signed-off-by: ajay priyadarshi <ajay.priyadarshi@ril.com>
name.put("default","hello,it's me");
// new Yaml().dump(config, new FileWriter("C:\\Users\\z00292420\\Desktop\\juju\\config2.yaml"));
String newYaml = new Yaml().dumpAsMap(config);
- Writer w = new FileWriter(new File("C:\\Users\\z00292420\\Desktop\\juju"));
+ try(Writer w = new FileWriter(new File("C:\\Users\\z00292420\\Desktop\\juju"))){
w.write(newYaml);
- w.flush();
- w.close();
- System.out.println(newYaml);
+ }catch(Exception e){
+ log.error("Write Yaml Error: ",e);
+ throw new IOException("Write Yaml Error" + e);
+ }
+ //System.out.println(newYaml);
}
}