Changeset 11397 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-12-14T15:50:53+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r11100 r11397 124 124 */ 125 125 public static void play(URL url) throws Exception { 126 AudioPlayer.getInstance().command.play(url, 0.0, 1.0); 126 AudioPlayer instance = AudioPlayer.getInstance(); 127 if (instance != null) 128 instance.command.play(url, 0.0, 1.0); 127 129 } 128 130 … … 134 136 */ 135 137 public static void play(URL url, double seconds) throws Exception { 136 AudioPlayer.getInstance().command.play(url, seconds, 1.0); 138 AudioPlayer instance = AudioPlayer.getInstance(); 139 if (instance != null) 140 instance.command.play(url, seconds, 1.0); 137 141 } 138 142 … … 145 149 */ 146 150 public static void play(URL url, double seconds, double speed) throws Exception { 147 AudioPlayer.getInstance().command.play(url, seconds, speed); 151 AudioPlayer instance = AudioPlayer.getInstance(); 152 if (instance != null) 153 instance.command.play(url, seconds, speed); 148 154 } 149 155 … … 153 159 */ 154 160 public static void pause() throws Exception { 155 AudioPlayer.getInstance().command.pause(); 161 AudioPlayer instance = AudioPlayer.getInstance(); 162 if (instance != null) 163 instance.command.pause(); 156 164 } 157 165 … … 161 169 */ 162 170 public static URL url() { 163 return AudioPlayer.getInstance().playingUrl; 171 AudioPlayer instance = AudioPlayer.getInstance(); 172 return instance == null ? null : instance.playingUrl; 164 173 } 165 174 … … 169 178 */ 170 179 public static boolean paused() { 171 return AudioPlayer.getInstance().state == State.PAUSED; 180 AudioPlayer instance = AudioPlayer.getInstance(); 181 return instance == null ? false : (instance.state == State.PAUSED); 172 182 } 173 183 … … 177 187 */ 178 188 public static boolean playing() { 179 return AudioPlayer.getInstance().state == State.PLAYING; 189 AudioPlayer instance = AudioPlayer.getInstance(); 190 return instance == null ? false : (instance.state == State.PLAYING); 180 191 } 181 192 … … 185 196 */ 186 197 public static double position() { 187 return AudioPlayer.getInstance().position; 198 AudioPlayer instance = AudioPlayer.getInstance(); 199 return instance == null ? -1 : instance.position; 188 200 } 189 201 … … 193 205 */ 194 206 public static double speed() { 195 return AudioPlayer.getInstance().speed; 207 AudioPlayer instance = AudioPlayer.getInstance(); 208 return instance == null ? -1 : instance.speed; 196 209 } 197 210 -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r10717 r11397 510 510 return tr("<html>Failed to upload data to or download data from<br>" + "''{0}''<br>" 511 511 + "due to a problem with transferring data.<br>" 512 + "Details (untranslated): {1}</html>", e.getUrl(), 512 + "Details (untranslated): {1}</html>", 513 e != null ? e.getUrl() : "null", 513 514 ioe != null ? ioe.getMessage() : "null"); 514 515 } -
trunk/src/org/openstreetmap/josm/tools/Logging.java
r11165 r11397 261 261 StringWriter sb = new StringWriter(); 262 262 sb.append(getErrorLog(message, t)); 263 sb.append('\n'); 264 t.printStackTrace(new PrintWriter(sb)); 263 if (t != null) { 264 sb.append('\n'); 265 t.printStackTrace(new PrintWriter(sb)); 266 } 265 267 return sb.toString(); 266 268 } -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r11340 r11397 205 205 206 206 public boolean isEvent(KeyEvent e) { 207 return getKeyStroke() != null && getKeyStroke().equals(208 KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers()));207 KeyStroke ks = getKeyStroke(); 208 return ks != null && ks.equals(KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers())); 209 209 } 210 210
Note:
See TracChangeset
for help on using the changeset viewer.