added debug lines

This commit is contained in:
henry 2018-04-08 19:13:33 -04:00
parent 998332c2e5
commit fe3e597453

View file

@ -101,6 +101,7 @@ public class FileBackupManager implements FileServiceRequestsListener {
saveBinContentToFile(resultFile, fileName, request); saveBinContentToFile(resultFile, fileName, request);
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace();
request.setStatus(CreateBackupRequest.StatusCode.FAILED); request.setStatus(CreateBackupRequest.StatusCode.FAILED);
//TODO error exception //TODO error exception
@ -109,7 +110,6 @@ public class FileBackupManager implements FileServiceRequestsListener {
private void saveBinContentToFile(List<Integer> content, String fileName, CreateBackupRequest request ) private void saveBinContentToFile(List<Integer> content, String fileName, CreateBackupRequest request )
{ {
SimpleDateFormat df = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); SimpleDateFormat df = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
String dateHourString = df.format(new Date()); String dateHourString = df.format(new Date());
@ -118,7 +118,13 @@ public class FileBackupManager implements FileServiceRequestsListener {
File folderFile = new File(folder); File folderFile = new File(folder);
if (!folderFile.exists()) { if (!folderFile.exists()) {
folderFile.mkdir(); if(folderFile.mkdirs()){
System.out.println("folder created");
}else{
System.out.println("couldn't create folder");
request.setStatus(CreateBackupRequest.StatusCode.FAILED);
return;
}
} }
boolean success = saveBinFile(path,content,request); boolean success = saveBinFile(path,content,request);
@ -158,6 +164,7 @@ public class FileBackupManager implements FileServiceRequestsListener {
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace();
//TODO handle error //TODO handle error
} }
@ -178,8 +185,8 @@ public class FileBackupManager implements FileServiceRequestsListener {
readBytes.add(val); readBytes.add(val);
} }
dis.close();
dis.close();
byte[] byteArray = new byte[readBytes.size()]; byte[] byteArray = new byte[readBytes.size()];
for(int i = 0 ; i < readBytes.size();i++){ for(int i = 0 ; i < readBytes.size();i++){
byteArray[i] = readBytes.get(i).byteValue(); byteArray[i] = readBytes.get(i).byteValue();
@ -188,6 +195,8 @@ public class FileBackupManager implements FileServiceRequestsListener {
WalletBackup walletBackup = FileBin.deserializeWalletBackup(byteArray,request.getPassword()); WalletBackup walletBackup = FileBin.deserializeWalletBackup(byteArray,request.getPassword());
if(walletBackup == null){ if(walletBackup == null){
//TODO handle error //TODO handle error
System.out.println("FileBackupManager error walletBackup null");
request.setStatus(ImportBackupRequest.StatusCode.FAILED);
return; return;
} }
@ -232,6 +241,7 @@ public class FileBackupManager implements FileServiceRequestsListener {
CryptoNetInfoRequests.getInstance().addRequest(validatorRequest); CryptoNetInfoRequests.getInstance().addRequest(validatorRequest);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
request.setStatus(ImportBackupRequest.StatusCode.FAILED); request.setStatus(ImportBackupRequest.StatusCode.FAILED);
//TODO handle exception //TODO handle exception
} }