Changeset 8161
- Timestamp:
- 11/14/04 15:29:07 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/j/File.java
r397 r8161 2 2 * File.java 3 3 * 4 * Copyright (C) 1998-200 2Peter Graves5 * $Id: File.java,v 1.1 3 2002-12-09 15:00:11piso Exp $4 * Copyright (C) 1998-2004 Peter Graves 5 * $Id: File.java,v 1.14 2004-11-14 15:29:07 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 182 182 183 183 // Shorten s to what's left (host and port). 184 s = s.substring(index +1);184 s = s.substring(index + 1); 185 185 186 186 index = before.indexOf(':'); 187 187 if (index >= 0) { 188 188 userName = before.substring(0, index); 189 password = before.substring(index +1);189 password = before.substring(index + 1); 190 190 } else { 191 191 // No ':', no password. … … 196 196 index = s.indexOf(':'); 197 197 if (index >= 0) { 198 // String contains ':' , portspecified.198 // String contains ':'. See if port was specified. 199 199 hostName = s.substring(0, index); 200 try { 201 port = Integer.parseInt(s.substring(index+1)); 202 } 203 catch (NumberFormatException e) { 204 Log.error(e); 200 String portString = s.substring(index + 1); 201 if (portString.length() > 0) { 202 try { 203 port = Integer.parseInt(portString); 204 } 205 catch (NumberFormatException e) { 206 Log.error(e); 207 } 205 208 } 206 209 } else { 207 // No ':' , portnot specified.210 // No ':'. Port was not specified. 208 211 hostName = s; 209 212 }
Note: See TracChangeset
for help on using the changeset viewer.