Changeset 10001 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2016-03-17T01:50:12+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 4 edited
-
NmeaReader.java (modified) (1 diff)
-
OsmChangesetParser.java (modified) (2 diffs)
-
OsmServerWriter.java (modified) (4 diffs)
-
remotecontrol/RequestProcessor.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r9740 r10001 173 173 try (BufferedReader rd = new BufferedReader(new InputStreamReader(source, StandardCharsets.UTF_8))) { 174 174 StringBuilder sb = new StringBuilder(1024); 175 int loopstart _char = rd.read();175 int loopstartChar = rd.read(); 176 176 ps = new NMEAParserState(); 177 if (loopstart _char == -1)177 if (loopstartChar == -1) 178 178 //TODO tell user about the problem? 179 179 return; 180 sb.append((char) loopstart _char);180 sb.append((char) loopstartChar); 181 181 ps.pDate = "010100"; // TODO date problem 182 182 while (true) { -
trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
r8855 r10001 119 119 120 120 // -- min_lon and min_lat 121 String min _lon= atts.getValue("min_lon");122 String min _lat= atts.getValue("min_lat");123 String max _lon= atts.getValue("max_lon");124 String max _lat= atts.getValue("max_lat");125 if (min _lon!= null && min_lat!= null && max_lon!= null && max_lat!= null) {121 String minLonStr = atts.getValue("min_lon"); 122 String minLatStr = atts.getValue("min_lat"); 123 String maxLonStr = atts.getValue("max_lon"); 124 String maxLatStr = atts.getValue("max_lat"); 125 if (minLonStr != null && minLatStr != null && maxLonStr != null && maxLatStr != null) { 126 126 double minLon = 0; 127 127 try { 128 minLon = Double.parseDouble(min _lon);129 } catch (NumberFormatException e) { 130 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "min_lon", min _lon));128 minLon = Double.parseDouble(minLonStr); 129 } catch (NumberFormatException e) { 130 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "min_lon", minLonStr)); 131 131 } 132 132 double minLat = 0; 133 133 try { 134 minLat = Double.parseDouble(min _lat);135 } catch (NumberFormatException e) { 136 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "min_lat", min _lat));134 minLat = Double.parseDouble(minLatStr); 135 } catch (NumberFormatException e) { 136 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "min_lat", minLatStr)); 137 137 } 138 138 current.setMin(new LatLon(minLat, minLon)); … … 142 142 double maxLon = 0; 143 143 try { 144 maxLon = Double.parseDouble(max _lon);145 } catch (NumberFormatException e) { 146 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "max_lon", max _lon));144 maxLon = Double.parseDouble(maxLonStr); 145 } catch (NumberFormatException e) { 146 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "max_lon", maxLonStr)); 147 147 } 148 148 double maxLat = 0; 149 149 try { 150 maxLat = Double.parseDouble(max _lat);151 } catch (NumberFormatException e) { 152 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "max_lat", max _lat));150 maxLat = Double.parseDouble(maxLatStr); 151 } catch (NumberFormatException e) { 152 throwException(tr("Illegal value for attribute ''{0}''. Got ''{1}''.", "max_lat", maxLatStr)); 153 153 } 154 154 current.setMax(new LatLon(maxLon, maxLat)); -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r9528 r10001 61 61 private long uploadStartTime; 62 62 63 public String timeLeft(int progress, int list _size) {63 public String timeLeft(int progress, int listSize) { 64 64 long now = System.currentTimeMillis(); 65 65 long elapsed = now - uploadStartTime; … … 67 67 elapsed = 1; 68 68 } 69 double uploads _per_ms = (double) progress / elapsed;70 double uploads _left = list_size - progress;71 long ms _left = (long) (uploads_left / uploads_per_ms);72 long minutes _left = ms_left / MSECS_PER_MINUTE;73 long seconds _left = (ms_left / MSECS_PER_SECOND) % SECONDS_PER_MINUTE;74 StringBuilder time _left_str = new StringBuilder().append(minutes_left).append(':');75 if (seconds _left < 10) {76 time _left_str.append('0');77 } 78 return time _left_str.append(seconds_left).toString();69 double uploadsPerMs = (double) progress / elapsed; 70 double uploadsLeft = listSize - progress; 71 long msLeft = (long) (uploadsLeft / uploadsPerMs); 72 long minutesLeft = msLeft / MSECS_PER_MINUTE; 73 long secondsLeft = (msLeft / MSECS_PER_SECOND) % SECONDS_PER_MINUTE; 74 StringBuilder timeLeftStr = new StringBuilder().append(minutesLeft).append(':'); 75 if (secondsLeft < 10) { 76 timeLeftStr.append('0'); 77 } 78 return timeLeftStr.append(secondsLeft).toString(); 79 79 } 80 80 … … 94 94 for (OsmPrimitive osm : primitives) { 95 95 int progress = progressMonitor.getTicks(); 96 String time _left_str = timeLeft(progress, primitives.size());96 String timeLeftStr = timeLeft(progress, primitives.size()); 97 97 String msg = ""; 98 98 switch(OsmPrimitiveType.from(osm)) { … … 106 106 progress, 107 107 primitives.size(), 108 time _left_str,108 timeLeftStr, 109 109 osm.getName() == null ? osm.getId() : osm.getName(), 110 110 osm.getId())); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r10000 r10001 177 177 178 178 Map<String, String> headers = new HashMap<>(); 179 int k = 0, MAX_HEADERS = 20; 180 while (k < MAX_HEADERS) { 179 int k = 0; 180 int maxHeaders = 20; 181 while (k < maxHeaders) { 181 182 get = in.readLine(); 182 183 if (get == null) break;
Note:
See TracChangeset
for help on using the changeset viewer.
