Changeset 4031 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2011-04-16T17:21:43+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/User.java
r4026 r4031 33 33 private static HashMap<Long,User> userMap = new HashMap<Long,User>(); 34 34 private static HashSet<Long> relicensingUsers = null; 35 private static HashSet<Long> nonRelicensingUsers = null; 35 36 36 37 private static long getNextLocalUid() { … … 111 112 112 113 public static void initRelicensingInformation() { 113 if (relicensingUsers == null) {114 if (relicensingUsers == null) { 114 115 loadRelicensingInformation(false); 115 116 } … … 118 119 public static void loadRelicensingInformation(boolean clean) { 119 120 relicensingUsers = new HashSet<Long>(); 121 nonRelicensingUsers = new HashSet<Long>(); 120 122 try { 121 MirroredInputStream stream = new MirroredInputStream(Main.pref.get("url.licensechange", 122 "http://planet.openstreetmap.org/users_agreed/users_agreed.txt"), clean ? 1 : 7200); 123 MirroredInputStream stream = new MirroredInputStream( 124 Main.pref.get("url.licensechange", 125 "http://planet.openstreetmap.org/users_agreed/users_agreed.txt"), 126 clean ? 1 : 7200); 123 127 try { 124 128 InputStreamReader r; … … 129 133 if (line.startsWith("#")) continue; 130 134 try { 131 relicensingUsers.add(new Long(Long.parseLong(line.trim()))); 135 Long id = new Long(Long.parseLong(line.trim())); 136 relicensingUsers.add(id); 137 } catch (java.lang.NumberFormatException ex) { 138 } 139 } 140 } 141 finally { 142 stream.close(); 143 } 144 } catch (IOException ex) { 145 } 146 147 try { 148 MirroredInputStream stream = new MirroredInputStream( 149 Main.pref.get("url.licensechange_reject", 150 "http://planet.openstreetmap.org/users_agreed/users_disagreed.txt"), 151 clean ? 1 : 7200); 152 try { 153 InputStreamReader r; 154 r = new InputStreamReader(stream); 155 BufferedReader reader = new BufferedReader(r); 156 String line; 157 while ((line = reader.readLine()) != null) { 158 if (line.startsWith("#")) continue; 159 try { 160 Long id = new Long(Long.parseLong(line.trim())); 161 nonRelicensingUsers.add(id); 132 162 } catch (java.lang.NumberFormatException ex) { 133 163 } … … 156 186 if (uid >= 286582) return STATUS_AUTO_AGREED; 157 187 if (relicensingUsers == null) return STATUS_UNKNOWN; 158 return (relicensingUsers.contains(new Long(uid)) ? STATUS_AGREED : STATUS_NOT_AGREED); 188 Long id = new Long(uid); 189 if (relicensingUsers.contains(id)) return STATUS_AGREED; 190 if (nonRelicensingUsers.contains(id)) return STATUS_NOT_AGREED; 191 return STATUS_UNKNOWN; 159 192 } 160 193
Note:
See TracChangeset
for help on using the changeset viewer.