diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-08-20 12:41:53 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-08-20 12:41:53 +0200 |
commit | 20b5cac307978d787333f4050ce28011f42bcfd0 (patch) | |
tree | e8c967e694993cfedcd597109c40a93eb52e8f22 /src | |
parent | 75bd326709b5cb640f5206ca1c7128536f9e2bfa (diff) |
Retry on KeyStore error
--HG--
extra : rebase_source : fc0068336b5344fd9e0beb6a10ff6eb2c4dc314f
Diffstat (limited to 'src')
-rw-r--r-- | src/de/blinkt/openvpn/VpnProfile.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 9ee0f9db..138386ae 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -11,6 +11,8 @@ import android.preference.PreferenceManager; import android.security.KeyChain; import android.security.KeyChainException; import android.util.Base64; +import android.widget.Toast; + import de.blinkt.openvpn.core.NativeUtils; import de.blinkt.openvpn.core.OpenVPN; import de.blinkt.openvpn.core.OpenVpnService; @@ -544,6 +546,10 @@ public class VpnProfile implements Serializable { } String[] getKeyStoreCertificates(Context context) { + return getKeyStoreCertificates(context, 5); + } + + String[] getKeyStoreCertificates(Context context,int tries) { PrivateKey privateKey = null; X509Certificate[] cachain; try { @@ -625,6 +631,16 @@ public class VpnProfile implements Serializable { OpenVPN.logError(R.string.jelly_keystore_alphanumeric_bug); } } + } catch (AssertionError e) { + if (tries ==0) + return null; + Toast.makeText(context, String.format("Failure getting Keystore Keys (%s), retrying",e.getLocalizedMessage()),Toast.LENGTH_LONG).show(); + try { + Thread.sleep(300); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + return getKeyStoreCertificates(context, tries-1); } return null; } |