Author: toad
Date: 2007-09-07 23:33:46 +0000 (Fri, 07 Sep 2007)
New Revision: 15026

Modified:
   trunk/plugins/UPnP/UPnP.java
Log:
fix NPE, logging

Modified: trunk/plugins/UPnP/UPnP.java
===================================================================
--- trunk/plugins/UPnP/UPnP.java        2007-09-07 22:59:32 UTC (rev 15025)
+++ trunk/plugins/UPnP/UPnP.java        2007-09-07 23:33:46 UTC (rev 15026)
@@ -375,12 +375,14 @@
                foundInfoboxContent.addChild("p", "The following device has 
been found : ").addChild("a", "href", "?getDeviceCapabilities").addChild("#", 
_router.getFriendlyName());
                foundInfoboxContent.addChild("p", "Our current external ip 
address is : " + getNATAddress());
                synchronized(lock) {
-                       for(Iterator i=portsToForward.iterator();i.hasNext();) {
-                               ForwardPort port = (ForwardPort) i.next();
-                               if(portsForwarded.contains(port)) {
-                                       foundInfoboxContent.addChild("p", "The 
"+port.name+" port "+port.portNumber+" / "+port.protocol+" has been forwarded 
successfully.");
-                               } else {
-                                       foundInfoboxContent.addChild("p", "The 
"+port.name+" port "+port.portNumber+" / "+port.protocol+" has not been 
forwarded.");
+                       if(portsToForward != null) {
+                               for(Iterator 
i=portsToForward.iterator();i.hasNext();) {
+                                       ForwardPort port = (ForwardPort) 
i.next();
+                                       if(portsForwarded.contains(port)) {
+                                               
foundInfoboxContent.addChild("p", "The "+port.name+" port "+port.portNumber+" / 
"+port.protocol+" has been forwarded successfully.");
+                                       } else {
+                                               
foundInfoboxContent.addChild("p", "The "+port.name+" port "+port.portNumber+" / 
"+port.protocol+" has not been forwarded.");
+                                       }
                                }
                        }
                }
@@ -453,6 +455,7 @@
        public void onChangePublicPorts(Set ports, ForwardPortCallback cb) {
                Set portsToDumpNow = null;
                Set portsToForwardNow = null;
+               System.err.println("Forwarding "+ports.size()+" ports...");
                synchronized(lock) {
                        if(forwardCallback != null && forwardCallback != cb && 
cb != null) {
                                Logger.error(this, "ForwardPortCallback changed 
from "+forwardCallback+" to "+cb+" - using new value, but this is very 
strange!");


Reply via email to