commit 5d3b171e21772615123a4e2109d51f2df57cc1d8 Author: arrase arrase@gmail.com Date: Sun Nov 27 19:19:44 2016 +0100
refactor --- .../android/ui/hiddenservices/backup/BackupUtils.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/backup/BackupUtils.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/backup/BackupUtils.java index a11cb71..5be10d3 100644 --- a/app/src/main/java/org/torproject/android/ui/hiddenservices/backup/BackupUtils.java +++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/backup/BackupUtils.java @@ -118,6 +118,9 @@ public class BackupUtils { }
public void restoreZipBackup(File backup) { + + int port; + Cursor service; String backupName = backup.getName(); String hsDir = backupName.substring(0, backupName.lastIndexOf('.')); String configFilePath = mHSBasePath + "/" + hsDir + "/" + configFileName; @@ -149,15 +152,12 @@ public class BackupUtils { try { JSONObject savedValues = new JSONObject(jString); ContentValues fields = new ContentValues(); - int port = savedValues.getInt(HSContentProvider.HiddenService.PORT);
fields.put( HSContentProvider.HiddenService.NAME, savedValues.getString(HSContentProvider.HiddenService.NAME) );
- fields.put(HSContentProvider.HiddenService.PORT, port); - fields.put( HSContentProvider.HiddenService.ONION_PORT, savedValues.getInt(HSContentProvider.HiddenService.ONION_PORT) @@ -173,7 +173,10 @@ public class BackupUtils { savedValues.getInt(HSContentProvider.HiddenService.CREATED_BY_USER) );
- Cursor service = mResolver.query( + port = savedValues.getInt(HSContentProvider.HiddenService.PORT); + fields.put(HSContentProvider.HiddenService.PORT, port); + + service = mResolver.query( HSContentProvider.CONTENT_URI, HSContentProvider.PROJECTION, HSContentProvider.HiddenService.PORT + "=" + port,
tor-commits@lists.torproject.org