Changeset 18830 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2023-09-18T20:27:46+02:00 (14 months ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/downloadtasks
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTask.java
r17333 r18830 8 8 import org.openstreetmap.josm.data.ProjectionBounds; 9 9 import org.openstreetmap.josm.io.UrlPattern; 10 import org.openstreetmap.josm.io.XmlWriter;11 10 12 11 /** … … 96 95 } 97 96 98 @Override99 public String acceptsDocumentationSummary() {100 StringBuilder buff = new StringBuilder(128)101 .append("<tr><td>")102 .append(getTitle())103 .append(":</td><td>");104 String[] patterns = getPatterns();105 if (patterns.length > 0) {106 buff.append("<ul>");107 for (String pattern: patterns) {108 buff.append("<li>")109 .append(XmlWriter.encode(pattern))110 .append("</li>");111 }112 buff.append("</ul>");113 }114 buff.append("</td></tr>");115 return buff.toString();116 }117 118 97 /** 119 98 * Determines if the given URL is accepted by {@link #getPatterns}. … … 128 107 /** 129 108 * Check / decide if the task is safe for remotecontrol. 130 * 109 * <p> 131 110 * Keep in mind that a potential attacker has full control over the content 132 111 * of the file that will be downloaded. 133 112 * If it is possible to run arbitrary code or write to the local file 134 113 * system, then the task is (obviously) not save for remote execution. 135 * 114 * <p> 136 115 * The default value is false = unsafe. Override in a subclass to 137 116 * allow running the task via remotecontol. -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTask.java
r17330 r18830 11 11 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 12 12 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 13 import org.openstreetmap.josm.io.XmlWriter; 13 14 import org.openstreetmap.josm.tools.ExceptionUtil; 14 15 … … 20 21 /** 21 22 * Asynchronously launches the download task for a given bounding box. 22 * 23 * <p> 23 24 * Set <code>progressMonitor</code> to null, if the task should create, open, and close a progress monitor. 24 25 * Set progressMonitor to {@link NullProgressMonitor#INSTANCE} if progress information is to 25 26 * be discarded. 26 * 27 * <p> 27 28 * You can wait for the asynchronous download task to finish by synchronizing on the returned 28 29 * {@link Future}, but make sure not to freeze up JOSM. Example: … … 60 61 /** 61 62 * Asynchronously launches the download task for a given bounding URL. 62 * 63 * <p> 63 64 * Set progressMonitor to null, if the task should create, open, and close a progress monitor. 64 65 * Set progressMonitor to {@link NullProgressMonitor#INSTANCE} if progress information is to … … 93 94 * @since 6031 94 95 */ 95 String acceptsDocumentationSummary(); 96 default String acceptsDocumentationSummary() { 97 StringBuilder buff = new StringBuilder(128) 98 .append("<tr><td>") 99 .append(getTitle()) 100 .append(":</td><td>"); 101 String[] patterns = getPatterns(); 102 if (patterns.length > 0) { 103 buff.append("<ul>"); 104 for (String pattern: patterns) { 105 buff.append("<li>") 106 .append(XmlWriter.encode(pattern)) 107 .append("</li>"); 108 } 109 buff.append("</ul>"); 110 } 111 buff.append("</td></tr>"); 112 return buff.toString(); 113 } 96 114 97 115 /** … … 111 129 /** 112 130 * Replies the error objects of the task. Empty list, if no error messages are available. 113 * 131 * <p> 114 132 * Error objects are either {@link String}s with error messages or {@link Exception}s. 115 133 * … … 131 149 return ExceptionUtil.explainException((Exception) o).replace("<html>", "").replace("</html>", ""); 132 150 } else { 133 return (String)null;151 return null; 134 152 } 135 153 }).filter(Objects::nonNull).collect(Collectors.toList());
Note:
See TracChangeset
for help on using the changeset viewer.