- Timestamp:
- 2018-05-25T01:42:16+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r13828 r13830 120 120 } 121 121 } catch (MalformedURLException ex) { 122 if (!GraphicsEnvironment.isHeadless()) { 123 JOptionPane.showMessageDialog(Main.parent, tr("Invalid service URL."), 124 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 125 } 126 Logging.log(Logging.LEVEL_ERROR, ex); 122 handleException(ex, tr("Invalid service URL."), tr("WMS Error"), null); 127 123 } catch (IOException ex) { 128 if (!GraphicsEnvironment.isHeadless()) { 129 JOptionPane.showMessageDialog(Main.parent, tr("Could not retrieve WMS layer list."), 130 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 131 } 132 Logging.log(Logging.LEVEL_ERROR, ex); 124 handleException(ex, tr("Could not retrieve WMS layer list."), tr("WMS Error"), null); 133 125 } catch (WMSGetCapabilitiesException ex) { 134 if (!GraphicsEnvironment.isHeadless()) { 135 JOptionPane.showMessageDialog(Main.parent, tr("Could not parse WMS layer list."), 136 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 137 } 138 Logging.log(Logging.LEVEL_ERROR, "Could not parse WMS layer list. Incoming data:\n"+ex.getIncomingData(), ex); 139 } catch (WMTSGetCapabilitiesException e) { 140 if (!GraphicsEnvironment.isHeadless()) { 141 JOptionPane.showMessageDialog(Main.parent, tr("Could not parse WMTS layer list."), 142 tr("WMTS Error"), JOptionPane.ERROR_MESSAGE); 143 } 144 Logging.log(Logging.LEVEL_ERROR, "Could not parse WMTS layer list.", e); 126 handleException(ex, tr("Could not parse WMS layer list."), tr("WMS Error"), 127 "Could not parse WMS layer list. Incoming data:\n" + ex.getIncomingData()); 128 } catch (WMTSGetCapabilitiesException ex) { 129 handleException(ex, tr("Could not parse WMTS layer list."), tr("WMTS Error"), 130 "Could not parse WMTS layer list."); 145 131 } 146 132 return null; … … 223 209 return ret; 224 210 } catch (MalformedURLException ex) { 225 if (!GraphicsEnvironment.isHeadless()) { 226 JOptionPane.showMessageDialog(Main.parent, tr("Invalid service URL."), 227 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 228 } 229 Logging.log(Logging.LEVEL_ERROR, ex); 211 handleException(ex, tr("Invalid service URL."), tr("WMS Error"), null); 230 212 } catch (IOException ex) { 231 if (!GraphicsEnvironment.isHeadless()) { 232 JOptionPane.showMessageDialog(Main.parent, tr("Could not retrieve WMS layer list."), 233 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 234 } 235 Logging.log(Logging.LEVEL_ERROR, ex); 213 handleException(ex, tr("Could not retrieve WMS layer list."), tr("WMS Error"), null); 236 214 } catch (WMSGetCapabilitiesException ex) { 237 if (!GraphicsEnvironment.isHeadless()) { 238 JOptionPane.showMessageDialog(Main.parent, tr("Could not parse WMS layer list."), 239 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 240 } 241 Logging.log(Logging.LEVEL_ERROR, "Could not parse WMS layer list. Incoming data:\n"+ex.getIncomingData(), ex); 215 handleException(ex, tr("Could not parse WMS layer list."), tr("WMS Error"), 216 "Could not parse WMS layer list. Incoming data:\n" + ex.getIncomingData()); 242 217 } 243 218 return null; 219 } 220 221 private static void handleException(Exception ex, String uiMessage, String uiTitle, String logMessage) { 222 if (!GraphicsEnvironment.isHeadless()) { 223 JOptionPane.showMessageDialog(Main.parent, uiMessage, uiTitle, JOptionPane.ERROR_MESSAGE); 224 } 225 Logging.log(Logging.LEVEL_ERROR, logMessage, ex); 244 226 } 245 227
Note:
See TracChangeset
for help on using the changeset viewer.