Changeset 8216 in josm
- Timestamp:
- 2015-04-18T11:50:47+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java
r8195 r8216 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn; 5 6 6 7 import java.io.IOException; … … 8 9 import java.util.List; 9 10 import java.util.concurrent.Future; 11 12 import javax.swing.JOptionPane; 10 13 11 14 import org.openstreetmap.josm.Main; … … 141 144 try { 142 145 notesData = reader.parseNotes(null, null, subMonitor); 146 } catch (BoundingBoxDownloader.MoreNotesException e) { 147 JOptionPane.showMessageDialog(Main.parent, "<html>" 148 + trn("{0} note has been downloaded.", "{0} notes have been downloaded.", e.limit, e.limit) 149 + "<br>" 150 + tr("Since the download limit was {0}, there might be more notes to download.", e.limit) 151 + "<br>" 152 + tr("Request a smaller area to make sure that all notes are being downloaded.") 153 + "</html>", 154 tr("More notes to download"), JOptionPane.INFORMATION_MESSAGE); 143 155 } catch (Exception e) { 144 156 if (isCanceled()) -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r8118 r8216 162 162 163 163 @Override 164 public List<Note> parseNotes(Integer noteLimit, Integer daysClosed, ProgressMonitor progressMonitor) throws OsmTransferException {164 public List<Note> parseNotes(Integer noteLimit, Integer daysClosed, ProgressMonitor progressMonitor) throws OsmTransferException, MoreNotesException { 165 165 progressMonitor.beginTask("Downloading notes"); 166 166 noteLimit = checkNoteLimit(noteLimit); … … 180 180 InputStream is = getInputStream(url, progressMonitor.createSubTaskMonitor(1, false)); 181 181 NoteReader reader = new NoteReader(is); 182 return reader.parse(); 182 final List<Note> notes = reader.parse(); 183 if (notes.size() == noteLimit) { 184 throw new MoreNotesException(noteLimit); 185 } 186 return notes; 183 187 } catch (IOException e) { 184 188 throw new OsmTransferException(e); … … 187 191 } finally { 188 192 progressMonitor.finishTask(); 193 } 194 } 195 196 /** 197 * Indicates that the number of fetched notes equals the specified limit. Thus there might be more notes to download. 198 */ 199 public static class MoreNotesException extends RuntimeException{ 200 /** 201 * The download limit sent to the server. 202 */ 203 public final int limit; 204 205 public MoreNotesException(int limit) { 206 this.limit = limit; 189 207 } 190 208 } … … 194 212 limit = Main.pref.getInteger("osm.notes.downloadLimit", 1000); 195 213 } 196 if (limit > 10000) { 197 Main.error("Requested note limit is over API hard limit of 10000. Reducing to 10000."); 198 limit = 10000; 214 if (limit > 50000) { 215 // see max_number_of_nodes in https://github.com/openstreetmap/openstreetmap-website/blob/master/config/example.application.yml 216 Main.error("Requested note limit is over API hard limit of 50000. Reducing to 50000."); 217 limit = 50000; 199 218 } 200 219 if (limit < 1) { … … 202 221 limit = 1; 203 222 } 204 Main.debug("returning note limit: " + limit);205 223 return limit; 206 224 } … … 214 232 days = -1; 215 233 } 216 Main.debug("returning days closed: " + days);217 234 return days; 218 235 }
Note:
See TracChangeset
for help on using the changeset viewer.