Skip to content
Snippets Groups Projects
Commit bab2aca5 authored by akwizgran's avatar akwizgran
Browse files

Patched Weupnp to support older Android devices.

Older devices such as the Huawei U8210 don't completely support the Java
1.6 API. Calling an unsupported method crashes the app.
parent 290fbe4a
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<classpathentry kind="lib" path="/briar-api/libs/guice-3.0-no_aop.jar"/> <classpathentry kind="lib" path="/briar-api/libs/guice-3.0-no_aop.jar"/>
<classpathentry kind="lib" path="libs/sc-light-jdk15on-1.47.0.3-SNAPSHOT.jar" sourcepath="libs/source/sc-light-jdk15on-1.47.0.3-SNAPSHOT-source.jar"/> <classpathentry kind="lib" path="libs/sc-light-jdk15on-1.47.0.3-SNAPSHOT.jar" sourcepath="libs/source/sc-light-jdk15on-1.47.0.3-SNAPSHOT-source.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="libs/weupnp-0.1.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="/briar-api/libs/javax.inject.jar"/> <classpathentry kind="lib" path="/briar-api/libs/javax.inject.jar"/>
<classpathentry kind="lib" path="libs/h2small-1.3.170.jar"/> <classpathentry kind="lib" path="libs/h2small-1.3.170.jar"/>
<classpathentry kind="lib" path="libs/weupnp-0.1.3-SNAPSHOT-briar.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
No preview for this file type
diff -Bbur weupnp-0.1.3-SNAPSHOT/src/main/java/org/bitlet/weupnp/GatewayDiscover.java weupnp-0.1.3-SNAPSHOT-briar/src/main/java/org/bitlet/weupnp/GatewayDiscover.java
--- weupnp-0.1.3-SNAPSHOT/src/main/java/org/bitlet/weupnp/GatewayDiscover.java 2013-05-01 21:09:27.000000000 +0100
+++ weupnp-0.1.3-SNAPSHOT-briar/src/main/java/org/bitlet/weupnp/GatewayDiscover.java 2013-12-05 20:49:00.000000000 +0000
@@ -253,7 +253,7 @@
while (st.hasMoreTokens()) {
String line = st.nextToken().trim();
- if (line.isEmpty())
+ if (line.equals(""))
continue;
if (line.startsWith("HTTP/1.") || line.startsWith("NOTIFY *"))
@@ -331,16 +331,6 @@
// For every suitable network interface, get all IP addresses
while (networkInterfaces.hasMoreElements()) {
NetworkInterface card = networkInterfaces.nextElement();
-
- try {
- // skip devices, not suitable to search gateways for
- if (card.isLoopback() || card.isPointToPoint() ||
- card.isVirtual() || !card.isUp())
- continue;
- } catch (SocketException e) {
- continue;
- }
-
Enumeration<InetAddress> addresses = card.getInetAddresses();
if (addresses == null)
@@ -348,6 +338,10 @@
while (addresses.hasMoreElements()) {
InetAddress inetAddress = addresses.nextElement();
+
+ if (inetAddress.isLoopbackAddress())
+ continue;
+
int index = arrayIPAddress.size();
if (!getIPv4 || !getIPv6) {
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment