Changeset 6287 in josm
- Timestamp:
- 2013-10-02T01:03:42+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r6265 r6287 121 121 try { 122 122 addRecursiveFiles(files, selection); 123 } catch (NullPointerException npe) {124 rememberError( tr("One of the selected files was null"));123 } catch (IllegalStateException e) { 124 rememberError(e.getMessage()); 125 125 } 126 126 … … 209 209 } 210 210 211 if (nullFile) 212 throw new NullPointerException(); 211 if (nullFile) { 212 throw new IllegalStateException(tr("One of the selected files was null")); 213 } 213 214 } 214 215 -
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r6248 r6287 1 //License: GPL. Copyright 2008 by Christoph Brill 2 1 //License: GPL. See README for details. 3 2 package org.openstreetmap.josm.io; 4 3 5 4 import java.io.BufferedReader; 6 5 import java.io.File; 7 import java.io.IOException;8 6 import java.io.InputStream; 9 7 import java.io.InputStreamReader; … … 15 13 import java.util.Date; 16 14 15 import org.openstreetmap.josm.Main; 17 16 import org.openstreetmap.josm.data.coor.LatLon; 18 17 import org.openstreetmap.josm.data.gpx.GpxData; … … 196 195 int c = rd.read(); 197 196 if(c=='$') { 198 ParseNMEASentence(sb.toString(), ps);197 parseNMEASentence(sb.toString(), ps); 199 198 sb.delete(0, sb.length()); 200 199 sb.append('$'); 201 200 } else if(c == -1) { 202 201 // EOF: add last WayPoint if it works out 203 ParseNMEASentence(sb.toString(),ps);202 parseNMEASentence(sb.toString(),ps); 204 203 break; 205 204 } else { … … 210 209 data.tracks.add(new ImmutableGpxTrack(currentTrack, Collections.<String, Object>emptyMap())); 211 210 212 } catch ( IOException e) {213 // TODO tell user about the problem?211 } catch (Exception e) { 212 Main.warn(e); 214 213 } finally { 215 214 Utils.close(rd); … … 233 232 // in the collection in the NMEAParserState object. 234 233 // Returns true if the input made sence, false otherwise. 235 private boolean ParseNMEASentence(String s, NMEAParserState ps){234 private boolean parseNMEASentence(String s, NMEAParserState ps) throws IllegalDataException { 236 235 try { 237 if (s.isEmpty()) 238 throw new NullPointerException(); 236 if (s.isEmpty()) { 237 throw new IllegalArgumentException("s is empty"); 238 } 239 239 240 240 // checksum check: … … 274 274 e[GPGGA.LONGITUDE.position] 275 275 ); 276 if(latLon==null) 277 throw new NullPointerException(); // malformed 278 279 if((latLon.lat()==0.0) && (latLon.lon()==0.0)) { 276 if (latLon==null) { 277 throw new IllegalDataException("Malformed lat/lon"); 278 } 279 280 if ((latLon.lat()==0.0) && (latLon.lon()==0.0)) { 280 281 ps.zero_coord++; 281 282 return false;
Note:
See TracChangeset
for help on using the changeset viewer.