[Schmitzm-commits] r1959 - in trunk/schmitzm-core/src/main/java/de/schmitzm: io swing

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 19 14:01:00 CEST 2012


Author: mojays
Date: 2012-04-19 14:01:00 +0200 (Thu, 19 Apr 2012)
New Revision: 1959

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsPanel.java
Log:


Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java	2012-04-18 13:04:35 UTC (rev 1958)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java	2012-04-19 12:01:00 UTC (rev 1959)
@@ -1304,13 +1304,14 @@
 	 *                  is returned)
 	 * @param host host address
 	 * @param port proxy port
-	 * @return {@link Proxy#NO_PROXY} if {@code host} is {@code null}
+	 * @return {@link Proxy#NO_PROXY} if @c{@code proxyType} is {@link Type#DIRECT},
+	 *         {@code host} is {@code null} or empty string
 	 */
 	public static Proxy createProxy(Type proxyType, String host, int port) {
 	  if ( proxyType == null )
 	    proxyType = Type.DIRECT;
 
-	  if ( host == null || proxyType.equals(Type.DIRECT) )
+	  if ( StringUtils.isBlank(host) || proxyType.equals(Type.DIRECT) )
 	    return Proxy.NO_PROXY;
 	  // Create socket address for proxy
 	  SocketAddress proxySocket = new InetSocketAddress(host, port);

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsPanel.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsPanel.java	2012-04-18 13:04:35 UTC (rev 1958)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/ProxySettingsPanel.java	2012-04-19 12:01:00 UTC (rev 1959)
@@ -103,6 +103,8 @@
     Proxy.Type type = (Proxy.Type)proxyType.getValue();
     String     host = (String)proxyHost.getValue();
     Integer    port = (Integer)proxyPort.getValue();
+    if ( port == null )
+      port = 0;
     
     return IOUtil.createProxy(type, host, port);
   }



More information about the Schmitzm-commits mailing list