in src/main/java/com/aliyuncs/kms/secretsmanager/client/utils/JsonIOUtils.java [39:60]
public static <T> void writeObject(String filePath, String fileName, T t) {
String secretJSON = new GsonBuilder().setPrettyPrinting().create().toJson(t);
File file = new File(filePath);
if (!file.exists()) {
file.mkdirs();
}
file = new File(filePath + File.separatorChar + fileName);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
CommonLogger.getCommonLogger(CacheClientConstant.MODE_NAME).errorf("action:createFile", e);
throw new RuntimeException(e);
}
}
try (PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(file)))) {
writer.write(secretJSON);
} catch (IOException e) {
CommonLogger.getCommonLogger(CacheClientConstant.MODE_NAME).errorf("action:writeObject", e);
throw new RuntimeException(e);
}
}