Changeset 35019 in osm for applications/viewer/jmapviewer
- Timestamp:
- 2019-05-30T16:00:51+02:00 (6 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/FeatureAdapter.java
r35016 r35019 12 12 import java.util.Objects; 13 13 import java.util.TreeMap; 14 import java.util.logging.Level; 14 15 import java.util.logging.Logger; 15 16 … … 109 110 public static Logger getLogger(String name) { 110 111 return loggingAdapter.getLogger(name); 112 } 113 114 public static Logger getLogger(Class<?> klass) { 115 return loggingAdapter.getLogger(klass.getSimpleName()); 111 116 } 112 117 … … 155 160 } 156 161 } else { 157 System.err.println(tr("Opening link not supported on current platform (''{0}'')", url));162 getLogger(FeatureAdapter.class).log(Level.SEVERE, tr("Opening link not supported on current platform (''{0}'')", url)); 158 163 } 159 164 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
r35018 r35019 15 15 import java.util.concurrent.ThreadPoolExecutor; 16 16 import java.util.logging.Level; 17 import java.util.logging.Logger; 17 18 18 19 import org.openstreetmap.gui.jmapviewer.interfaces.TileJob; … … 26 27 */ 27 28 public class OsmTileLoader implements TileLoader { 29 30 private static final Logger LOG = FeatureAdapter.getLogger(OsmTileLoader.class); 31 28 32 /** Setting key for number of threads */ 29 33 public static final String THREADS_SETTING = "jmapviewer.osm-tile-loader.threads"; … … 34 38 nThreads = FeatureAdapter.getIntSetting(THREADS_SETTING, DEFAULT_THREADS_NUMBER); 35 39 } catch (Exception e) { 36 FeatureAdapter.getLogger(OsmTileLoader.class.getName()).log(Level.SEVERE, e.getMessage(), e); 37 } 38 } 40 LOG.log(Level.SEVERE, e.getMessage(), e); 41 } 42 } 43 39 44 private static final ThreadPoolExecutor jobDispatcher = (ThreadPoolExecutor) Executors.newFixedThreadPool(nThreads); 40 45 … … 81 86 if (input == null) { 82 87 try { 83 System.err.println("Failed loading " + tile.getUrl() +": "88 LOG.log(Level.SEVERE, "Failed loading " + tile.getUrl() +": " 84 89 +e.getClass() + ": " + e.getMessage()); 85 90 } catch (IOException ioe) { 86 ioe.printStackTrace();91 LOG.log(Level.SEVERE, ioe.getMessage(), ioe); 87 92 } 88 93 } … … 115 120 protected TileLoaderListener listener; 116 121 122 /** 123 * Constructs a new {@code OsmTileLoader}. 124 * @param listener tile loader listener 125 */ 117 126 public OsmTileLoader(TileLoaderListener listener) { 118 127 this(listener, null); -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
r35017 r35019 15 15 import java.util.concurrent.TimeUnit; 16 16 import java.util.concurrent.TimeoutException; 17 import java.util.logging.Level; 18 import java.util.logging.Logger; 17 19 import java.util.regex.Pattern; 18 20 … … 43 45 public class BingAerialTileSource extends TMSTileSource { 44 46 47 private static final Logger LOG = FeatureAdapter.getLogger(BingAerialTileSource.class); 48 45 49 /** Setting key for Bing metadata API URL. Must contain {@link #API_KEY_PLACEHOLDER} */ 46 50 public static final String METADATA_API_SETTING = "jmapviewer.bing.metadata-api-url"; … … 55 59 /** Original Bing API key created by Potlatch2 developers in 2010 */ 56 60 private static final String API_KEY = "Arzdiw4nlOJzRwOz__qailc8NiR31Tt51dN2D7cm57NrnceZnCpgOkmJhNpGoppU"; 61 57 62 private static volatile Future<List<Attribution>> attributions; // volatile is required for getAttribution(), see below. 58 63 private static String imageUrlTemplate; … … 171 176 172 177 return attributionsList; 173 } catch (SAXException e) { 174 System.err.println("Could not parse Bing aerials attribution metadata."); 175 e.printStackTrace(); 176 } catch (ParserConfigurationException | XPathExpressionException | NumberFormatException e) { 177 e.printStackTrace(); 178 } catch (SAXException | ParserConfigurationException | XPathExpressionException | NumberFormatException e) { 179 LOG.log(Level.SEVERE, "Could not parse Bing aerials attribution metadata.", e); 178 180 } 179 181 return null; … … 220 222 } 221 223 } catch (IOException e) { 222 System.err.println("Error while retrieving Bing logo: "+e.getMessage());224 LOG.log(Level.SEVERE, "Error while retrieving Bing logo: "+e.getMessage()); 223 225 } 224 226 return null; … … 253 255 return r; 254 256 } catch (IOException ex) { 255 System.err.println("Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds.");257 LOG.log(Level.SEVERE, "Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds."); 256 258 Thread.sleep(TimeUnit.SECONDS.toMillis(waitTimeSec)); 257 259 waitTimeSec *= 2; … … 276 278 return attributions.get(0, TimeUnit.MILLISECONDS); 277 279 } catch (TimeoutException ex) { 278 System.err.println("Bing: attribution data is not yet loaded.");280 LOG.log(Level.WARNING, "Bing: attribution data is not yet loaded."); 279 281 } catch (ExecutionException ex) { 280 282 throw new RuntimeException(ex.getCause()); 281 283 } catch (InterruptedException ign) { 282 System.err.println("InterruptedException: " + ign.getMessage());284 LOG.log(Level.SEVERE, "InterruptedException: " + ign.getMessage()); 283 285 } 284 286 return null;
Note:
See TracChangeset
for help on using the changeset viewer.