private boolean createInfoFile(HardwareInfo info){
BufferedWriter bw = null;
try {
String filePath = fsv.getHomeDirectory().getAbsolutePath().concat(File.separator).concat(FILENAME);
System.out.println("filePath : " + filePath);
File file = new File(filePath);
if(file.exists()){
file.delete();
}
bw = new BufferedWriter(new FileWriter(file));
bw.write("CPU type : " + info.getCpuType());
bw.newLine();
bw.write("CPU cores : " + String.valueOf(info.getCpuCores()));
bw.newLine();
bw.write("CPU ID : " + info.getCpuId());
bw.newLine();
bw.write("Disk ID : " + info.getDiskId());
bw.newLine();
bw.write("Mac Address : " + info.getMacAddr());
} catch (IOException ex) {
Logger.getLogger(ApplyForLicense.class.getName()).log(Level.SEVERE, null, ex);
return false;
} finally {
try {
bw.close();
} catch (IOException ex) {
Logger.getLogger(ApplyForLicense.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
return true;
}
BufferedWriter bw = null;
try {
String filePath = fsv.getHomeDirectory().getAbsolutePath().concat(File.separator).concat(FILENAME);
System.out.println("filePath : " + filePath);
File file = new File(filePath);
if(file.exists()){
file.delete();
}
bw = new BufferedWriter(new FileWriter(file));
bw.write("CPU type : " + info.getCpuType());
bw.newLine();
bw.write("CPU cores : " + String.valueOf(info.getCpuCores()));
bw.newLine();
bw.write("CPU ID : " + info.getCpuId());
bw.newLine();
bw.write("Disk ID : " + info.getDiskId());
bw.newLine();
bw.write("Mac Address : " + info.getMacAddr());
} catch (IOException ex) {
Logger.getLogger(ApplyForLicense.class.getName()).log(Level.SEVERE, null, ex);
return false;
} finally {
try {
bw.close();
} catch (IOException ex) {
Logger.getLogger(ApplyForLicense.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
return true;
}