Changeset 41fc9cf
- Timestamp:
- Mar 11, 2011 1:11:18 AM (10 years ago)
- Branches:
- master
- Children:
- b048b01
- Parents:
- 7edbd3a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
core/java/src/net/i2p/client/naming/SingleFileNamingService.java
r7edbd3a r41fc9cf 98 98 public String reverseLookup(Destination dest, Properties options) { 99 99 String destkey = dest.toBase64(); 100 Properties hosts = new Properties();100 BufferedReader in = null; 101 101 getReadLock(); 102 102 try { 103 DataHelper.loadProps(hosts, _file, true); 103 in = new BufferedReader(new InputStreamReader(new FileInputStream(_file), "UTF-8"), 16*1024); 104 String line = null; 105 while ( (line = in.readLine()) != null) { 106 if (line.startsWith("#")) 107 continue; 108 if (line.indexOf('#') > 0) // trim off any end of line comment 109 line = line.substring(0, line.indexOf('#')).trim(); 110 int split = line.indexOf('='); 111 if (split <= 0) 112 continue; 113 if (destkey.equals(line.substring(split + 1))) 114 return line.substring(0, split); 115 } 116 return null; 104 117 } catch (Exception ioe) { 105 118 if (_file.exists()) … … 111 124 releaseReadLock(); 112 125 } 113 Set keyset = hosts.keySet();114 Iterator iter = keyset.iterator();115 while (iter.hasNext()) {116 String host = (String)iter.next();117 String key = hosts.getProperty(host);118 if (destkey.equals(key))119 return host;120 }121 return null;122 126 } 123 127 … … 314 318 line = line.substring(0, line.indexOf('#')).trim(); 315 319 int split = line.indexOf('='); 320 if (split <= 0) 321 continue; 316 322 String key = line.substring(split); 317 323 String b64 = line.substring(split+1); //.trim() ??????????????
Note: See TracChangeset
for help on using the changeset viewer.