Changeset 11889 in josm
- Timestamp:
- 2017-04-12T22:22:52+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java
r11419 r11889 10 10 import java.util.LinkedList; 11 11 import java.util.List; 12 import java.util.Optional; 12 13 13 14 import javax.swing.JLabel; … … 61 62 } 62 63 63 String searchTerm = searchTermBox.getText();64 if (searchTerm == null || searchTerm.trim().isEmpty()) {64 String searchTerm = Optional.ofNullable(searchTermBox.getText()).orElse("").trim(); 65 if (searchTerm.isEmpty()) { 65 66 Notification notification = new Notification(tr("You must enter a search term")); 66 67 notification.setIcon(JOptionPane.WARNING_MESSAGE); -
trunk/src/org/openstreetmap/josm/data/Version.java
r10420 r11889 7 7 import java.io.InputStream; 8 8 import java.util.Map.Entry; 9 import java.util.Optional; 9 10 import java.util.Properties; 10 11 … … 14 15 /** 15 16 * Provides basic information about the currently used JOSM build. 16 * 17 * @since 2358 17 18 */ 18 19 public class Version { … … 61 62 Main.warn(e, tr("Error reading revision info from revision file: {0}", e.getMessage())); 62 63 } 63 String value = properties.getProperty("Revision"); 64 if (value != null) { 65 value = value.trim(); 64 String value = Optional.ofNullable(properties.getProperty("Revision")).orElse("").trim(); 65 if (!value.isEmpty()) { 66 66 try { 67 67 version = Integer.parseInt(value); … … 83 83 // is this a local build ? 84 84 // 85 isLocalBuild = false; 86 value = properties.getProperty("Is-Local-Build"); 87 if (value != null && "true".equalsIgnoreCase(value.trim())) { 88 isLocalBuild = true; 89 } 85 isLocalBuild = "true".equalsIgnoreCase( 86 Optional.ofNullable(properties.getProperty("Is-Local-Build")).orElse("").trim()); 90 87 91 88 // is this a specific build ? 92 89 // 93 buildName = null; 94 value = properties.getProperty("Build-Name"); 95 if (value != null && !value.trim().isEmpty()) { 96 buildName = value.trim(); 97 } 90 buildName = Optional.ofNullable(properties.getProperty("Build-Name")).orElse("").trim(); 98 91 99 92 // the revision info -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r11858 r11889 375 375 if (t != null) { 376 376 this.imageryType = t; 377 } else if (type != null && !type. trim().isEmpty()) {377 } else if (type != null && !type.isEmpty()) { 378 378 throw new IllegalArgumentException("unknown type: "+type); 379 379 } 380 380 } 381 381 382 /** 383 * Constructs a new {@code ImageryInfo} with given name, url, id, extended and EULA URLs. 384 * @param name The entry name 385 * @param url The entry URL 386 * @param type The entry imagery type. If null, WMS will be used as default 387 * @param eulaAcceptanceRequired The EULA URL 388 * @param cookies The data part of HTTP cookies header in case the service requires cookies to work 389 * @param id tile id 390 * @throws IllegalArgumentException if type refers to an unknown imagery type 391 */ 382 392 public ImageryInfo(String name, String url, String type, String eulaAcceptanceRequired, String cookies, String id) { 383 393 this(name, url, type, eulaAcceptanceRequired, cookies); … … 558 568 } 559 569 570 /** 571 * Determines if URL is equal to given imagery info. 572 * @param in imagery info 573 * @return {@code true} if URL is equal to given imagery info 574 */ 560 575 public boolean equalsBaseValues(ImageryInfo in) { 561 576 return url.equals(in.url); -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r11858 r11889 344 344 public static Map<String, String> parseParameterList(String pref, boolean ignoreUnknownParameter) throws ProjectionConfigurationException { 345 345 Map<String, String> parameters = new HashMap<>(); 346 if (pref.trim().isEmpty()) { 346 String trimmedPref = pref.trim(); 347 if (trimmedPref.isEmpty()) { 347 348 return parameters; 348 349 } 349 350 350 351 Pattern keyPattern = Pattern.compile("\\+(?<key>[a-zA-Z0-9_]+)(=(?<value>.*))?"); 351 String[] parts = Utils.WHITE_SPACES_PATTERN.split( pref.trim());352 String[] parts = Utils.WHITE_SPACES_PATTERN.split(trimmedPref); 352 353 for (String part : parts) { 353 354 Matcher m = keyPattern.matcher(part); … … 488 489 } 489 490 491 /** 492 * Parse {@code towgs84} parameter. 493 * @param paramList List of parameter arguments (expected: 3 or 7) 494 * @param ellps ellipsoid 495 * @return parsed datum ({@link ThreeParameterDatum} or {@link SevenParameterDatum}) 496 * @throws ProjectionConfigurationException if the arguments cannot be parsed 497 */ 490 498 public Datum parseToWGS84(String paramList, Ellipsoid ellps) throws ProjectionConfigurationException { 491 499 String[] numStr = paramList.split(","); -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r11747 r11889 24 24 import java.util.HashSet; 25 25 import java.util.Locale; 26 import java.util.Optional; 26 27 import java.util.Set; 27 28 import java.util.regex.Matcher; … … 428 429 } 429 430 430 String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA); 431 if (extra != null && !extra.trim().isEmpty()) { 432 return false; 433 } 434 435 return true; 431 return Optional.ofNullable(authorityMatcher.group(PARSE_AUTHORITY_EXTRA)).orElse("").trim().isEmpty(); 436 432 } 437 433 -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r11129 r11889 197 197 public List<OpeningHoursTestError> checkOpeningHourSyntax(final String key, final String value, CheckMode mode, 198 198 boolean ignoreOtherSeverity, String locale) { 199 if (ENGINE == null || value == null || value. trim().isEmpty()) {199 if (ENGINE == null || value == null || value.isEmpty()) { 200 200 return Collections.emptyList(); 201 201 }
Note:
See TracChangeset
for help on using the changeset viewer.