- Timestamp:
- 2016-12-12T02:28:14+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CopyCoordinatesAction.java
r10604 r11381 51 51 private Collection<Node> getSelectedNodes() { 52 52 DataSet ds = getLayerManager().getEditDataSet(); 53 if (ds == null || ds.getSelected() == null) {53 if (ds == null) { 54 54 return Collections.emptyList(); 55 55 } else { -
trunk/src/org/openstreetmap/josm/actions/ZoomToAction.java
r10413 r11381 70 70 return; 71 71 int[] rows = this.table.getSelectedRows(); 72 if (rows == null || rows.length == 0)72 if (rows.length == 0) 73 73 return; 74 74 int row = rows[0]; -
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r11144 r11381 401 401 updateStateByCurrentSelection(); 402 402 } 403 } else if (state == State.IMPROVING && mousePos != null) {403 } else if (state == State.IMPROVING) { 404 404 // Checking if the new coordinate is outside of the world 405 405 if (mv.getLatLon(mousePos.x, mousePos.y).isOutSideWorld()) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/PlayHeadDragMode.java
r9067 r11381 66 66 67 67 @Override public void mouseReleased(MouseEvent ev) { 68 Point p = ev.getPoint();69 68 mouseStart = null; 70 if (ev.getButton() != MouseEvent.BUTTON1 || p == null ||!dragging)69 if (ev.getButton() != MouseEvent.BUTTON1 || !dragging) 71 70 return; 72 71 -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r11339 r11381 566 566 String pattern = evalVars(item.getAttribute("pattern")); 567 567 String key = evalVars(item.getAttribute("key")); 568 if (key != null) { 569 PreferencesUtils.deletePreferenceKey(key, mainPrefs); 570 } 571 if (pattern != null) { 572 PreferencesUtils.deletePreferenceKeyByPattern(pattern, mainPrefs); 573 } 568 PreferencesUtils.deletePreferenceKey(key, mainPrefs); 569 PreferencesUtils.deletePreferenceKeyByPattern(pattern, mainPrefs); 574 570 return; 575 571 } … … 609 605 610 606 private void processDownloadElement(Element item) { 611 String address = evalVars(item.getAttribute("url"));612 String path = evalVars(item.getAttribute("path"));613 String unzip = evalVars(item.getAttribute("unzip"));614 String mkdir = evalVars(item.getAttribute("mkdir"));615 616 607 String base = evalVars(item.getAttribute("base")); 617 608 String dir = getDirectoryByAbbr(base); … … 621 612 } 622 613 614 String path = evalVars(item.getAttribute("path")); 623 615 if (path.contains("..") || path.startsWith("/") || path.contains(":")) { 624 616 return; // some basic protection 625 617 } 626 if (address == null || path == null || address.isEmpty() || path.isEmpty()) { 618 619 String address = evalVars(item.getAttribute("url")); 620 if (address.isEmpty() || path.isEmpty()) { 627 621 log("Error: Please specify url=\"where to get file\" and path=\"where to place it\""); 628 622 return; 629 623 } 624 625 String unzip = evalVars(item.getAttribute("unzip")); 626 String mkdir = evalVars(item.getAttribute("mkdir")); 630 627 processDownloadOperation(address, path, dir, "true".equals(mkdir), "true".equals(unzip)); 631 628 } … … 641 638 String text = evalVars(elem.getAttribute("text")); 642 639 String locText = evalVars(elem.getAttribute(LanguageInfo.getJOSMLocaleCode()+".text")); 643 if ( locText != null &&!locText.isEmpty()) text = locText;640 if (!locText.isEmpty()) text = locText; 644 641 645 642 String type = evalVars(elem.getAttribute("type")); -
trunk/src/org/openstreetmap/josm/data/cache/HostLimitQueue.java
r10723 r11381 89 89 } 90 90 job = takeFirst(); 91 if (job != null) { 92 acquireSemaphore(job); 93 } 91 acquireSemaphore(job); 94 92 return job; 95 93 } … … 119 117 if (job instanceof JCSCachedTileLoaderJob) { 120 118 final JCSCachedTileLoaderJob<?, ?> jcsJob = (JCSCachedTileLoaderJob<?, ?>) job; 121 Semaphore limit = getSemaphore(jcsJob); 122 if (limit != null) { 123 limit.acquire(); 124 jcsJob.setFinishedTask(() -> releaseSemaphore(jcsJob)); 125 } 119 getSemaphore(jcsJob).acquire(); 120 jcsJob.setFinishedTask(() -> releaseSemaphore(jcsJob)); 126 121 } 127 122 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r11129 r11381 669 669 for (OsmPrimitive p : primitives) { 670 670 Map<String, String> tags = p.getKeys(); 671 if (tags == null || tags.isEmpty()) {671 if (tags.isEmpty()) { 672 672 continue; 673 673 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java
r10680 r11381 273 273 public void actionPerformed(ActionEvent arg0) { 274 274 int[] rows = mineTable.getSelectedRows(); 275 if (rows == null || rows.length == 0)275 if (rows.length == 0) 276 276 return; 277 277 model.decide(rows, MergeDecisionType.KEEP_MINE); … … 305 305 public void actionPerformed(ActionEvent arg0) { 306 306 int[] rows = theirTable.getSelectedRows(); 307 if (rows == null || rows.length == 0)307 if (rows.length == 0) 308 308 return; 309 309 model.decide(rows, MergeDecisionType.KEEP_THEIR); … … 403 403 public void actionPerformed(ActionEvent arg0) { 404 404 int[] rows = mergedTable.getSelectedRows(); 405 if (rows == null || rows.length == 0)405 if (rows.length == 0) 406 406 return; 407 407 model.decide(rows, MergeDecisionType.UNDECIDED); -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/TextTagPaster.java
r10737 r11381 40 40 41 41 private boolean containsValidTags(TransferSupport support) throws UnsupportedFlavorException, IOException { 42 Map<String, String> tags = getTagsImpl(support); 43 return tags != null && !tags.isEmpty(); 42 return !getTagsImpl(support).isEmpty(); 44 43 } 45 44 … … 47 46 protected Map<String, String> getTags(TransferSupport support) throws UnsupportedFlavorException, IOException { 48 47 Map<String, String> tags = getTagsImpl(support); 49 if (tags == null || tags.isEmpty()) {48 if (tags.isEmpty()) { 50 49 TextTagParser.showBadBufferMessage(help); 51 50 throw new IOException("Invalid tags to paste."); -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r10938 r11381 160 160 public void select() { 161 161 int[] indexes = userTable.getSelectedRows(); 162 if (indexes == null || indexes.length == 0)162 if (indexes.length == 0) 163 163 return; 164 164 model.selectPrimitivesOwnedBy(userTable.getSelectedRows()); … … 196 196 public void actionPerformed(ActionEvent e) { 197 197 int[] rows = userTable.getSelectedRows(); 198 if (rows == null || rows.length == 0)198 if (rows.length == 0) 199 199 return; 200 200 List<User> users = model.getSelectedUsers(rows); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PresetListPanel.java
r11357 r11381 37 37 public void mouseClicked(MouseEvent e) { 38 38 Collection<OsmPrimitive> selection = t.createSelection(presetHandler.getSelection()); 39 if (selection == null || selection.isEmpty())39 if (selection.isEmpty()) 40 40 return; 41 41 int answer = t.showDialog(selection, false); -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r11335 r11381 354 354 && ((DefaultMutableTreeNode) child).getUserObject() instanceof TestError) { 355 355 final TestError error = (TestError) ((DefaultMutableTreeNode) child).getUserObject(); 356 if (error.getPrimitives() != null) { 357 if (error.getPrimitives().stream().anyMatch(isRelevant)) { 358 paths.add(p.pathByAddingChild(child)); 359 } 356 if (error.getPrimitives().stream().anyMatch(isRelevant)) { 357 paths.add(p.pathByAddingChild(child)); 360 358 } 361 359 } else { -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r11199 r11381 1167 1167 1168 1168 Rectangle2D sourceRect = coordinateConverter.getRectangleForTile(tile); 1169 if ( borderRect != null &&!sourceRect.intersects(borderRect)) {1169 if (!sourceRect.intersects(borderRect)) { 1170 1170 continue; 1171 1171 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r10824 r11381 147 147 return; 148 148 boolean mousePressedInButton = false; 149 if (e.getPoint() != null) { 150 for (Marker mkr : data) { 151 if (mkr.containsPoint(e.getPoint())) { 152 mousePressedInButton = true; 153 break; 154 } 149 for (Marker mkr : data) { 150 if (mkr.containsPoint(e.getPoint())) { 151 mousePressedInButton = true; 152 break; 155 153 } 156 154 } … … 170 168 if (!isVisible()) 171 169 return; 172 if (ev.getPoint() != null) { 173 for (Marker mkr : data) { 174 if (mkr.containsPoint(ev.getPoint())) { 175 mkr.actionPerformed(new ActionEvent(this, 0, null)); 176 } 170 for (Marker mkr : data) { 171 if (mkr.containsPoint(ev.getPoint())) { 172 mkr.actionPerformed(new ActionEvent(this, 0, null)); 177 173 } 178 174 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r10611 r11381 64 64 Main.map.mapView.addMouseListener(new MouseAdapter() { 65 65 @Override public void mousePressed(MouseEvent ev) { 66 Point p = ev.getPoint(); 67 if (ev.getButton() != MouseEvent.BUTTON1 || p == null) 68 return; 69 if (playHead.containsPoint(p)) { 66 if (ev.getButton() == MouseEvent.BUTTON1 && playHead.containsPoint(ev.getPoint())) { 70 67 /* when we get a click on the marker, we need to switch mode to avoid 71 68 * getting confused with other drag operations (like select) */ -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r10627 r11381 213 213 for (String setCookie: setCookies) { 214 214 String[] kvPairs = setCookie.split(";"); 215 if (kvPairs == null || kvPairs.length == 0) {215 if (kvPairs.length == 0) { 216 216 continue; 217 217 } … … 219 219 kvPair = kvPair.trim(); 220 220 String[] kv = kvPair.split("="); 221 if (kv == null || kv.length != 2) {221 if (kv.length != 2) { 222 222 continue; 223 223 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r10680 r11381 430 430 if (values_from != null) { 431 431 String[] classMethod = values_from.split("#"); 432 if (classMethod != null && classMethod.length == 2) {432 if (classMethod.length == 2) { 433 433 try { 434 434 Method method = Class.forName(classMethod[0]).getMethod(classMethod[1]); … … 517 517 for (Entry<String, PresetListEntry> entry : lhm.entrySet()) { 518 518 String k = entry.getValue().toString(); 519 if (k != null && k.equals(display)) {519 if (k.equals(display)) { 520 520 value = entry.getKey(); 521 521 break; -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r11100 r11381 439 439 for (GraphicsDevice gd: GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) { 440 440 DisplayMode dm = gd.getDisplayMode(); 441 if (dm != null) { 442 height = Math.max(height, dm.getHeight()); 443 width = Math.max(width, dm.getWidth()); 444 } 441 height = Math.max(height, dm.getHeight()); 442 width = Math.max(width, dm.getWidth()); 445 443 } 446 444 if (height == 0 || width == 0) { -
trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
r10638 r11381 393 393 protected Date[] parseTime(String value) throws ChangesetQueryUrlException { 394 394 String[] dates = value.split(","); 395 if (dates == null || dates.length == 0 || dates.length > 2)395 if (dates.length == 0 || dates.length > 2) 396 396 throw new ChangesetQueryUrlException( 397 397 tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "time", value)); -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r10627 r11381 827 827 StringBuilder urlBuilder = noteStringBuilder(note) 828 828 .append("/close"); 829 if ( encodedMessage != null &&!encodedMessage.trim().isEmpty()) {829 if (!encodedMessage.trim().isEmpty()) { 830 830 urlBuilder.append("?text="); 831 831 urlBuilder.append(encodedMessage); … … 849 849 StringBuilder urlBuilder = noteStringBuilder(note) 850 850 .append("/reopen"); 851 if ( encodedMessage != null &&!encodedMessage.trim().isEmpty()) {851 if (!encodedMessage.trim().isEmpty()) { 852 852 urlBuilder.append("?text="); 853 853 urlBuilder.append(encodedMessage); -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r10739 r11381 243 243 if (child != null) { 244 244 String baseURL = child.getAttribute("xlink:href"); 245 if ( baseURL != null &&!baseURL.equals(serviceUrlStr)) {245 if (!baseURL.equals(serviceUrlStr)) { 246 246 Main.info("GetCapabilities specifies a different service URL: " + baseURL); 247 247 serviceUrl = new URL(baseURL); -
trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
r11374 r11381 380 380 String activeAtt = layersEl.getAttribute("active"); 381 381 try { 382 active = (activeAtt != null &&!activeAtt.isEmpty()) ?Integer.parseInt(activeAtt)-1 : -1;382 active = !activeAtt.isEmpty() ? (Integer.parseInt(activeAtt)-1) : -1; 383 383 } catch (NumberFormatException e) { 384 384 Main.warn("Unsupported value for 'active' layer attribute. Ignoring it. Error was: "+e.getMessage()); … … 407 407 if (idx == null) { 408 408 error(tr("unexpected format of attribute ''index'' for element ''layer''")); 409 } 410 if (elems.containsKey(idx)) { 409 } else if (elems.containsKey(idx)) { 411 410 error(tr("attribute ''index'' ({0}) for element ''layer'' must be unique", Integer.toString(idx))); 412 411 } … … 415 414 deps.putVoid(idx); 416 415 String depStr = e.getAttribute("depends"); 417 if ( depStr != null &&!depStr.isEmpty()) {416 if (!depStr.isEmpty()) { 418 417 for (String sd : depStr.split(",")) { 419 418 Integer d = null; -
trunk/src/org/openstreetmap/josm/plugins/PluginListParser.java
r10123 r11381 95 95 if (name != null) { 96 96 PluginInformation info = createInfo(name, url, manifest); 97 if (info != null) { 98 for (PluginProxy plugin : PluginHandler.pluginList) { 99 if (plugin.getPluginInformation().name.equals(info.getName())) { 100 info.localversion = plugin.getPluginInformation().localversion; 101 } 97 for (PluginProxy plugin : PluginHandler.pluginList) { 98 if (plugin.getPluginInformation().name.equals(info.getName())) { 99 info.localversion = plugin.getPluginInformation().localversion; 102 100 } 103 ret.add(info);104 101 } 102 ret.add(info); 105 103 } 106 104 } catch (PluginListParseException ex) { -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r11288 r11381 209 209 ) { 210 210 String content = this.fetchContent(); 211 if (content == null || content.isEmpty()) {211 if (content.isEmpty()) { 212 212 Main.debug("Server did not return any body"); 213 213 } else { … … 289 289 } 290 290 } 291 if (in != null) { 292 in = new ProgressInputStream(in, getContentLength(), monitor); 293 in = "gzip".equalsIgnoreCase(getContentEncoding()) ? new GZIPInputStream(in) : in; 294 Compression compression = Compression.NONE; 295 if (uncompress) { 296 final String contentType = getContentType(); 297 Main.debug("Uncompressing input stream according to Content-Type header: {0}", contentType); 298 compression = Compression.forContentType(contentType); 299 } 300 if (uncompressAccordingToContentDisposition && Compression.NONE.equals(compression)) { 301 final String contentDisposition = getHeaderField("Content-Disposition"); 302 final Matcher matcher = Pattern.compile("filename=\"([^\"]+)\"").matcher( 303 contentDisposition != null ? contentDisposition : ""); 304 if (matcher.find()) { 305 Main.debug("Uncompressing input stream according to Content-Disposition header: {0}", contentDisposition); 306 compression = Compression.byExtension(matcher.group(1)); 307 } 308 } 309 in = compression.getUncompressedInputStream(in); 310 } 291 in = new ProgressInputStream(in, getContentLength(), monitor); 292 in = "gzip".equalsIgnoreCase(getContentEncoding()) ? new GZIPInputStream(in) : in; 293 Compression compression = Compression.NONE; 294 if (uncompress) { 295 final String contentType = getContentType(); 296 Main.debug("Uncompressing input stream according to Content-Type header: {0}", contentType); 297 compression = Compression.forContentType(contentType); 298 } 299 if (uncompressAccordingToContentDisposition && Compression.NONE.equals(compression)) { 300 final String contentDisposition = getHeaderField("Content-Disposition"); 301 final Matcher matcher = Pattern.compile("filename=\"([^\"]+)\"").matcher( 302 contentDisposition != null ? contentDisposition : ""); 303 if (matcher.find()) { 304 Main.debug("Uncompressing input stream according to Content-Disposition header: {0}", contentDisposition); 305 compression = Compression.byExtension(matcher.group(1)); 306 } 307 } 308 in = compression.getUncompressedInputStream(in); 311 309 return in; 312 310 } -
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r10627 r11381 204 204 protected final void initFromPreferences(String preferenceKey) throws WindowGeometryException { 205 205 String value = Main.pref.get(preferenceKey); 206 if (value == null || value.isEmpty())206 if (value.isEmpty()) 207 207 throw new WindowGeometryException( 208 208 tr("Preference with key ''{0}'' does not exist. Cannot restore window geometry from preferences.", preferenceKey));
Note:
See TracChangeset
for help on using the changeset viewer.