[freenet-cvs] r13657 - trunk/plugins/JSTUN

nextgens at freenetproject.org nextgens at freenetproject.org
Tue Jun 19 23:05:22 UTC 2007


Author: nextgens
Date: 2007-06-19 23:05:21 +0000 (Tue, 19 Jun 2007)
New Revision: 13657

Modified:
   trunk/plugins/JSTUN/JSTUN.java
Log:
JSTUN: hide a weird NPE

Modified: trunk/plugins/JSTUN/JSTUN.java
===================================================================
--- trunk/plugins/JSTUN/JSTUN.java	2007-06-19 20:10:30 UTC (rev 13656)
+++ trunk/plugins/JSTUN/JSTUN.java	2007-06-19 23:05:21 UTC (rev 13657)
@@ -68,6 +68,10 @@
 				Logger.normal(this, "Successful STUN discovery from "+stunServer+"!:" + reportedData+" likely detections: "+countLikely+" unlikely detections "+countUnlikely+" remaining "+v.size());
 				System.err.println("Successful STUN discovery from "+stunServer+"!:" + reportedData+" likely detections: "+countLikely+" unlikely detections "+countUnlikely+" remaining "+v.size());
 				DetectedIP ip = convert(reportedData);
+				if(ip == null) {
+					Logger.normal(this, "Failed to parse reported data, skipping server "+stunServer);
+					continue;
+				}
 				out.add(ip);
 				if(ip.natType == DetectedIP.NO_UDP || ip.natType == DetectedIP.NOT_SUPPORTED || ip.natType == DetectedIP.SYMMETRIC_NAT || ip.natType == DetectedIP.SYMMETRIC_UDP_FIREWALL)
 					countUnlikely++; // unlikely outcomes
@@ -192,11 +196,11 @@
 						}
 					} catch (Throwable t) {
 						System.err.println("Trying to access 1.6 getMTU(), caught "+t);
-						t.printStackTrace();
 					}
 				}
-				//int mtu = .getMTU();
-				for(int i=0;i<ip.length;i++) ip[i].mtu = mtu;
+
+				for(int i=0; i<ip.length; i++)
+					ip[i].mtu = mtu;
 			} catch (Throwable t) {
 				ip = null;
 				System.err.println("Caught "+t);




More information about the cvs mailing list