summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-09-17 10:59:33 +0200
committerArne Schwabe <arne@rfc2549.org>2013-09-17 10:59:33 +0200
commite86a9a41d289e107bf235baaac766c109f23a5c6 (patch)
tree5f0ada023813fceb18d4d48068954eaac420a0a5
parent22b741e9a140eb70ea1772c1b6a43ef2ff3e1512 (diff)
Fix a few market console errors
-rw-r--r--icsopenvpn.iml5
-rw-r--r--src/de/blinkt/openvpn/ConfigConverter.java5
-rw-r--r--src/de/blinkt/openvpn/FileSelect.java3
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java23
-rw-r--r--src/de/blinkt/openvpn/core/OpenVpnManagementThread.java2
-rw-r--r--src/de/blinkt/openvpn/fragments/AboutFragment.java21
6 files changed, 36 insertions, 23 deletions
diff --git a/icsopenvpn.iml b/icsopenvpn.iml
index 71d16c50..cdd93af4 100644
--- a/icsopenvpn.iml
+++ b/icsopenvpn.iml
@@ -5,9 +5,11 @@
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="Debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
+ <option name="COMPILE_JAVA_TASK_NAME" value="compileDebug" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleTest" />
- <option name="SOURCE_GEN_TASK_NAME" value="TODO" />
+ <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
+ <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/res" />
<option name="UPDATE_PROPERTY_FILES" value="true" />
</configuration>
</facet>
@@ -59,7 +61,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
- <excludeFolder url="file://$MODULE_DIR$/build/exploded-bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/manifests" />
diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java
index 22109f81..75620455 100644
--- a/src/de/blinkt/openvpn/ConfigConverter.java
+++ b/src/de/blinkt/openvpn/ConfigConverter.java
@@ -35,7 +35,7 @@ public class ConfigConverter extends ListActivity {
public static final String IMPORT_PROFILE = "de.blinkt.openvpn.IMPORT_PROFILE";
- private VpnProfile mResult;
+ private VpnProfile mResult;
private ArrayAdapter<String> mArrayAdapter;
private List<String> mPathsegments;
@@ -306,7 +306,8 @@ public class ConfigConverter extends ListActivity {
InputStream input = new FileInputStream(file);
long len= file.length();
-
+ if (len > VpnProfile.MAX_EMBED_FILE_SIZE)
+ throw new IOException("File size of file to import too large.");
// Create the byte array to hold the data
byte[] bytes = new byte[(int) len];
diff --git a/src/de/blinkt/openvpn/FileSelect.java b/src/de/blinkt/openvpn/FileSelect.java
index 88a9abdd..8389a2ab 100644
--- a/src/de/blinkt/openvpn/FileSelect.java
+++ b/src/de/blinkt/openvpn/FileSelect.java
@@ -155,7 +155,8 @@ public class FileSelect extends Activity {
InputStream input = new FileInputStream(file);
long len= file.length();
-
+ if (len > VpnProfile.MAX_EMBED_FILE_SIZE)
+ throw new IOException("selected file size too big to embed into profile");
// Create the byte array to hold the data
byte[] bytes = new byte[(int) len];
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index 3a2f2bbf..ed19cd17 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -44,6 +44,19 @@ public class VpnProfile implements Serializable {
// The Serializable documentation mentions that class name change are possible
// but the how is unclear
//
+ transient static final long MAX_EMBED_FILE_SIZE = 2048*1024; // 2048kB
+ // Don't change this, not all parts of the program use this constant
+ public static final String EXTRA_PROFILEUUID = "de.blinkt.openvpn.profileUUID";
+ public static final String INLINE_TAG = "[[INLINE]]";
+ public static final String MINIVPN = "miniopenvpn";
+ private static final long serialVersionUID = 7085688938959334563L;
+ private static final String OVPNCONFIGFILE = "android.conf";
+ public static String DEFAULT_DNS1 = "8.8.8.8";
+ public static String DEFAULT_DNS2 = "8.8.4.4";
+
+ public transient String mTransientPW = null;
+ public transient String mTransientPCKS12PW = null;
+
public static final int TYPE_CERTIFICATES = 0;
public static final int TYPE_PKCS12 = 1;
@@ -58,16 +71,6 @@ public class VpnProfile implements Serializable {
public static final int X509_VERIFY_TLSREMOTE_DN = 2;
public static final int X509_VERIFY_TLSREMOTE_RDN = 3;
public static final int X509_VERIFY_TLSREMOTE_RDN_PREFIX = 4;
- // Don't change this, not all parts of the program use this constant
- public static final String EXTRA_PROFILEUUID = "de.blinkt.openvpn.profileUUID";
- public static final String INLINE_TAG = "[[INLINE]]";
- public static final String MINIVPN = "miniopenvpn";
- private static final long serialVersionUID = 7085688938959334563L;
- private static final String OVPNCONFIGFILE = "android.conf";
- public static String DEFAULT_DNS1 = "8.8.8.8";
- public static String DEFAULT_DNS2 = "8.8.4.4";
- public transient String mTransientPW = null;
- public transient String mTransientPCKS12PW = null;
// variable named wrong and should haven beeen transient
// but needs to keep wrong name to guarante loading of old
// profiles
diff --git a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
index 9497f18b..4fe54217 100644
--- a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
+++ b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
@@ -93,7 +93,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
}
public void managmentCommand(String cmd) {
- if(mSocket!=null) {
+ if(mSocket!=null && mSocket.getOutputStream() !=null) {
try {
mSocket.getOutputStream().write(cmd.getBytes());
mSocket.getOutputStream().flush();
diff --git a/src/de/blinkt/openvpn/fragments/AboutFragment.java b/src/de/blinkt/openvpn/fragments/AboutFragment.java
index ce57afda..c4f27ee1 100644
--- a/src/de/blinkt/openvpn/fragments/AboutFragment.java
+++ b/src/de/blinkt/openvpn/fragments/AboutFragment.java
@@ -111,13 +111,15 @@ public class AboutFragment extends Fragment implements View.OnClickListener {
final ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- createPlayBuyOptions(ownedSkus, responseList);
-
- }
- });
+ if (getActivity() != null) {
+ getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ createPlayBuyOptions(ownedSkus, responseList);
+
+ }
+ });
+ }
} catch (RemoteException e) {
e.printStackTrace();
@@ -274,6 +276,11 @@ public class AboutFragment extends Fragment implements View.OnClickListener {
}
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ if (mService!=null)
+ initGooglePlayDonation();
+ }
@Override
public void onClick(View v) {