Index: trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java	(revision 11886)
+++ trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java	(revision 11889)
@@ -10,4 +10,5 @@
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.swing.JLabel;
@@ -61,6 +62,6 @@
         }
 
-        String searchTerm = searchTermBox.getText();
-        if (searchTerm == null || searchTerm.trim().isEmpty()) {
+        String searchTerm = Optional.ofNullable(searchTermBox.getText()).orElse("").trim();
+        if (searchTerm.isEmpty()) {
             Notification notification = new Notification(tr("You must enter a search term"));
             notification.setIcon(JOptionPane.WARNING_MESSAGE);
Index: trunk/src/org/openstreetmap/josm/data/Version.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Version.java	(revision 11886)
+++ trunk/src/org/openstreetmap/josm/data/Version.java	(revision 11889)
@@ -7,4 +7,5 @@
 import java.io.InputStream;
 import java.util.Map.Entry;
+import java.util.Optional;
 import java.util.Properties;
 
@@ -14,5 +15,5 @@
 /**
  * Provides basic information about the currently used JOSM build.
- *
+ * @since 2358
  */
 public class Version {
@@ -61,7 +62,6 @@
             Main.warn(e, tr("Error reading revision info from revision file: {0}", e.getMessage()));
         }
-        String value = properties.getProperty("Revision");
-        if (value != null) {
-            value = value.trim();
+        String value = Optional.ofNullable(properties.getProperty("Revision")).orElse("").trim();
+        if (!value.isEmpty()) {
             try {
                 version = Integer.parseInt(value);
@@ -83,17 +83,10 @@
         // is this a local build ?
         //
-        isLocalBuild = false;
-        value = properties.getProperty("Is-Local-Build");
-        if (value != null && "true".equalsIgnoreCase(value.trim())) {
-            isLocalBuild = true;
-        }
+        isLocalBuild = "true".equalsIgnoreCase(
+                Optional.ofNullable(properties.getProperty("Is-Local-Build")).orElse("").trim());
 
         // is this a specific build ?
         //
-        buildName = null;
-        value = properties.getProperty("Build-Name");
-        if (value != null && !value.trim().isEmpty()) {
-            buildName = value.trim();
-        }
+        buildName = Optional.ofNullable(properties.getProperty("Build-Name")).orElse("").trim();
 
         // the revision info
Index: trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11886)
+++ trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11889)
@@ -375,9 +375,19 @@
         if (t != null) {
             this.imageryType = t;
-        } else if (type != null && !type.trim().isEmpty()) {
+        } else if (type != null && !type.isEmpty()) {
             throw new IllegalArgumentException("unknown type: "+type);
         }
     }
 
+    /**
+     * Constructs a new {@code ImageryInfo} with given name, url, id, extended and EULA URLs.
+     * @param name The entry name
+     * @param url The entry URL
+     * @param type The entry imagery type. If null, WMS will be used as default
+     * @param eulaAcceptanceRequired The EULA URL
+     * @param cookies The data part of HTTP cookies header in case the service requires cookies to work
+     * @param id tile id
+     * @throws IllegalArgumentException if type refers to an unknown imagery type
+     */
     public ImageryInfo(String name, String url, String type, String eulaAcceptanceRequired, String cookies, String id) {
         this(name, url, type, eulaAcceptanceRequired, cookies);
@@ -558,4 +568,9 @@
     }
 
+    /**
+     * Determines if URL is equal to given imagery info.
+     * @param in imagery info
+     * @return {@code true} if URL is equal to given imagery info
+     */
     public boolean equalsBaseValues(ImageryInfo in) {
         return url.equals(in.url);
Index: trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 11886)
+++ trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 11889)
@@ -344,10 +344,11 @@
     public static Map<String, String> parseParameterList(String pref, boolean ignoreUnknownParameter) throws ProjectionConfigurationException {
         Map<String, String> parameters = new HashMap<>();
-        if (pref.trim().isEmpty()) {
+        String trimmedPref = pref.trim();
+        if (trimmedPref.isEmpty()) {
             return parameters;
         }
 
         Pattern keyPattern = Pattern.compile("\\+(?<key>[a-zA-Z0-9_]+)(=(?<value>.*))?");
-        String[] parts = Utils.WHITE_SPACES_PATTERN.split(pref.trim());
+        String[] parts = Utils.WHITE_SPACES_PATTERN.split(trimmedPref);
         for (String part : parts) {
             Matcher m = keyPattern.matcher(part);
@@ -488,4 +489,11 @@
     }
 
+    /**
+     * Parse {@code towgs84} parameter.
+     * @param paramList List of parameter arguments (expected: 3 or 7)
+     * @param ellps ellipsoid
+     * @return parsed datum ({@link ThreeParameterDatum} or {@link SevenParameterDatum})
+     * @throws ProjectionConfigurationException if the arguments cannot be parsed
+     */
     public Datum parseToWGS84(String paramList, Ellipsoid ellps) throws ProjectionConfigurationException {
         String[] numStr = paramList.split(",");
Index: trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java	(revision 11886)
+++ trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java	(revision 11889)
@@ -24,4 +24,5 @@
 import java.util.HashSet;
 import java.util.Locale;
+import java.util.Optional;
 import java.util.Set;
 import java.util.regex.Matcher;
@@ -428,10 +429,5 @@
         }
 
-        String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA);
-        if (extra != null && !extra.trim().isEmpty()) {
-            return false;
-        }
-
-        return true;
+        return Optional.ofNullable(authorityMatcher.group(PARSE_AUTHORITY_EXTRA)).orElse("").trim().isEmpty();
     }
 
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java	(revision 11886)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java	(revision 11889)
@@ -197,5 +197,5 @@
     public List<OpeningHoursTestError> checkOpeningHourSyntax(final String key, final String value, CheckMode mode,
             boolean ignoreOtherSeverity, String locale) {
-        if (ENGINE == null || value == null || value.trim().isEmpty()) {
+        if (ENGINE == null || value == null || value.isEmpty()) {
             return Collections.emptyList();
         }
